VST3 Reaper 20+ channel ordering problems

I am working on a plugin that works with 24 channels. We are using REAPER as we are working on a custom layout.

However we noticed that the channels from REAPER do not reach the plugin in the expected order, and there is a swap after channel 20. I traced the problem to this switch case:

I am guessing REAPER just uses the formats from VST3 in order missing multichannel with ambisonics channels.

This breaks the channel mapping applying by JUCE.

Or am I missing something here?

A similar issue was discussed recently on github:

In short, I believe the current behaviour is working as intended.

I partially agree with you. Because I believe REAPER could do it in a way that would not lead to this conflit.

However these cases are a bit gray in term of VST3, because I do not think it would have been a multichannel format that would make sense here, maybe that why REAPER is ignoring the channels that it is passing to VST3 plugin.

Isn’t there a way to add a workaround here? What I did is replace the discrete0 with something that is between LFE2 (it is the one before that mono channel) and ambisonicACN0 so it is not put at the end.

My logic is that i first check if there is a mix of ambisonics and multichannels channel types. When there is I apply the workaround.

But I am not sure what I might be breaking.