diff options
Diffstat (limited to 'audio/coreaudio.c')
-rw-r--r-- | audio/coreaudio.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/audio/coreaudio.c b/audio/coreaudio.c index c75142084..d4ad22459 100644 --- a/audio/coreaudio.c +++ b/audio/coreaudio.c @@ -36,6 +36,8 @@ #define MAC_OS_X_VERSION_10_6 1060 #endif +static int isAtexit; + typedef struct { int buffer_frames; int nbuffers; @@ -376,6 +378,11 @@ static inline UInt32 isPlaying (AudioDeviceID outputDeviceID) return result; } +static void coreaudio_atexit (void) +{ + isAtexit = 1; +} + static int coreaudio_lock (coreaudioVoiceOut *core, const char *fn_name) { int err; @@ -623,7 +630,7 @@ static void coreaudio_fini_out (HWVoiceOut *hw) int err; coreaudioVoiceOut *core = (coreaudioVoiceOut *) hw; - if (!audio_is_cleaning_up()) { + if (!isAtexit) { /* stop playback */ if (isPlaying(core->outputDeviceID)) { status = AudioDeviceStop(core->outputDeviceID, core->ioprocid); @@ -666,7 +673,7 @@ static int coreaudio_ctl_out (HWVoiceOut *hw, int cmd, ...) case VOICE_DISABLE: /* stop playback */ - if (!audio_is_cleaning_up()) { + if (!isAtexit) { if (isPlaying(core->outputDeviceID)) { status = AudioDeviceStop(core->outputDeviceID, core->ioprocid); @@ -690,6 +697,7 @@ static void *coreaudio_audio_init (void) CoreaudioConf *conf = g_malloc(sizeof(CoreaudioConf)); *conf = glob_conf; + atexit(coreaudio_atexit); return conf; } |