Waiting for audio to finish

hi, i am using sdl_sound to play some mp3 files, however, once and a while i
need to wait for the audio to finish before i continue… how can i go
about waiting??

i have tried

while (SDL_GetAudioStatus() == SDL_AUDIO_PLAYING){ }

but this just leads to my program crashing after the audio id finished
playing…

–Keith

hi, i am using sdl_sound to play some mp3 files, however, once and a while i
need to wait for the audio to finish before i continue… how can i go
about waiting??

You can wait until the audio callback runs for a time or two without MP3
data left to play (and feed it silence those times or two), and then set a
flag that audio playback is done, so the program knows to continue.

–ryan.

hi, i am using sdl_sound to play some mp3 files, however, once and a while i
need to wait for the audio to finish before i continue… how can i go
about waiting??

i have tried

while (SDL_GetAudioStatus() == SDL_AUDIO_PLAYING){ }

but this just leads to my program crashing after the audio id finished
playing…

Can you post a minimal example with a link to data that shows the problem?

Thanks!
-Sam Lantinga, Software Engineer, Blizzard Entertainment