aboutsummaryrefslogtreecommitdiffstats
path: root/src/audioOutputs/audioOutput_osx.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/audioOutputs/audioOutput_osx.c')
-rw-r--r--src/audioOutputs/audioOutput_osx.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/audioOutputs/audioOutput_osx.c b/src/audioOutputs/audioOutput_osx.c
index c14bdc17d..47f3621dc 100644
--- a/src/audioOutputs/audioOutput_osx.c
+++ b/src/audioOutputs/audioOutput_osx.c
@@ -102,7 +102,19 @@ static void osx_dropBufferedAudio(AudioOutput * audioOutput) {
}
static void osx_closeDevice(AudioOutput * audioOutput) {
- //OsxData * od = (OsxData *) audioOutput->data;
+ OsxData * od = (OsxData *) audioOutput->data;
+
+ pthread_mutex_lock(&od->mutex);
+ while(od->len) {
+ pthread_cond_wait(&od->condition, &od->mutex);
+ }
+ od->go = 0;
+ pthread_mutex_unlock(&od->mutex);
+
+ AudioOutputUnitStop(od->au);
+
+ CloseComponent(od->au);
+ AudioUnitUninitialize(od->au);
audioOutput->open = 0;
}