From 550d61e487d9982c8ca6975a2b6f8e765a26c9e1 Mon Sep 17 00:00:00 2001 From: reuk Date: Wed, 12 Jan 2022 13:35:03 +0000 Subject: [PATCH] AudioIODevice: Ensure CoreAudio device can be restarted after stopping --- .../native/juce_mac_CoreAudio.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp b/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp index 205d61f65e..634ac6daf8 100644 --- a/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp +++ b/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp @@ -683,10 +683,14 @@ public: { const ScopedLock sl (callbackLock); + if (callback == nullptr && callbackToNotify != nullptr) + { + callback = callbackToNotify; + callback->audioDeviceAboutToStart (&owner); + } + if (! started) { - callback = nullptr; - if (deviceID != 0) { if (OK (AudioDeviceCreateIOProcID (deviceID, audioIOProc, this, &audioProcID))) @@ -702,14 +706,6 @@ public: } } } - - if (started) - { - callback = callbackToNotify; - - if (callback != nullptr) - callback->audioDeviceAboutToStart (&owner); - } } playing = started && callback != nullptr;