Mixer: Refuse to bypass modules whose channel configuration makes bypassing illogical.

This commit is contained in:
Jonathan Moore Liles 2013-03-15 00:05:23 -07:00
parent f29a132dfc
commit b1eb988257
2 changed files with 23 additions and 3 deletions

View File

@ -700,7 +700,14 @@ Module::menu_cb ( const Fl_Menu_ *m )
if ( ! strcmp( picked, "Edit Parameters" ) )
command_open_parameter_editor();
else if ( ! strcmp( picked, "Bypass" ) )
bypass( ! ( m->mvalue()->flags & FL_MENU_VALUE ) );
if ( ! bypassable() )
{
fl_alert( "Due to its channel configuration, this module cannot be bypassed." );
}
else
{
bypass( ! ( m->mvalue()->flags & FL_MENU_VALUE ) );
}
else if ( ! strcmp( picked, "Cut" ) )
{
copy();
@ -818,8 +825,15 @@ Module::handle ( int m )
}
else if ( test_press( FL_BUTTON2 ) )
{
bypass( !bypass() );
redraw();
if ( !bypassable() )
{
fl_alert( "Due to its channel configuration, this module cannot be bypassed." );
}
else
{
bypass( !bypass() );
redraw();
}
return 1;
}

View File

@ -354,6 +354,12 @@ public:
virtual bool bypass ( void ) const { return _bypass; }
virtual void bypass ( bool v ) { _bypass = v; redraw(); }
virtual bool bypassable ( void ) const
{
return ninputs() == noutputs() ||
( ninputs() == 1 && noutputs() == 2 );
}
int control_input_port_index ( Port *p )
{
for ( nframes_t i = control_input.size(); i--; )