[SDL] audio lagging when compiling SDL/SDL_mixer by myself
Thomas Unterthiner
thomas_unterthiner at web.de
Tue Jul 31 13:29:14 PDT 2007
Hello everyone!
I'm having a very strange problem with SDL_mixer. Im developing under
Windows, using GCC 4.2.1 (grabbed from
http://sourceforge.net/projects/tdm-gcc/ ). When trying to compile SDL
1.2.12 and SDL_mixer 1.2.7 for use in one of my games I bumped into a
strange problem:
When I compile my program using my home-brewed version of SDL all the
sounds are played with a little delay ( about 0.5 seconds), and when the
game is playing too many samples at once (hard to say, maybe 5-8 sounds)
the sound "doesn't come out right". It's a bit hard to explain, so you
might want to check it out yourself:
http://bluetiger.bauchlandung.org/misc/ZombieShooter.zip
(try clicking very fast to generate many shooting-sounds). In case you
need to look at the source code, it's also included in the package. All
the sound-related stuff is located in "SoundManager.cpp". However I am
not aware of doing anything out of the ordinary.
If you exchange the SDL.dll you find in that package with the official
one from http://www.libsdl.org/release/SDL-1.2.12-win32.zip you will
notice that the sound works correctly. I tried out a myriad of different
./configure-settings (enabling/disabling things, linking statically,
using SDL 1.2.11, ...) when compiling SDL without getting rid of the
problem. Also the problem is independent of the audio-format used (I've
tried with both WAV and OGG-files). I noticed that reducing the
chunksize when calling Mix_OpenAudio to insanely small values (e.g. 32
instead of 1024) reduces the lag-problem, but the audio still remains
distorted when playing multiple samples at once (even when using
Mix_AllocateChannels(1024) ).
The SDL.dll included in my package was compiled without any
compiler-options, whilst SDL_mixer.dll was compiled with support for WAV
and OGG only. However even when doing a "plain" ./configure (w/o any
special parameters) the problem still persists, and since the problem
comes and goes by exchanging SDL.dll I assume it isn't related to
SDL_mixer at all. Is this a bug in SDL, am I missing something or what
exaclty is going on here? I hope you can help me out :)
P. S. I already submitted this message to the list some days ago (before
i was registered on the list), but it seems to have gone lost. If it
didn't I'm sorry for reposting it now!
best regards
Thomas Unterthiner
More information about the SDL
mailing list