diff --git a/stepmania/src/arch/Sound/RageSoundDriver_DSound.cpp b/stepmania/src/arch/Sound/RageSoundDriver_DSound.cpp index 3ced13582e..ca804cbe0b 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_DSound.cpp +++ b/stepmania/src/arch/Sound/RageSoundDriver_DSound.cpp @@ -62,6 +62,12 @@ void RageSound_DSound::MixerThread() ; } } + + /* I'm not sure why, but if we don't stop the stream now, then the thread will take + * 90ms (our buffer size) longer to close. */ + for(unsigned i = 0; i < stream_pool.size(); ++i) + if(stream_pool[i]->state != stream_pool[i]->INACTIVE) + stream_pool[i]->str_ds->Stop(); } void RageSound_DSound::Update(float delta) diff --git a/stepmania/src/arch/Sound/RageSoundDriver_DSound_Software.cpp b/stepmania/src/arch/Sound/RageSoundDriver_DSound_Software.cpp index 2e63b3f425..429199a705 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_DSound_Software.cpp +++ b/stepmania/src/arch/Sound/RageSoundDriver_DSound_Software.cpp @@ -51,6 +51,10 @@ void RageSound_DSound_Software::MixerThread() while(GetData()) ; } + + /* I'm not sure why, but if we don't stop the stream now, then the thread will take + * 90ms (our buffer size) longer to close. */ + str_ds->Stop(); } bool RageSound_DSound_Software::GetData() diff --git a/stepmania/src/arch/Sound/RageSoundDriver_WaveOut.cpp b/stepmania/src/arch/Sound/RageSoundDriver_WaveOut.cpp index d1225e23a7..2096583c5f 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_WaveOut.cpp +++ b/stepmania/src/arch/Sound/RageSoundDriver_WaveOut.cpp @@ -56,6 +56,8 @@ void RageSound_WaveOut::MixerThread() WaitForSingleObject(sound_event, 10); } + + waveOutReset(wo); } bool RageSound_WaveOut::GetData() @@ -209,6 +211,7 @@ RageSound_WaveOut::~RageSound_WaveOut() { /* Signal the mixing thread to quit. */ shutdown = true; + SetEvent( sound_event ); LOG->Trace("Shutting down mixer thread ..."); MixingThread.Wait(); LOG->Trace("Mixer thread shut down.");