AU only loads as mono


Something must have gotten messed up in the Audio Unit code, but at first glance I don’t see anything suspicious. The Juce Demo Plugin (and my own plugins) is only loaded as a mono effect, although two channels should be available. If you insert it into a stereo track only the left channel is sent through the plugin. Latest tip, OSX 10.7. VST works fine.


I’ve found that on 15th of June this year you added the following to the AU wrapper:


  •    CreateElements();\r


  •    CAStreamBasicDescription streamDescription;\r
  •    streamDescription.mSampleRate = GetSampleRate();\r
  •    streamDescription.SetCanonical (channelConfigs[0][1], false);\r
  •    Outputs().GetIOElement(0)->SetStreamFormat (streamDescription);\r


  •   #if ! JucePlugin_IsSynth\r
  •    streamDescription.SetCanonical (channelConfigs[0][0], false);\r
  •    Inputs().GetIOElement(0)->SetStreamFormat (streamDescription);\r
  •   #endif\r[/code]

The effect is that if the preferred channel configuration is written as {1,1},{2,2} then {1,1} is the canonical stream description, which seems to lead to the above mentioned behaviour. The plugin behaves as a proper stereo plugin when I write the configuration as {2,2},{1,1} instead. But I don’t think this is what you intended?


That change comes from a request I made back in June in this thread If it was bum steer then I apologise. However, I did qualify it with the suggestion [quote]maybe default to {2,2} if it’s available instead of the first one on the list[/quote] for this very reason. If I remember rightly this is only necessary because some hosts have a bug that ignores the streamformats advertised via SupportedNumChannels() and defaults to (or even insists on) the initial one. In any case, some initialisation of this nature is essential for any plugins that don’t support {2,2} as a channel config.


Agh… I’m a bit rusty on the subtleties of AUs… is there a consensus on what exactly the correct behaviour should be for this?


Well, we could check for {2,2} and only execute the cited piece of code if that configuration is not present. However, at least in Reaper, it seems that the canonical configuration is taken as the only available configuration, so if we’d hypothetically have a plugin that would support {1,1} and {3,3} then loading it into a track with 3 channels would still use the mono version…


That’s because Reaper’s a crock. It still does this even without the above code, except it forces the plugin to {2,2} instead (which are the defaults in AUBase), whether or not it’s supported. This would cause your hypothetical plugin to produce no output at all in Reaper (but you can still see the UI). Logic has no such problems - it won’t let you insert the plugin on a channel strip with the wrong amount of I/O.

I agree that we should default to {2,2} if it’s supported, but it would be more transparent if this were achieved by explicitly setting it to that in place of channelConfigs[0][1] and channelConfigs[0][0] rather than conditionally executing the init code.