Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the bug where mono VSTs only output on the left channel #6693

Closed
wants to merge 13 commits into from
33 changes: 25 additions & 8 deletions plugins/VstBase/RemoteVstPlugin.cpp
messmerd marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,7 @@ void RemoteVstPlugin::process( const sampleFrame * _in, sampleFrame * _out )
return;
}

// Set up input and output pointers for processing
for( int i = 0; i < inputCount(); ++i )
{
m_inputs[i] = &((float *) _in)[i * bufferSize()];
Expand All @@ -1087,21 +1088,37 @@ void RemoteVstPlugin::process( const sampleFrame * _in, sampleFrame * _out )
memset( m_outputs[i], 0, bufferSize() * sizeof( float ) );
}

#ifdef OLD_VST_SDK
if( m_plugin->flags & effFlagsCanReplacing )
int numInputChannels = inputCount();
int numOutputChannels = outputCount();

// Handle the case where the plugin can only process mono input but needs to produce stereo output
if (numInputChannels == 1 && numOutputChannels == 2)
{
m_plugin->processReplacing( m_plugin, m_inputs, m_outputs,
bufferSize() );
float* leftInput = m_inputs[0];
float* leftOutput = m_outputs[0];
float* rightOutput = m_outputs[1];

// Process left channel using the mono input data
m_plugin->processReplacing(m_plugin, &leftInput, &leftOutput, bufferSize());

// Process right channel using the mono input data
m_plugin->processReplacing(m_plugin, &leftInput, &rightOutput, bufferSize());
}
else
{
m_plugin->process( m_plugin, m_inputs, m_outputs,
bufferSize() );
}
// Standard processing for plugins that support the required number of input and output channels
#ifdef OLD_VST_SDK
if (m_plugin->flags & effFlagsCanReplacing)
{
m_plugin->processReplacing(m_plugin, m_inputs, m_outputs, bufferSize());
}
else { m_plugin->process(m_plugin, m_inputs, m_outputs, bufferSize()); }
#else
m_plugin->processReplacing(m_plugin, m_inputs, m_outputs, bufferSize());
m_plugin->processReplacing(m_plugin, m_inputs, m_outputs, bufferSize());
#endif
}

// Unlock shared memory and update the current sample position
unlockShm();

m_currentSamplePos += bufferSize();
Expand Down
Loading