fix 4231: do not set stream format for the global scope as it is not required and not supported by all effects

(cherry picked from commit 3cc0977d3646478dc15951523eb6fc16cceb1c7e)
Signed-off-by: Avery King <gperson@disroot.org>
This commit is contained in:
Dmitry Makarenko
2025-01-27 13:14:46 +03:00
committed by Avery King
parent 4cf3820f51
commit db821dbb46

View File

@@ -453,13 +453,11 @@ bool AudioUnitWrapper::SetRateAndChannels(
sizeof(float) * 8, sizeof(float) * 8,
}; };
unsigned one = 1u;
const struct Info{ const struct Info{
unsigned &nChannels; unsigned &nChannels;
AudioUnitScope scope; AudioUnitScope scope;
const char *const msg; // used only in log messages const char *const msg; // used only in log messages
} infos[]{ } infos[]{
{ one, kAudioUnitScope_Global, "global" },
{ mAudioIns, kAudioUnitScope_Input, "input" }, { mAudioIns, kAudioUnitScope_Input, "input" },
{ mAudioOuts, kAudioUnitScope_Output, "output" }, { mAudioOuts, kAudioUnitScope_Output, "output" },
}; };
@@ -471,21 +469,20 @@ bool AudioUnitWrapper::SetRateAndChannels(
identifier.wx_str(), msg); identifier.wx_str(), msg);
return false; return false;
} }
if (scope != kAudioUnitScope_Global) {
bool failed = true; bool failed = true;
++nChannels; ++nChannels;
do { do {
--nChannels; --nChannels;
streamFormat.mChannelsPerFrame = nChannels; streamFormat.mChannelsPerFrame = nChannels;
failed = SetProperty(kAudioUnitProperty_StreamFormat, failed = SetProperty(kAudioUnitProperty_StreamFormat,
streamFormat, scope); streamFormat, scope);
} while(failed && nChannels > 0); } while(failed && nChannels > 0);
if (failed) { if (failed) {
wxLogError("%ls didn't accept stream format on %s\n", wxLogError("%ls didn't accept stream format on %s\n",
// Exposing internal name only in logging // Exposing internal name only in logging
identifier.wx_str(), msg); identifier.wx_str(), msg);
return false; return false;
}
} }
} }
} }