From 63c4f68b3bf96f20e53420859bb05a66cfa887d3 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Thu, 14 Mar 2013 17:31:46 -0700 Subject: [PATCH] Mixer: Fix plugin bypass and plugin insertion broken by 8b9ef85. --- mixer/src/Module.H | 4 ++-- mixer/src/Plugin_Module.C | 16 ++++++++++++---- mixer/src/Plugin_Module.H | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/mixer/src/Module.H b/mixer/src/Module.H index e28b603..7ac0bbe 100644 --- a/mixer/src/Module.H +++ b/mixer/src/Module.H @@ -351,8 +351,8 @@ public: return control_output.size(); } - bool bypass ( void ) const { return _bypass; } - void bypass ( bool v ) { _bypass = v; redraw(); } + virtual bool bypass ( void ) const { return _bypass; } + virtual void bypass ( bool v ) { _bypass = v; redraw(); } int control_input_port_index ( Port *p ) { diff --git a/mixer/src/Plugin_Module.C b/mixer/src/Plugin_Module.C index b7ff5c3..9da242a 100644 --- a/mixer/src/Plugin_Module.C +++ b/mixer/src/Plugin_Module.C @@ -669,10 +669,13 @@ Plugin_Module::set_output_buffer ( int n, void *buf ) void Plugin_Module::activate ( void ) { + DMESSAGE( "Activating plugin \"%s\"", label() ); + if ( _active ) FATAL( "Attempt to activate already active plugin" ); - chain()->engine()->lock(); + if ( chain() ) + chain()->engine()->lock(); if ( _idata->descriptor->activate ) for ( unsigned int i = 0; i < _idata->handle.size(); ++i ) @@ -680,13 +683,17 @@ Plugin_Module::activate ( void ) _active = true; - chain()->engine()->unlock(); + if ( chain() ) + chain()->engine()->unlock(); } void Plugin_Module::deactivate( void ) { - chain()->engine()->lock(); + DMESSAGE( "Deactivating plugin \"%s\"", label() ); + + if ( chain() ) + chain()->engine()->lock(); _active = false; @@ -694,7 +701,8 @@ Plugin_Module::deactivate( void ) for ( unsigned int i = 0; i < _idata->handle.size(); ++i ) _idata->descriptor->deactivate( _idata->handle[i] ); - chain()->engine()->unlock(); + if ( chain() ) + chain()->engine()->unlock(); } void diff --git a/mixer/src/Plugin_Module.H b/mixer/src/Plugin_Module.H index 2db3e42..791b2f8 100644 --- a/mixer/src/Plugin_Module.H +++ b/mixer/src/Plugin_Module.H @@ -66,7 +66,7 @@ private: ImplementationData *_idata; - bool _active; + volatile bool _active; int _plugin_ins; int _plugin_outs; bool _crosswire;