Waiting for audio

I’m writing a WAV player class that loads a WAV file and play it. Playback is
triggered by SDL_PauseAudio( 0 ), after which one has to make a loop similar

while( SDL_GetAudioStatus() == SDL_AUDIO_PLAYING )
SDL_Delay( XXXX )

This works fine for me, but I don’t want to add that loop whenever I’m
playing a file. I want the player object to start playing the file, return
immediately & keep playing it till it’s finished and in the same time allow
me to do other things. So I made the playback function of the class spawn a
seperate thread in which I call SDL_PauseAudio(0) and run the same loop,
which resulted in no audio output at all…any explanation?

Please note that this is the first time for me to deal with audio in SDL, so
I might be missing a LOT of things :slight_smile:

Mahmoud Al Gammal