Archived

This topic is now archived and is closed to further replies.

kajjait

Audio in SDL

Recommended Posts

kajjait    130
I am using the audio example in the book "Programming linux games" and the sound is delayed 1/4''th of a second! my only problem with tis is when i try to loop a sound it is delayed 1/4''th of a second and doesnt sound right!

Share this post


Link to post
Share on other sites
Biased turkey    122
You are lucky, I tried the same example yesterday and ..I don''t even have any sound at all .
I compiled the source code directly without using the makefile included with the downloaded sources and the gcc compiler didn''t return any error.When I run the executable it confirms that the canon and bomb wavefiles have been loaded successfully but it sounds like the gunpowder is...wet.
I know my Soundblaster live works OK because I have sound while playing Tuxracer and Unreal tournament.

Cone3D''s reply doesn''t help either
Maybe I should try to compiles all the sources at once using the included makefile.

Share this post


Link to post
Share on other sites
blue4    122
Well, i''m using a modified version of the SDL Audio Mixer example in SDL Documentation. When i got sound latency, it was gone by decreasing sound buffer.


--blue4--

Share this post


Link to post
Share on other sites
Biased turkey    122
2 things:
1) I compiled the example from the book using the included makefile and it works, and I was surprised to hear that the same file i compiled directly from source ( using the gcc command works too ) it looks like just rebooting the system did the trick.
It''s true that there is a small latency before hearing the sound of the explosion.
Obviously, as specified in the SDL doc and as suggested by Blue4 the trick is to decrease the value of desired.samples
The documentation suggests values between 512 and 8192
The example uses 4096 so maybe we should try 2048 or 1024

To Blue4:
What value are you using for desired.sample ?

Share this post


Link to post
Share on other sites
Biased turkey    122
To Kajjait:
According to the SDL documentation, desired->samples should be a power of 2, a value of 2000 doesn''t fit that criteria, but 2048 does.
Of course if 2000 works for you, that''s fine

Share this post


Link to post
Share on other sites