Audio in SDL

Started by
6 comments, last by kajjait 22 years ago
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!
Advertisement
sry, can''t help you there


---
cone3d
http://cone3d.gamedev.net
My software never has any bugs - it just generates random features
---cone3dhttp://cone3d.gamedev.netMy software never has any bugs - it just generates random features
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.

I''ve only used SDL_Mixer (not SDL_Audio) but I had quite the same problem as you. I just increased the buffer size and it worked better. It may be your problem ?
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--
--blue4--
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 ?
thanks everyone! i changed the desired.samples to 2000 but anything above that lags :\ its ok though only a tiny bit of static
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

This topic is closed to new replies.

Advertisement