Ableton Live VST output channels not work after changing

We noticed a special behavior in ableton live 11. I have an instrument plugin with 16 stereo outputs.

Reproduction steps:

  1. Load the plugin. Set the output of a pad to output for example to 6
  2. I choose an audio channel in ableton live and choose audio from output 6 like in the image below
    → all works ok so far. Audio is received by abletons audio channel 6
  3. When I now choose a higher audio output channel for example output 7 only in ableton
    → it outputs the audio that we output in output 7, even we still have output 6 selected in the plugin.
  4. I now change the output channel in the plugin to 7
    → Ableton outputs no audio anymore or on a different channel, also when i try to switch back to channel 6.


The code that assigns the pad outputs to the channels (i do this in the process block before processing the audio buffer):

        if (numberOfOutputChannels >= 2)
            for (int i = 0; i < TalSampler::NumberOfPads; i++)
                TalPad& talPad = talSampler.getPad(i);

                int padOutputIndex = talPad.getOutputIndex() * 2;

                int smallestPossibleIndex = numberOfOutputChannels - 1;
                if (padOutputIndex >= smallestPossibleIndex)
                    padOutputIndex = smallestPossibleIndex - 1;

                float *samples0 = buffer.getWritePointer(padOutputIndex);
                float *samples1 = buffer.getWritePointer(padOutputIndex + 1);

                talPad.setStereoOutput(samples0, samples1, sampleCounter);

Any help welcome. I didn’t notice any problems in other hosts so far.

It looks like ableton’s output write pointers change when i change the channels in the ableton UI.
Do i need to access the write pointers through the audio processor? Something like getBusBuffer()?