Fix slow (90-100ms) sound shutdown.
This commit is contained in:
@@ -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)
|
void RageSound_DSound::Update(float delta)
|
||||||
|
|||||||
@@ -51,6 +51,10 @@ void RageSound_DSound_Software::MixerThread()
|
|||||||
while(GetData())
|
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()
|
bool RageSound_DSound_Software::GetData()
|
||||||
|
|||||||
@@ -56,6 +56,8 @@ void RageSound_WaveOut::MixerThread()
|
|||||||
|
|
||||||
WaitForSingleObject(sound_event, 10);
|
WaitForSingleObject(sound_event, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
waveOutReset(wo);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RageSound_WaveOut::GetData()
|
bool RageSound_WaveOut::GetData()
|
||||||
@@ -209,6 +211,7 @@ RageSound_WaveOut::~RageSound_WaveOut()
|
|||||||
{
|
{
|
||||||
/* Signal the mixing thread to quit. */
|
/* Signal the mixing thread to quit. */
|
||||||
shutdown = true;
|
shutdown = true;
|
||||||
|
SetEvent( sound_event );
|
||||||
LOG->Trace("Shutting down mixer thread ...");
|
LOG->Trace("Shutting down mixer thread ...");
|
||||||
MixingThread.Wait();
|
MixingThread.Wait();
|
||||||
LOG->Trace("Mixer thread shut down.");
|
LOG->Trace("Mixer thread shut down.");
|
||||||
|
|||||||
Reference in New Issue
Block a user