Mono/stereo issue in Logic/LogicX


#1

Using the latest tip here... and the stickied solution for the bus arrangement for a {1,1},{1,2},{2,2} effect. Here's the issue: I route a mono track with a mono sample to a stereo bus, on which I load my plugin. Using

if (numInputChannels == 1)
    {
        channelData0 = buffer.getWritePointer(0);
        channelData1 = buffer.getWritePointer(0);
    }
    else if (numInputChannels == 2)
    {
        channelData0 = buffer.getWritePointer(0);
        channelData1 = buffer.getWritePointer(1);
    } 

to access the data pointers, I see that, first of all, numInputChannels (and numOutputChannels, for that matter) is 2, as expected on a stereo bus. However, channelData0 and channelData1 point to the same address, so that the effect plays back in mono! Seems like there is an issue in the AU wrapper for this case?

 


#2

Can you post some more complete code? Where are you getting numInputChannels channles from?


#3

Sure:

void Processor::processBlock(AudioSampleBuffer& buffer, MidiBuffer& /*midiMessages*/)
{
    const int numInputChannels = getTotalNumInputChannels();
    const int numOutputChannels = getTotalNumOutputChannels();
    float* channelData0 = nullptr;
    float* channelData1 = nullptr;
    if (numInputChannels == 1)
    {
        channelData0 = buffer.getWritePointer(0);
        channelData1 = buffer.getWritePointer(0);
    }
    else if (numInputChannels == 2)
    {
        channelData0 = buffer.getWritePointer(0);
        channelData1 = buffer.getWritePointer(1);
    }

 

 


#4

I remember running into this, too (although I tought the two channels pointing to the same data happened after switching from mono to stereo and back to mono). I’m rather sure I tracked this back in the AU wrapper and this issue/feature originates from Logic, e.g. Logic already provided two channels which point to the same audio data.


#5

Yes, when feeding a mono signal into a stereo bus, Logic provides (as input) two channels that point to the same audio data. The issue is that this collides with the way that JUCE uses the same pointers for in- and output purposes.