Browse Source

Added missing call to JuceAU's base class' SetBusCount method

tags/2021-05-28
hogliux 8 years ago
parent
commit
dd2d64c363
1 changed files with 11 additions and 4 deletions
  1. +11
    -4
      modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm

+ 11
- 4
modules/juce_audio_plugin_client/AU/juce_AU_Wrapper.mm View File

@@ -304,9 +304,17 @@ public:
if ((! juceFilter->canAddBus (isInput)) && ((busCount == 0) || (! juceFilter->canRemoveBus (isInput)))) if ((! juceFilter->canAddBus (isInput)) && ((busCount == 0) || (! juceFilter->canRemoveBus (isInput))))
return kAudioUnitErr_PropertyNotWritable; return kAudioUnitErr_PropertyNotWritable;
// we need to already create the underlying elements so that we can change their formats
err = MusicDeviceBase::SetBusCount (scope, count);
if (err != noErr)
return err;
// however we do need to update the format tag: we need to do the same thing in SetFormat, for example // however we do need to update the format tag: we need to do the same thing in SetFormat, for example
const int requestedNumBus = static_cast<int> (count); const int requestedNumBus = static_cast<int> (count);
{ {
(isInput ? currentInputLayout : currentOutputLayout).resize (requestedNumBus);
int busNr; int busNr;
for (busNr = (busCount - 1); busNr != (requestedNumBus - 1); busNr += (requestedNumBus > busCount ? 1 : -1)) for (busNr = (busCount - 1); busNr != (requestedNumBus - 1); busNr += (requestedNumBus > busCount ? 1 : -1))
@@ -331,10 +339,6 @@ public:
err = (busNr == (requestedNumBus - 1) ? noErr : kAudioUnitErr_FormatNotSupported); err = (busNr == (requestedNumBus - 1) ? noErr : kAudioUnitErr_FormatNotSupported);
} }
// we need to already create the underlying elements so that we can change their formats
if (err == noErr)
err = MusicDeviceBase::SetBusCount (scope, count);
// was there an error? // was there an error?
if (err != noErr) if (err != noErr)
{ {
@@ -348,6 +352,9 @@ public:
juceFilter->removeBus (isInput); juceFilter->removeBus (isInput);
} }
(isInput ? currentInputLayout : currentOutputLayout).resize (busCount);
MusicDeviceBase::SetBusCount (scope, static_cast<UInt32> (busCount));
return kAudioUnitErr_FormatNotSupported; return kAudioUnitErr_FormatNotSupported;
} }


Loading…
Cancel
Save