Mixer: Fix bypass for 1 IN 2 out modules.
This commit is contained in:
parent
0e66baaf21
commit
8b9ef85c80
|
@ -686,7 +686,9 @@ Chain::build_process_queue ( void )
|
||||||
/* connect all the ports to the buffers */
|
/* connect all the ports to the buffers */
|
||||||
for ( int i = 0; i < modules(); ++i )
|
for ( int i = 0; i < modules(); ++i )
|
||||||
{
|
{
|
||||||
|
|
||||||
Module *m = module( i );
|
Module *m = module( i );
|
||||||
|
|
||||||
for ( unsigned int j = 0; j < m->audio_input.size(); ++j )
|
for ( unsigned int j = 0; j < m->audio_input.size(); ++j )
|
||||||
{
|
{
|
||||||
m->audio_input[j].connect_to( &scratch_port[j] );
|
m->audio_input[j].connect_to( &scratch_port[j] );
|
||||||
|
@ -796,7 +798,6 @@ Chain::process ( nframes_t nframes )
|
||||||
{
|
{
|
||||||
Module *m = *i;
|
Module *m = *i;
|
||||||
|
|
||||||
if ( ! m->bypass() )
|
|
||||||
m->process( nframes );
|
m->process( nframes );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,9 +80,16 @@ Mono_Pan_Module::process ( nframes_t nframes )
|
||||||
if ( audio_input[0].connected() &&
|
if ( audio_input[0].connected() &&
|
||||||
audio_output[0].connected() &&
|
audio_output[0].connected() &&
|
||||||
audio_output[1].connected() )
|
audio_output[1].connected() )
|
||||||
|
{
|
||||||
|
if ( bypass() )
|
||||||
|
{
|
||||||
|
buffer_copy( (sample_t*)audio_output[1].buffer(), (sample_t*)audio_input[0].buffer(), nframes );
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
buffer_copy_and_apply_gain( (sample_t*)audio_output[1].buffer(), (sample_t*)audio_input[0].buffer(), nframes, rg );
|
buffer_copy_and_apply_gain( (sample_t*)audio_output[1].buffer(), (sample_t*)audio_input[0].buffer(), nframes, rg );
|
||||||
|
|
||||||
buffer_apply_gain( (sample_t*)audio_output[0].buffer(), nframes, lg );
|
buffer_apply_gain( (sample_t*)audio_output[0].buffer(), nframes, lg );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -40,8 +40,11 @@
|
||||||
#define HAVE_LIBLRDF 1
|
#define HAVE_LIBLRDF 1
|
||||||
#include "LADSPAInfo.h"
|
#include "LADSPAInfo.h"
|
||||||
|
|
||||||
|
#include "Chain.H"
|
||||||
#include "Engine/Engine.H"
|
#include "Engine/Engine.H"
|
||||||
|
|
||||||
|
#include <dsp.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static LADSPAInfo *ladspainfo;
|
static LADSPAInfo *ladspainfo;
|
||||||
|
@ -386,6 +389,18 @@ Plugin_Module::plugin_instances ( unsigned int n )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Plugin_Module::bypass ( bool v )
|
||||||
|
{
|
||||||
|
if ( v != bypass() )
|
||||||
|
{
|
||||||
|
if ( v )
|
||||||
|
deactivate();
|
||||||
|
else
|
||||||
|
activate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Plugin_Module::load ( unsigned long id )
|
Plugin_Module::load ( unsigned long id )
|
||||||
{
|
{
|
||||||
|
@ -654,21 +669,29 @@ Plugin_Module::activate ( void )
|
||||||
if ( _active )
|
if ( _active )
|
||||||
FATAL( "Attempt to activate already active plugin" );
|
FATAL( "Attempt to activate already active plugin" );
|
||||||
|
|
||||||
|
chain()->engine()->lock();
|
||||||
|
|
||||||
if ( _idata->descriptor->activate )
|
if ( _idata->descriptor->activate )
|
||||||
for ( unsigned int i = 0; i < _idata->handle.size(); ++i )
|
for ( unsigned int i = 0; i < _idata->handle.size(); ++i )
|
||||||
_idata->descriptor->activate( _idata->handle[i] );
|
_idata->descriptor->activate( _idata->handle[i] );
|
||||||
|
|
||||||
_active = true;
|
_active = true;
|
||||||
|
|
||||||
|
chain()->engine()->unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Plugin_Module::deactivate( void )
|
Plugin_Module::deactivate( void )
|
||||||
{
|
{
|
||||||
if ( _idata->descriptor->deactivate )
|
chain()->engine()->lock();
|
||||||
for ( unsigned int i = 0; i < _idata->handle.size(); ++i )
|
|
||||||
_idata->descriptor->activate( _idata->handle[i] );
|
|
||||||
|
|
||||||
_active = false;
|
_active = false;
|
||||||
|
|
||||||
|
if ( _idata->descriptor->deactivate )
|
||||||
|
for ( unsigned int i = 0; i < _idata->handle.size(); ++i )
|
||||||
|
_idata->descriptor->deactivate( _idata->handle[i] );
|
||||||
|
|
||||||
|
chain()->engine()->unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -703,8 +726,19 @@ Plugin_Module::process ( nframes_t nframes )
|
||||||
handle_port_connection_change();
|
handle_port_connection_change();
|
||||||
|
|
||||||
if ( _active )
|
if ( _active )
|
||||||
|
{
|
||||||
for ( unsigned int i = 0; i < _idata->handle.size(); ++i )
|
for ( unsigned int i = 0; i < _idata->handle.size(); ++i )
|
||||||
_idata->descriptor->run( _idata->handle[i], nframes );
|
_idata->descriptor->run( _idata->handle[i], nframes );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* If this is a mono to stereo plugin, then duplicate the input channel... */
|
||||||
|
/* There's not much we can do to automatically support other configurations. */
|
||||||
|
if ( ninputs() == 1 && noutputs() == 2 )
|
||||||
|
{
|
||||||
|
buffer_copy( (sample_t*)audio_output[1].buffer(), (sample_t*)audio_input[0].buffer(), nframes );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,6 @@ private:
|
||||||
void activate ( void );
|
void activate ( void );
|
||||||
void deactivate ( void );
|
void deactivate ( void );
|
||||||
void process ( unsigned long nframes );
|
void process ( unsigned long nframes );
|
||||||
bool active ( void ) const { return _active; }
|
|
||||||
|
|
||||||
bool plugin_instances ( unsigned int );
|
bool plugin_instances ( unsigned int );
|
||||||
|
|
||||||
|
@ -109,7 +108,10 @@ public:
|
||||||
int can_support_inputs ( int );
|
int can_support_inputs ( int );
|
||||||
bool configure_inputs ( int );
|
bool configure_inputs ( int );
|
||||||
|
|
||||||
void process ( nframes_t );
|
virtual bool bypass ( void ) const { return !_active; }
|
||||||
|
virtual void bypass ( bool v );
|
||||||
|
|
||||||
|
virtual void process ( nframes_t );
|
||||||
|
|
||||||
void handle_port_connection_change ( void );
|
void handle_port_connection_change ( void );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue