mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 13:49:53 -06:00
Thread safe.
PS: The OpenAL is a mess. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4710 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -49,16 +49,13 @@ void AOSound::SoundLoop()
|
||||
|
||||
while (!threadData)
|
||||
{
|
||||
soundCriticalSection.Enter();
|
||||
m_mixer->Mix(realtimeBuffer, numBytesToRender >> 2);
|
||||
soundCriticalSection.Enter();
|
||||
ao_play(device, (char*)realtimeBuffer, numBytesToRender);
|
||||
soundCriticalSection.Leave();
|
||||
|
||||
if (! threadData)
|
||||
soundSyncEvent.Wait();
|
||||
soundSyncEvent.Wait();
|
||||
}
|
||||
ao_close(device);
|
||||
device = NULL;
|
||||
}
|
||||
|
||||
void *soundThread(void *args)
|
||||
@ -84,19 +81,23 @@ void AOSound::Update()
|
||||
|
||||
void AOSound::Stop()
|
||||
{
|
||||
soundCriticalSection.Enter();
|
||||
threadData = 1;
|
||||
soundSyncEvent.Set();
|
||||
soundCriticalSection.Leave();
|
||||
|
||||
delete thread;
|
||||
soundCriticalSection.Enter();
|
||||
delete thread;
|
||||
thread = NULL;
|
||||
|
||||
ao_shutdown();
|
||||
ao_close(device);
|
||||
device = NULL;
|
||||
soundCriticalSection.Leave();
|
||||
|
||||
soundSyncEvent.Shutdown();
|
||||
}
|
||||
|
||||
AOSound::~AOSound() {
|
||||
// FIXME: crashes dolphin
|
||||
// ao_shutdown();
|
||||
AOSound::~AOSound()
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user