diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/coreaudio/audio_driver_coreaudio.cpp | 13 | ||||
-rw-r--r-- | drivers/coreaudio/audio_driver_coreaudio.h | 1 |
2 files changed, 13 insertions, 1 deletions
diff --git a/drivers/coreaudio/audio_driver_coreaudio.cpp b/drivers/coreaudio/audio_driver_coreaudio.cpp index c84469f26f..6e451eabcd 100644 --- a/drivers/coreaudio/audio_driver_coreaudio.cpp +++ b/drivers/coreaudio/audio_driver_coreaudio.cpp @@ -217,13 +217,24 @@ void AudioDriverCoreAudio::start() { if (!active) { OSStatus result = AudioOutputUnitStart(audio_unit); if (result != noErr) { - ERR_PRINT("AudioOutputUnitStart failed"); + ERR_PRINT(("AudioOutputUnitStart failed, code: " + itos(result)).utf8().get_data()); } else { active = true; } } }; +void AudioDriverCoreAudio::stop() { + if (active) { + OSStatus result = AudioOutputUnitStop(audio_unit); + if (result != noErr) { + ERR_PRINT(("AudioOutputUnitStop failed, code: " + itos(result)).utf8().get_data()); + } else { + active = false; + } + } +} + int AudioDriverCoreAudio::get_mix_rate() const { return mix_rate; }; diff --git a/drivers/coreaudio/audio_driver_coreaudio.h b/drivers/coreaudio/audio_driver_coreaudio.h index 9891920263..c44e225521 100644 --- a/drivers/coreaudio/audio_driver_coreaudio.h +++ b/drivers/coreaudio/audio_driver_coreaudio.h @@ -90,6 +90,7 @@ public: virtual void finish(); bool try_lock(); + void stop(); AudioDriverCoreAudio(); ~AudioDriverCoreAudio(); |