Starting with the simple TremoloUnit I am trying to modify the plug-in to support the exact channel count requirements for our DSP algorithms. It is entirely unclear how to do this.
I have taken the following steps:
1. From the TremoloUnit class, I removed the virtual NewKernel() method 2. I added the ProcessBufferLists override 3. In TremoloUnit::GetPropertyInfo I added the following code
ComponentResult TremoloUnit::GetPropertyInfo ( AudioUnitPropertyID inID, AudioUnitScope inScope, AudioUnitElement inElement, UInt32 &outDataSize, Boolean &outWritable)
if (inScope == kAudioUnitScope_Global) { switch (inID) { case kAudioUnitProperty_SupportedNumChannels: printf("TremoloUnit::GetPropertyInfo kAudioUnitProperty_SupportedNumChannels"); outWritable = false; outDataSize = sizeof (AUChannelInfo); return noErr; } } return AUEffectBase::GetPropertyInfo (inID, inScope, inElement, outDataSize, outWritable); }
4. In TremoloUnit::GetProperty I added the following code:
ComponentResult TremoloUnit::GetProperty(AudioUnitPropertyID inID, AudioUnitScope inScope, AudioUnitElement inElement, void *outData) { if (inScope == kAudioUnitScope_Global) { switch (inID) { case kAudioUnitProperty_SupportedNumChannels: { AUChannelInfo channelInfo = {1, 2}; // mono in, stereo out *((AUChannelInfo *)outData) = channelInfo; printf("TremoloUnit::GetProperty kAudioUnitProperty_SupportedNumChannels returned {1,2}"); break; } } } return AUEffectBase::GetProperty (inID, inScope, inElement, outData); }
5. I also added the SupportedNumChannels override, as follows:
UInt32 TremoloUnit::SupportedNumChannels(const AUChannelInfo** outInfo) { printf("TremoloUnit::SupportedNumChannels returned {1,2}"); static const AUChannelInfo sChannels[1] = { {1, 2} }; if (outInfo) *outInfo = sChannels; return sizeof (sChannels) / sizeof (AUChannelInfo); }
When I run AULab, the plug-in appears as a mono plug-in and as a stereo plug-in. It does not appear in the mono->stereo plugin popups.
If I instantiate the plugin as mono I get the following error
4/15/14 1:59:02.321 PM AU Lab[1539]: Error adding insert effect 1->1 to track: -10868
The same goes if I instantiate the plug-in as stereo
4/15/14 1:59:30.601 PM AU Lab[1539]: Error adding insert effect 2->2 to track: -10868
Looking in the console, none of my printf have been hit, leading me to believe there is something I am fundamentally missing about how a plug-in should report its channel count.
Ideas?
|