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