diff options
| author | ayuanx <ayuanx@gmail.com> | 2009-12-18 19:52:04 +0000 |
|---|---|---|
| committer | ayuanx <ayuanx@gmail.com> | 2009-12-18 19:52:04 +0000 |
| commit | 7b6a0f9b72950ef6752c8477e973666d476b5e51 (patch) | |
| tree | 97e0e90b02279e7f6dcfc34b60d70c7c6ff11822 /Source/Core/AudioCommon/Src/AOSoundStream.cpp | |
| parent | 97090337e338fc82670fd2456f9d9dbaeae6dc38 (diff) | |
Thread safe.
PS: The OpenAL is a mess.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4710 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/AudioCommon/Src/AOSoundStream.cpp')
| -rw-r--r-- | Source/Core/AudioCommon/Src/AOSoundStream.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/Source/Core/AudioCommon/Src/AOSoundStream.cpp b/Source/Core/AudioCommon/Src/AOSoundStream.cpp index 632bc450c8..d26bdd9755 100644 --- a/Source/Core/AudioCommon/Src/AOSoundStream.cpp +++ b/Source/Core/AudioCommon/Src/AOSoundStream.cpp @@ -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 |
