iPlug2 Forum

Implementing 1 input, 2 outputs (i.e. mono -> stereo)

Yes its correct.

#define PLUG_CHANNEL_IO “1-1”

mono only is not working in the latest logic either.

hmm…

I see… it seems a lot of things changed with the 10.5 version but I don’t suppose they would’ve messed this up…

Anyway, I used to work in Juce beore, and setting up the channels’ IO configuration wasn’t straightforward either. You had to set it up when creating the project and you couldn’t change it after that.

totally possible. Multibus was messed up in the initial 10.5 release and me and others had to report it

now that l remember it was reported some sample libraries lost their mono option in 10.5

MonoTo Stereo:
#define PLUG_CHANNEL_IO “1-1 1-2 2-2”
works perfect (Logic10.5.1 OSX10.14.6)
but if only MonoToMono is defined:
#define PLUG_CHANNEL_IO “1-1”
crashes AU validator:

RENDER TESTS:

Input Format: AudioStreamBasicDescription: 1 ch, 44100 Hz, ‘lpcm’ (0x00000029) 32-bit little-endian float, deinterleaved
Output Format: AudioStreamBasicDescription: 1 ch, 44100 Hz, ‘lpcm’ (0x00000029) 32-bit little-endian float, deinterleaved
Render Test at 512 frames

validation result: crashed validation

and also crashes Reaper 6.15.0

I checked MonoToStereo only:
#define PLUG_CHANNEL_IO “1-2”
crashes AU validator and Reaper.

The reason that crashes is unrelated. If you don’t have 2-2 as an option, there will not be a scratch buffer for input channel 2, and this code will try to access invalid channel data.

void IPlugEffect::ProcessBlock(sample** inputs, sample** outputs, int nFrames)
{
  const double gain = GetParam(kGain)->Value() / 100.;
  const int nChans = NOutChansConnected();
  
  for (int s = 0; s < nFrames; s++) {
    for (int c = 0; c < nChans; c++) {
      outputs[c][s] = inputs[c][s] * gain; // inputs[1][s] is invalid with PLUG_CHANNEL_IO “1-2”
    }
  }
}
1 Like

MonoTo Stereo:
#define PLUG_CHANNEL_IO “1-1 1-2 2-2”
works perfect (Logic10.5.1 OSX10.14.6)

when you say this works perfectly in Logic, does it mean it lets you insert the plugin as “mono->stereo” or simply that it doesn’t crash the validation?

Yes, Logic lets me insert the plugin as Mono->Stereo, but of course, only on Mono Channels and only if there is no Stereo plugin already on the channel.
Screenshot 2020-11-03 at 06.13.04

in my code I use:

if (NInChansConnected() > 1) { // Stereo In

and not:

NOutChansConnected();

1 Like

What version of Logic do you have @JohnCrosby ?

Ok thanks… that approach with NInChansConnected actually worked! I still used NOutChansConnected further down in order to differentiate the setups during processing.

I must say though that I have since upgraded to Catalina (against all advices) and I’ve found that Logic’s auval is way more thorough than before in terms of channel IO… so that might have made some difference as well. (so my setup is Logic 10.5.1 on Catalina 10.15.7)

Below is a Minimal plugin I made just for testing and all defined configurations work as intended:

void Minimal2::ProcessBlock(sample** inputs, sample** outputs, int nFrames)
{
double gain = GetParam(kGain)->Value() / 100.;

// Stereo (swap L and R)
if (NInChansConnected() > 1)
{
    for (int s=0 ; s<nFrames ; ++s)
    {
        outputs[0][s] = inputs[1][s];
        outputs[1][s] = inputs[0][s];
    }
}

else
{   // Mono -> Stereo (apply gain)
    if (NOutChansConnected() > 1)
    {
        for (int s=0 ; s<nFrames ; ++s)
        {
            outputs[0][s] = inputs[0][s] * gain;
            outputs[1][s] = inputs[0][s] * gain;
        }
    }
    
    else
    {
        // Mono (apply inverse gain)
        for (int s=0 ; s<nFrames ; ++s)
        {
            outputs[0][s] = inputs[0][s] * (1.0 - gain);
        }
    }
}

}

Thank you both for all the help.

1 Like

So @Ric Mono busses are working for you now in Logic X? ! I am confused

Yes they are. In fact I have never had problems with either “mono” or “stereo” configurations, only with “mono to stereo” which is why I asked around if anyone had the same problem.

I have now created another test example with only the “mono” option, just to see if it was fine:

#define PLUG_CHANNEL_IO “1-1”

and yes it works normally.

#define PLUG_CHANNEL_IO “1-1”
works normally for me too, but only after I removed:

mMeterSender.ProcessBlock(inputs, nFrames, kCtrlTagMeter);

changing only:

IPeakSender<2> mMeterSender;

to:

IPeakSender<1> mMeterSender;

in the header file was not enough. Maybe I am doing something wrong because I can not use meters in Mono only (#define PLUG_CHANNEL_IO “1-1”) version. No big deal as I use the multi (#define PLUG_CHANNEL_IO “1-1 1-2 2-2”) version where everything works :slight_smile:

Exactly. I always define my variables assuming stereo even if then I end up using it in mono.

Often times you would just iterate over the available channels and process independently. :raised_hands:

weird #define PLUG_CHANNEL_IO “1-1”/ commening out stereo processing is not making an audiounit that works in logic X for me. it shows up in the stereo menu and doesn’t work

I don’t know if this is the reason, but I’ve found that once you build the plugin for the first time, then Logic (at least) won’t let me change the IO configuration

So for example, if I build with this config:

#define PLUG_CHANNEL_IO “1-1”

and then change it to:

#define PLUG_CHANNEL_IO “1-1 2-2”

the changes will not take effect.

Any other changes do work though.

Same here. Even though AU validator shows a new I/O configuration, Logic “remembers” the very first one only. But no such problems in Reaper.

OSX10.14.6, Logic10.5.1, Reaper6.15.0

I ran into this thread in Juce that claims that in order to change bus options in Logic all you need to do is change the plugin version number.

l’ll take a look at that. Although for now it seems that this is not as simple as changing these lines:

#define PLUG_VERSION_HEX 0x00010000
#define PLUG_VERSION_STR “1.0.0”

Logic won’t have any of that for now.

1 Like

Well thanks, for me it worked. I just changed those two lines to:

#define PLUG_VERSION_HEX 0x00010002
#define PLUG_VERSION_STR “1.0.2”

and Logic updated to the new I/O format :slight_smile:

1 Like