[Solved] FX plugin wrapped for VST2 receives its audio input in the output buffer

Hi there!

I have created a plugin that processes incoming audio and it works as expected when I build it as a VST3 and test it within Bitwig Studio.
I have also used the VST2.4 wrapper but when I test it within Ableton Live it is absolutely silent. A closer debugging inspection points out that the reason for this is that the input buffers are always empty and that the actual input is routed into the VST from the output buffer ??

Similar to the AGain example I get the inputs like so:

int32 numInChannels  = data.inputs[ 0 ].numChannels;
    int32 numOutChannels = data.outputs[ 0 ].numChannels;

    // --- get audio buffers----------------
    uint32 sampleFramesSize = getSampleFramesSizeInBytes( processSetup, data.numSamples );
    void** in  = getChannelBuffersPointer( processSetup, data.inputs [ 0 ] );
    void** out = getChannelBuffersPointer( processSetup, data.outputs[ 0 ] );
    
    // processing code goes here...

If my processing code writes straight into the output buffer everything works according to expectation. The question is : is this something that is unique to the VST wrapper ? Is it unique to Ableton ?

A further investigation led me to the conclusion that the memory pointing to the in buffer is the same as the out buffer.
I am now successfully processing the in buffer (good, as it would be equivalent to writing code thinking true means false) and found the source of the problem was a memset operation where I would clear the out-buffers by setting the values of the float** arrays to 0. This had the result that the in-buffers would also be empty (I tripled checked whether I was operating on the right pointer! Though I would have found out sooner if it weren’t for the fact that Bitwig Studio and the editorhost worked just fine for the VST3 version…)

I don’t need to use a memset operation to clear the output buffers as I will overwrite them sample by sample in my process cycle. However, is it common to expect that the in- and out-buffers point to the same thing ? Is this related to VST version, VST category type, the host, etc ?

Yes, for processReplace anyway.

Yes, this is absolutely to be expected and even in VST3 it is possible that the input buffers are the same as the output buffers.

Cheers,
Arne

Thank you both very much!