From 5b8040b165fd997fe0f86f87d5509402ce86193a Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Sat, 16 Jan 2010 20:42:47 -0600 Subject: [PATCH] Fix bug in plugin input configuration. --- Mixer/Plugin_Module.C | 74 +++++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 35 deletions(-) diff --git a/Mixer/Plugin_Module.C b/Mixer/Plugin_Module.C index 89cdc89..f2b9132 100644 --- a/Mixer/Plugin_Module.C +++ b/Mixer/Plugin_Module.C @@ -229,46 +229,50 @@ Plugin_Module::can_support_inputs ( int n ) bool Plugin_Module::configure_inputs( int n ) { - if ( ninputs() == n ) - return true; + int inst = _idata->handle.size(); - int inst = 1; - _crosswire = false; - - if ( 1 == n && plugin_ins() > 1 ) + if ( ninputs() != n ) { - DMESSAGE( "Cross-wiring plugin inputs" ); - _crosswire = true; + _crosswire = false; - audio_input.clear(); - - for ( int i = n; i--; ) - audio_input.push_back( Port( this, Port::INPUT, Port::AUDIO ) ); - } - else if ( n >= plugin_ins() && - ( plugin_ins() == 1 && plugin_outs() == 1 ) ) - { - DMESSAGE( "Running multiple instances of plugin" ); - - audio_input.clear(); - audio_output.clear(); - - for ( int i = n; i--; ) + if ( n != ninputs() ) { - add_port( Port( this, Port::INPUT, Port::AUDIO ) ); - add_port( Port( this, Port::OUTPUT, Port::AUDIO ) ); + if ( 1 == n && plugin_ins() > 1 ) + { + DMESSAGE( "Cross-wiring plugin inputs" ); + _crosswire = true; + + audio_input.clear(); + + for ( int i = n; i--; ) + audio_input.push_back( Port( this, Port::INPUT, Port::AUDIO ) ); + } + else if ( n >= plugin_ins() && + ( plugin_ins() == 1 && plugin_outs() == 1 ) ) + { + DMESSAGE( "Running multiple instances of plugin" ); + + audio_input.clear(); + audio_output.clear(); + + for ( int i = n; i--; ) + { + add_port( Port( this, Port::INPUT, Port::AUDIO ) ); + add_port( Port( this, Port::OUTPUT, Port::AUDIO ) ); + } + + inst = n; + } + else if ( n == plugin_ins() ) + { + DMESSAGE( "Plugin input configuration is a perfect match" ); + } + else + { + DMESSAGE( "Unsupported input configuration" ); + return false; + } } - - inst = n; - } - if ( n == plugin_ins() ) - { - - } - else - { - // unsupported configuration - return false; } if ( _active )