diff options
| author | Sonicadvance1 <sonicadvance1@gmail.com> | 2010-02-05 10:48:31 +0000 |
|---|---|---|
| committer | Sonicadvance1 <sonicadvance1@gmail.com> | 2010-02-05 10:48:31 +0000 |
| commit | 675e1f668e738617ab75445c3362f3582a05182c (patch) | |
| tree | 6123b166bb8fb5c2bc695ded5079a520c0e29689 /Source/Core/AudioCommon/Src/CoreAudioSoundStream.cpp | |
| parent | 548550629328c1bddd5774c1a64d97d840071ae5 (diff) | |
Correct stopping of Core in OSX via Command+Q, and fix a thread from not dying when stopping with CoreAudio
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5013 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/AudioCommon/Src/CoreAudioSoundStream.cpp')
| -rw-r--r-- | Source/Core/AudioCommon/Src/CoreAudioSoundStream.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/Source/Core/AudioCommon/Src/CoreAudioSoundStream.cpp b/Source/Core/AudioCommon/Src/CoreAudioSoundStream.cpp index 940fd64c90..d336c833d3 100644 --- a/Source/Core/AudioCommon/Src/CoreAudioSoundStream.cpp +++ b/Source/Core/AudioCommon/Src/CoreAudioSoundStream.cpp @@ -116,15 +116,28 @@ bool CoreAudioSound::CoreAudioInit() err = AudioOutputUnitStart(soundStruct->audioUnit); if (err) - printf("error when stating audiounit\n"); + printf("error when starting audiounit\n"); - while(!threadData) + do { soundCriticalSection.Enter(); m_mixer->Mix(soundStruct->realtimeBuffer, numBytesToRender); soundCriticalSection.Leave(); soundSyncEvent.Wait(); - } + }while(!threadData); + + err = AudioOutputUnitStop(soundStruct->audioUnit); + if(err) + printf("error when sopping audiounit\n"); + + err = AudioUnitUninitialize(soundStruct->audioUnit); + if(err) + printf("Error uninitializing audiounit\n"); + + err = CloseComponent(soundStruct->audioUnit); + if(err) + printf("Error while closing component\n"); + return true; } @@ -148,6 +161,8 @@ bool CoreAudioSound::Start() void CoreAudioSound::Stop() { + threadData = 1; + soundSyncEvent.Set(); delete thread; thread = NULL; |
