'How to implement Audio Unit that takes a sidechain bus?
I am trying to implement an Effect Audio Unit (V3) that allows the user to use sidechain (take another track as input to modulate the effect). This, as I understand, is acheived by having two input busses.
To keep it simple, I created a new Audio Unit Extension for Mac and I performed a minor modification to the boiler plate code that Xcode offered. That is, I added a second input bus called sideBus, following the same pattern as for inputBus:
@implementation exampleDSPKernelAdapter {
exampleDSPKernel _kernel;
BufferedInputBus _inputBus;
BufferedInputBus _sideBus; // <-- added this extra bus
}
I then allocate this new bus in the init() method following the same pattern used for inputBus
- (instancetype)init {
if (self = [super init]) {
AVAudioFormat *format = [[AVAudioFormat alloc] initStandardFormatWithSampleRate:44100 channels:2];
/.../
_inputBus.init(format, 8);
_sideBus.init(format, 8); // <-- added this initialization
/.../
}
return self;
}
Allocate and deallocate resources in respective methods:
- (void)allocateRenderResources {
_inputBus.allocateRenderResources(self.maximumFramesToRender);
_sideBus.allocateRenderResources(self.maximumFramesToRender);
/.../
}
- (void)deallocateRenderResources {
_inputBus.deallocateRenderResources();
_sideBus.deallocateRenderResources();
}
Implemented the getter:
- (AUAudioUnitBus *)sideBus { return _sideBus.bus; }
And finally add the side bus to the list of input busses
- (void)setupAudioBuses {
_inputBusArray = [[AUAudioUnitBusArray alloc] initWithAudioUnit:self
busType:AUAudioUnitBusTypeInput
busses: @[_kernelAdapter.inputBus, _kernelAdapter.sideBus]];
/.../
}
However, when I load the AU on a track in Logic, it does not show the sidechain menu (see images below).
I am developing on Xcode 13.1, macOS 12.0.1.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|


