Mixer: Save/load the control mode status of the gain controller as part of the mixer strip's state.

pull/3/head
Jonathan Moore Liles 2010-02-17 07:29:41 -06:00
parent 65095d106d
commit 474ad167ed
3 changed files with 25 additions and 0 deletions

View File

@ -76,8 +76,13 @@ Controller_Module::Controller_Module ( bool is_default ) : Module( is_default, 5
Controller_Module::~Controller_Module ( ) Controller_Module::~Controller_Module ( )
{ {
Fl::remove_timeout( update_cb, this ); Fl::remove_timeout( update_cb, this );
log_destroy(); log_destroy();
/* shutdown JACK port, if we have one */
mode( GUI );
} }
void void
@ -163,6 +168,7 @@ Controller_Module::mode ( Mode m )
if ( ! po.activate() ) if ( ! po.activate() )
{ {
fl_alert( "Could not activate JACK port \"%s\"", po.name() ); fl_alert( "Could not activate JACK port \"%s\"", po.name() );
chain()->engine()->unlock();
return; return;
} }

View File

@ -94,6 +94,10 @@ Mixer_Strip::~Mixer_Strip ( )
{ {
DMESSAGE( "Destroying mixer strip" ); DMESSAGE( "Destroying mixer strip" );
/* make sure this gets destroyed before the chain */
fader_tab->clear();
delete _chain; delete _chain;
_chain = NULL; _chain = NULL;
@ -111,6 +115,10 @@ Mixer_Strip::get ( Log_Entry &e ) const
e.add( ":width", width_button->value() ? "wide" : "narrow" ); e.add( ":width", width_button->value() ? "wide" : "narrow" );
e.add( ":tab", tab_button->value() ? "signal" : "fader" ); e.add( ":tab", tab_button->value() ? "signal" : "fader" );
e.add( ":color", (unsigned long)color()); e.add( ":color", (unsigned long)color());
/* since the default controllers aren't logged, we have to store
* this setting as part of the mixer strip */
e.add( ":gain_mode", gain_controller->mode() );
} }
void void
@ -139,6 +147,10 @@ Mixer_Strip::set ( Log_Entry &e )
color( (Fl_Color)atoll( v ) ); color( (Fl_Color)atoll( v ) );
redraw(); redraw();
} }
else if ( ! strcmp( s, ":gain_mode" ) )
{
_gain_controller_mode = atoi( v );
}
} }
if ( ! mixer->contains( this ) ) if ( ! mixer->contains( this ) )
@ -286,6 +298,7 @@ Mixer_Strip::handle_module_added ( Module *m )
else if ( 0 == strcmp( m->name(), "Gain" ) ) else if ( 0 == strcmp( m->name(), "Gain" ) )
{ {
gain_controller->connect_to( &m->control_input[0] ); gain_controller->connect_to( &m->control_input[0] );
gain_controller->mode( (Controller_Module::Mode)_gain_controller_mode );
} }
else if ( 0 == strcmp( m->name(), "Meter" ) ) else if ( 0 == strcmp( m->name(), "Meter" ) )
{ {
@ -306,6 +319,7 @@ Mixer_Strip::init ( )
{ {
selection_color( FL_RED ); selection_color( FL_RED );
_gain_controller_mode = 0;
_chain = 0; _chain = 0;
// box(FL_THIN_UP_BOX); // box(FL_THIN_UP_BOX);

View File

@ -83,6 +83,11 @@ public:
private: private:
/* used to defer setting the mode of the gain controller until the
chain has been added and the controller connected to a default
module */
int _gain_controller_mode;
Fl_Flip_Button *width_button; Fl_Flip_Button *width_button;
Fl_Flip_Button *tab_button; Fl_Flip_Button *tab_button;
Fl_Button *close_button; Fl_Button *close_button;