Using bus/channel layouts for CV


Im trying to update my plugins from JUCE 3.1.1 to Juce 6.01.
all was going well until I came across usage of AudioProcessor :

we were using the different channels for difference CV channels.
so each had a different name… nothing that looks like a speaker name :wink:

so Ive been banging my head against a wall a bit…
from my ‘research’, it appears in 6.0.1 channels are now on a Bus, which has a name - but the channels are always a kind of speaker name (AudioChannelSet) , which you appear not to be able to name.

it appears that then only way to have a name for other ‘audio channels’ would be to have them as separate buses - correct? (as a bus can have a name)

NOW, here is the problem…
the HOST is built with Juce 3.1.1 (and I cannot change), and is using the older ‘channel’ arrangement, it knows nothing of ‘buses’

is there a way I can make these things talk?

or am i stuck on 3.1.1
as I think is unlikely developer of the host is going to change… and I need these ‘channels’ to be named for the application to make any sense :frowning:

I guess another question here… is could the host be updated (using Juce 3.1.1) to support named buses?

how does this related to the VST api? (only interested in VST) … can i ‘kick’ down to the VST layer just for this?

ok, I think Ive a solution … yay!

in case anyone else comes across this (as I was searching quite a bit for a solution :slight_smile: )

what I did was:
a) create a setup of buses on a busproperties object

        BusesProperties props;
        for(auto i=0;i<I_MAX;i++) {
        for(auto i=0;i<O_MAX;i++) {
        return props;

where getInputBusName is basically what you had for getInputChannelName
(but its now a static method, since your going called this method in ctor)

b) pass this into the AudioProcessor constructor.

c) audio bool isBusesLayoutSupported return true

d) in ProJucer remove your channel properties

e) ensure you do a clean build!

as far as i can tell this works because:
(at least for VSTs , Im only interested in VST for this particular project)

it seems really buses are just another way of expressing channels (i guess for effGetInputProperties).
so when the 3.1.1 host sees the above… its still sees everything as ‘channels’, its not seeing the buses.
so it still gets the same number of channels, and their names.

even your old ‘processBlock’ code that uses getSample(channel number) will still work.

(I guess I should probably update this to getBusBuffer to be more in line with juce 6 api, but I assume this is just deferencing these ‘channels’ in the same way… which is why it works with the old code)

certainly on this means that my (first) plugin built with 6.01 seems to work fine in the 3.1.1 host, with correct channel names again…

Ive a bunch of other plugins to do now :slight_smile: