Mixer: Fix persistence of bypass setting for LADSPA plugins.

This commit is contained in:
Jonathan Moore Liles 2013-03-15 17:54:37 -07:00
parent b1eb988257
commit 42072343d3
3 changed files with 23 additions and 11 deletions

View File

@ -46,7 +46,6 @@ class Module : public Fl_Group, public Loggable {
nframes_t _nframes; nframes_t _nframes;
Chain *_chain; Chain *_chain;
bool _is_default; bool _is_default;
bool _bypass;
Module_Parameter_Editor *_editor; Module_Parameter_Editor *_editor;
@ -65,6 +64,10 @@ class Module : public Fl_Group, public Loggable {
void copy ( void ) const; void copy ( void ) const;
void paste_before ( void ); void paste_before ( void );
protected:
volatile bool _bypass;
public: public:
/* true if this module was added by default and not under normal user control */ /* true if this module was added by default and not under normal user control */

View File

@ -170,7 +170,8 @@ Plugin_Module::init ( void )
{ {
_idata = new Plugin_Module::ImplementationData(); _idata = new Plugin_Module::ImplementationData();
_idata->handle.clear(); _idata->handle.clear();
_active = false; /* module will be bypassed until plugin is loaded */
_bypass = true;
_crosswire = false; _crosswire = false;
align( (Fl_Align)FL_ALIGN_CENTER | FL_ALIGN_INSIDE ); align( (Fl_Align)FL_ALIGN_CENTER | FL_ALIGN_INSIDE );
@ -256,7 +257,9 @@ Plugin_Module::configure_inputs( int n )
} }
} }
if ( _active ) bool b = bypass();
if ( !b )
deactivate(); deactivate();
if ( plugin_instances( inst ) ) if ( plugin_instances( inst ) )
@ -264,7 +267,7 @@ Plugin_Module::configure_inputs( int n )
else else
return false; return false;
if ( ! _active ) if ( !b )
activate(); activate();
return true; return true;
@ -623,7 +626,14 @@ Plugin_Module::load ( unsigned long id )
return false; return false;
} }
return plugin_instances( 1 ); int instances = plugin_instances( 1 );
if ( instances )
{
bypass( false );
}
return instances;
} }
void void
@ -671,7 +681,7 @@ Plugin_Module::activate ( void )
{ {
DMESSAGE( "Activating plugin \"%s\"", label() ); DMESSAGE( "Activating plugin \"%s\"", label() );
if ( _active ) if ( !bypass() )
FATAL( "Attempt to activate already active plugin" ); FATAL( "Attempt to activate already active plugin" );
if ( chain() ) if ( chain() )
@ -681,7 +691,7 @@ Plugin_Module::activate ( void )
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; _bypass = false;
if ( chain() ) if ( chain() )
chain()->engine()->unlock(); chain()->engine()->unlock();
@ -695,7 +705,7 @@ Plugin_Module::deactivate( void )
if ( chain() ) if ( chain() )
chain()->engine()->lock(); chain()->engine()->lock();
_active = false; _bypass = true;
if ( _idata->descriptor->deactivate ) if ( _idata->descriptor->deactivate )
for ( unsigned int i = 0; i < _idata->handle.size(); ++i ) for ( unsigned int i = 0; i < _idata->handle.size(); ++i )
@ -736,7 +746,7 @@ Plugin_Module::process ( nframes_t nframes )
{ {
handle_port_connection_change(); handle_port_connection_change();
if ( _active ) if ( !bypass() )
{ {
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 );

View File

@ -66,7 +66,6 @@ private:
ImplementationData *_idata; ImplementationData *_idata;
volatile bool _active;
int _plugin_ins; int _plugin_ins;
int _plugin_outs; int _plugin_outs;
bool _crosswire; bool _crosswire;
@ -108,7 +107,7 @@ public:
int can_support_inputs ( int ); int can_support_inputs ( int );
bool configure_inputs ( int ); bool configure_inputs ( int );
virtual bool bypass ( void ) const { return !_active; } virtual bool bypass ( void ) const { return _bypass; }
virtual void bypass ( bool v ); virtual void bypass ( bool v );
virtual void process ( nframes_t ); virtual void process ( nframes_t );