| Summary: | Mix_CloseAudio() takes 2 seconds to run | ||
|---|---|---|---|
| Product: | SDL_mixer | Reporter: | Jacques Le Normand <rathereasy> |
| Component: | misc | Assignee: | Ryan C. Gordon <icculus> |
| Status: | RESOLVED INVALID | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | ||
| Version: | 1.2.8 | ||
| Hardware: | x86 | ||
| OS: | Linux | ||
I assume this is on Linux, right? This isn't SDL_Mixer, it's SDL's pulseaudio (and maybe ALSA) target. We wait for all audio we wanted to play to finish (so it doesn't cut off the end), but the Pulse API is blocking too long in its drain operation. --ryan. Having looked into this a bit more, it's actually not our bug, it's PulseAudio's: http://pulseaudio.org/ticket/866 (Using "ALSA" on modern versions of Ubuntu just reroutes your audio through PulseAudio, so you can't even get below the PulseAudio layer by default anymore...) --ryan. |
// This code takes 2 seconds to run; it will output "2 seconds to close" // g++ -Wall -I/usr/include/SDL test.cpp -o test.o -lSDL_mixer #include <iostream> #include <ctime> #include <SDL/SDL_mixer.h> int main(){ int audio_rate = 44100; int audio_buffers = 1024; Uint16 audio_format = AUDIO_S16SYS; int audio_channels = 1; Mix_OpenAudio(audio_rate, audio_format, audio_channels, audio_buffers); time_t a = time(NULL); Mix_CloseAudio(); time_t b = time(NULL); std::cout << difftime(b,a) << " seconds to close" << std::endl; return 0; }