Thanks in advance for any help…
I have written a game in SDL that plays .WAV and .OGG files. It uses
the SDL_Mixer library. I have no sound latency problems running in
Windows, only in Linux. I am using Red Hat 8.0 and sdl 1.2.4. The
application run finds right after boot. But if I execute it again
immediately after exiting, there is a 1 second delay before playing
sound. If I wait 5 minutes and then run it - it works fine no latency.
Is there some kind of clean up I ned to do other than
Mix_CloseAudio();?
Any ideas? I have tried lowering and increasing the buffer size from
1024 all the way to 5120.
Thanks again for any help…
Here is a snippet of the init sound code:
int audio_rate = 22050;
Uint16 audio_format = AUDIO_S16;
int audio_channels = 2;
int audio_buffers = 4096;
if(Mix_OpenAudio(audio_rate, audio_format, audio_channels,
audio_buffers))
{
getlog()->log(“Unable to open audio!\n”);
}
/* Pre-load sound effects */
phaser = Mix_LoadWAV(“phaser.wav”);
explosion = Mix_LoadWAV(“explosion.wav”);
And here is the playing code:
Mix_PlayChannel(-1, explosion, 0);
And the clean up:
Mix_CloseAudio();