Redefine PLUG_CHANNEL_IO

// For Logic, Cubase and etc.
#define PLUG_CHANNEL_IO "1-1 1.1-1 1.2-1 1.2-2 2.1-1 2.1-2 2-2 2.2-2"

// For Reaper only
// #define PLUG_CHANNEL_IO "1-1 2-2 4-4 6-6 8-8"

How can I redefine PLUG_CHANNEL_IO for Reaper fix because Reaper failed up to 4 channels?

Not sure how to do DAW-specific IO, but I use ā€œ2-2 2.2-2ā€ and it works fine in Reaper for me. Works well for sidechain plugins in most DAWs.

The PLUG_CHANNEL_IO string in config.h should include all the possible variations of channel I/O. Hosts are rarely consistent about how they handle sidechain connections, so donā€™t be surprised if itā€™s not allways entirely predictable which I/O config you get.

// All daws
1-1 - mono input / mono output (no sidechain)
1.1-1 - mono input - mono sc input / mono output
1.2-1 - mono input - stereo sc input / mono output
1.2-2 - mono input - stereo sc input / stereo output
2.1-1 - stereo input - mono sc input / mono output
2.1-2 - stereo input - mono sc input / stereo output
2-2 - stereo input / stereo output
2.2-2 - stereo input - stereo sc input / stereo output

// Reaper only
1-1
2-2
4-4
6-6
8-8

How to combine them correctly is not saidā€¦ I mean 4-4 4.4-2 4.4-4

#define PLUG_CHANNEL_IO ā€œ1-1 1.1-1 1.2-1 1.2-2 2.1-1 2.1-2 2-2 2.2-2 4-4 4.1-2 4.2-2ā€

This setting works well in the Reaper but does not work in Logic Pro X sidechain

This sidechain issue is a long story and i guess the most important phrase in the provided example is ā€œHosts are rarely consistent about how they handle sidechain connections, so donā€™t be surprised if itā€™s not allways entirely predictable which I/O config you get.ā€ :slight_smile:
But it definitely seems to need some revision because the example dosnā€™t work in Reaper and Logic as it is .
I fiddled a bit with the IPlugSideChain example and at least came up with a quick hack which works for Reaper, Logic and Ableton in the meaning of getting the same functionality and proper routing for all three hosts.
The main idea is that Reaper seems to handle additional (sidechain) input buses in its own way and only works if the main bus includes the additional channels instead. An IO routing of 4.2-2 added to the IPlugSideChain example did the trick. To get it work i had to change some lines in the code. I just upped a gist which demonstrates the changes.

Even if this seems to work donā€™t consider it as a reasonable solution because itā€™s neither fully tested for unwanted side effects (e.g. what happens to the additional main bus channels in Logic) nor tested in other hosts but the three mentioned. Itā€™s just a starting point for further investigations or maybe includes ideas for future updates.

EDIT: Forgot to mentionā€¦ This hack was only meant for AU plugs (I didnā€™t even test other formatsā€¦ :roll_eyes:)

1 Like

The first thing I want to do is express my gratitude for your work. The second one we also messed around and made is also not so elegant, but also a solution how it could work.

#define PLUG_CHANNEL_IO "1-1 1.1-1 1.2-1 1.2-2 2.1-1 2.1-2 2-2 2.2-2 4-4 4.1-2 4.2-2"
 
#ifdef AU_API
    #define PLUG_CHANNEL_IO "1-1 1.1-1 1.2-1 1.2-2 2.1-1 2.1-2 2-2 2.2-2"
#endif

But in this case AudioUnit will not work in the Reper on Mac.

Itā€™s just that reaper works in a different way, forcing us to follow a different scenario. I will definitely investigate this code and conduct tests. But it looks like this is a normal solution that should be updated (in github).

Also, I will then conduct testing and notify how everything went.

IPlugSidechain example (AU) does work in Logic/Live as far as I can tell. It doesnā€™t work in Reaper. Do you disagree?

No i donā€™t disagree. My statement was a bid misleading, sorry.
I mean the same as you. With the current config it doesnā€™t work in Reaper.
If you change the config (so that it works in Reaper) it wonā€™t work with Logic.

1 Like

Is it possible to create a macros like GET_HOST ??

#define PLUG_CHANNEL_IO "1-1 1.1-1 1.2-1 1.2-2 2.1-1 2.1-2 2-2 2.2-2"
 
#if define (GET_HOST = "Reaper")
    #define PLUG_CHANNEL_IO "1-1 1.1-1 1.2-1 1.2-2 2.1-1 2.1-2 2-2 2.2-2 4-4 4.1-2 4.2-2 and etc..."
#endif

No. Macros are resolved at compile-time, but in order to know what host a plug-in is loaded in, you need to do that at runtime.

I think this is a Reaper bug to be honest. The AU has two input buses, but only one shows up in Reaper.

--------------------------------------------------
VERIFYING DEFAULT SCOPE FORMATS:
Input Scope Bus Configuration:
 Default Bus Count:2
    Bus Name: Main Input
    Format Bus 0: AudioStreamBasicDescription:  2 ch,  48000 Hz, Float32, deinterleaved
    Bus Name: SideChain
    Format Bus 1: AudioStreamBasicDescription:  2 ch,  48000 Hz, Float32, deinterleaved
    Bus 0, Has Channel Layouts: 0x640001 0x650002
    Bus 1, Has Channel Layouts: 0x640001 0x650002

Output Scope Bus Configuration:
 Default Bus Count:1
    Bus Name: Output
    Default Format: AudioStreamBasicDescription:  2 ch,  48000 Hz, Float32, deinterleaved
    Has Channel Layouts: 0x640001 0x650002
1 Like

I actually think the same, because everything points to it.

This PR seems to fix it: AUv2: Don't return zero channels when an invalid bus channel count isā€¦ by olilarkin Ā· Pull Request #848 Ā· iPlug2/iPlug2 Ā· GitHub, need to check some more

One other thing I noticed was that the order of the channel configs mattered sometimes. For example, if the two supported configs are 2-2 and 2.2-2, I define PLUG_CHANNEL_IO as ā€œ2.2-2 2-2ā€. That way if it is parsed, the sidechain config is always presented first. This works for my users, so I donā€™t really mess with it any more than I need to. I will test my Mac builds again soon and post an update should anything not work.

Logic pro for #define PLUG_CHANNEL_IO "1-1 1.1-1 1.2-1 1.2-2 2.1-1 2.1-2 2-2 2.2-2 4-4 4.1-2 4.2-2 - does not work, for reaper - ok. It seems that your fix does not solve the problem in any way.

pBus->mNHostChannels = pBus->mNPlugChannels; (tried without - else {})

The Reaper as a whole requires - 4 - 64 channels

It looks like Iā€™m going to have to give up the Reaperā€™s support. If I could see for myself in the code whatā€™s going on there, I would try to fix it. But what can we do, just come up with strange codes for IplugAU. And what if we are for the Reaper via GetHost () this? Is this even an idea possible?

if (GetHost() = "Reaper") { code for only Reaper channels size }

Š”ould you explain the code line where I can take a look at it, as there usually is please? As I understand it, this has been a problem for many years!

FWIW: I wouldnā€™t worry that much about perfect AU support in reaper, since users can also use VST2, VST3 there.

My PR fixes the issue with the iPlugSideChain example AUv2 not working in Reaper and I tried this based on discussing it with the Reaper Devs. I donā€™t know about your project or with these extra channel io options.

Itā€™s difficult to understand your posts to be honest, but if you can perhaps provide an example project or some very clear description of how to produce, and what ā€œnot workingā€ means

Great Oli, thanks! This really seems to fix it. Tested a little and couldnā€™t find any drawbacks so far.

1 Like

Now Iā€™m just going to try to describe what I mean.

When you specify 2 channels in the Reaper itself, everything is fine (2 X 2). But when you need to specify 4 channels, the sound disappears in my project. This means that my plugin needs support for 4 channels.

IPlugSideChain can 2 X 2 ā†’ up 4 ā†’ 2 X 4 (Logically, it should be X - X ā†’ 4 X 4)

Here is a video (gif) that demonstrates this problem. I specifically took a reference plugin that works perfectly.

RouteMapping

P.S. Iā€™m sorry I didnā€™t put it that way earlier

This looks as if Olis fix is not implementedā€¦
The original IPlugSideChain example (and my other creations) definitely work with the updated IPlugAU.cpp exactly like the Glue plug in your gif shows.

@ stw

IPlug/AUv2/IPlugAU.cpp

I did not find this fix in the merge, although there is a merge that has occurred

I understood everything, there are no changes in the master I added them manually and for sc example, everything worked. :}