Mono input - stereo output



I am new to Juce. Therefore, forgive me if my question might be trivial. I am confused on how to create a mono input to stereo output plug-in.
I would like it to be able to handle both mono-to-stereo and stereo-to-stereo formats. There are no problems for the inputs (neglecting for the moment efficiency aspects).  In the mono input case, I can simply duplicate it:

float *pfSampleL,*pfSampleR;

if (iNumInputChannels == 1) {
        pfSampleL = pfSampleR = buffer.getWritePointer (0);    

if (iNumInputChannels == 2) {
        pfSampleL = buffer.getWritePointer (0); 
        pfSampleR = buffer.getWritePointer (1);    

But how should I handle the outputs?
No problems if the input is stereo (I just overwrite the two buffers). However, what am I suppose to do in the mono to stereo case? Where is the extra buffer needed?

Thank in advance for any hint.

It looks like that some hosts automatically convert the mono input to a stereo one. However I doubt that all will have the same behaviour.


Is there no asnwer to my question?



Not sure I understand the question.. The plugin gives you a number of output channels to fill, you can fill them with whatever samples is appropriate (?)


Thank you.  So for the additional output channel,  should I simply write to what is obtained by calling buffer.getWritePointer (1)?




Yes. In the example code, isn't there a loop that loops over each channel? You can just pull the output of both channels from the first channel, in the mono case.


Thank you so much!