From b33dde81347d200e4929a4f92bf3b0d8f13bab64 Mon Sep 17 00:00:00 2001 From: attila Date: Tue, 22 Nov 2022 15:39:11 +0100 Subject: [PATCH] CoreAudio: Report the number of active output channels in the device callback As opposed to the number of hardware output channels. --- modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp b/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp index ffdf9856b8..fafaacf422 100644 --- a/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp +++ b/modules/juce_audio_devices/native/juce_mac_CoreAudio.cpp @@ -1771,10 +1771,13 @@ private: if (callback != nullptr) { + const auto numActiveOutputChannels = outputWrapper.getActiveChannels().countNumberOfSetBits(); + jassert (numActiveOutputChannels <= scratchBuffer.getNumChannels()); + callback->audioDeviceIOCallbackWithContext (channels, numChannels, scratchBuffer.getArrayOfWritePointers(), - scratchBuffer.getNumChannels(), + numActiveOutputChannels, n, context); }