Skip to content

Commit

Permalink
AudioIODevice: Ensure CoreAudio device can be restarted after stopping
Browse files Browse the repository at this point in the history
  • Loading branch information
reuk committed Jan 17, 2022
1 parent 61eafdb commit 550d61e
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -683,10 +683,14 @@ class CoreAudioInternal : private Timer,
{
const ScopedLock sl (callbackLock);

if (! started)
if (callback == nullptr && callbackToNotify != nullptr)
{
callback = nullptr;
callback = callbackToNotify;
callback->audioDeviceAboutToStart (&owner);
}

if (! started)
{
if (deviceID != 0)
{
if (OK (AudioDeviceCreateIOProcID (deviceID, audioIOProc, this, &audioProcID)))
Expand All @@ -702,14 +706,6 @@ class CoreAudioInternal : private Timer,
}
}
}

if (started)
{
callback = callbackToNotify;

if (callback != nullptr)
callback->audioDeviceAboutToStart (&owner);
}
}

playing = started && callback != nullptr;
Expand Down

0 comments on commit 550d61e

Please sign in to comment.