From 992904560ce0b0b1a9210287970c88ff9d99d3c2 Mon Sep 17 00:00:00 2001 From: Mike Dickey Date: Sun, 11 Feb 2024 15:08:57 -0800 Subject: [PATCH] Use correct number of channels for the selected CoreAudio stream The kAudioStreamPropertyPhysicalFormat query returns the number of channels for the device's first audio stream. If any single, subsequent stream is selected to fulfill the user request, it may use a different number of channels. This mismatch can cause a lot of problems. --- RtAudio.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RtAudio.cpp b/RtAudio.cpp index bbe25399..bc61c545 100644 --- a/RtAudio.cpp +++ b/RtAudio.cpp @@ -1782,7 +1782,7 @@ bool RtApiCore :: probeDeviceOpen( unsigned int deviceId, StreamMode mode, unsig stream_.deviceFormat[mode] = RTAUDIO_FLOAT32; if ( streamCount == 1 ) - stream_.nDeviceChannels[mode] = description.mChannelsPerFrame; + stream_.nDeviceChannels[mode] = streamChannels; else // multiple streams stream_.nDeviceChannels[mode] = channels; stream_.nUserChannels[mode] = channels;