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 */
|
||||
for ( int i = 0; i < modules(); ++i )
|
||||
{
|
||||
|
||||
Module *m = module( i );
|
||||
|
||||
for ( unsigned int j = 0; j < m->audio_input.size(); ++j )
|
||||
{
|
||||
m->audio_input[j].connect_to( &scratch_port[j] );
|
||||
|
@ -796,8 +798,7 @@ Chain::process ( nframes_t nframes )
|
|||
{
|
||||
Module *m = *i;
|
||||
|
||||
if ( ! m->bypass() )
|
||||
m->process( nframes );
|
||||
m->process( nframes );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -81,8 +81,15 @@ Mono_Pan_Module::process ( nframes_t nframes )
|
|||
audio_output[0].connected() &&
|
||||
audio_output[1].connected() )
|
||||
{
|
||||
buffer_copy_and_apply_gain( (sample_t*)audio_output[1].buffer(), (sample_t*)audio_input[0].buffer(), nframes, rg );
|
||||
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_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
|
||||
#include "LADSPAInfo.h"
|
||||
|
||||
#include "Chain.H"
|
||||
#include "Engine/Engine.H"
|
||||
|
||||
#include <dsp.h>
|
||||
|
||||
|
||||
|
||||
static LADSPAInfo *ladspainfo;
|
||||
|
@ -386,6 +389,18 @@ Plugin_Module::plugin_instances ( unsigned int n )
|
|||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
Plugin_Module::bypass ( bool v )
|
||||
{
|
||||
if ( v != bypass() )
|
||||
{
|
||||
if ( v )
|
||||
deactivate();
|
||||
else
|
||||
activate();
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
Plugin_Module::load ( unsigned long id )
|
||||
{
|
||||
|
@ -654,21 +669,29 @@ Plugin_Module::activate ( void )
|
|||
if ( _active )
|
||||
FATAL( "Attempt to activate already active plugin" );
|
||||
|
||||
chain()->engine()->lock();
|
||||
|
||||
if ( _idata->descriptor->activate )
|
||||
for ( unsigned int i = 0; i < _idata->handle.size(); ++i )
|
||||
_idata->descriptor->activate( _idata->handle[i] );
|
||||
|
||||
_active = true;
|
||||
|
||||
chain()->engine()->unlock();
|
||||
}
|
||||
|
||||
void
|
||||
Plugin_Module::deactivate( void )
|
||||
{
|
||||
if ( _idata->descriptor->deactivate )
|
||||
for ( unsigned int i = 0; i < _idata->handle.size(); ++i )
|
||||
_idata->descriptor->activate( _idata->handle[i] );
|
||||
chain()->engine()->lock();
|
||||
|
||||
_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
|
||||
|
@ -703,8 +726,19 @@ Plugin_Module::process ( nframes_t nframes )
|
|||
handle_port_connection_change();
|
||||
|
||||
if ( _active )
|
||||
{
|
||||
for ( unsigned int i = 0; i < _idata->handle.size(); ++i )
|
||||
_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 deactivate ( void );
|
||||
void process ( unsigned long nframes );
|
||||
bool active ( void ) const { return _active; }
|
||||
|
||||
bool plugin_instances ( unsigned int );
|
||||
|
||||
|
@ -109,7 +108,10 @@ public:
|
|||
int can_support_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 );
|
||||
|
||||
|
|
Loading…
Reference in New Issue