Mixer: Fix mirroring and OSC automation of Spatialization controls.

This commit is contained in:
Jonathan Moore Liles 2012-02-10 04:01:02 -08:00
parent 0590687857
commit cff2c15583
3 changed files with 39 additions and 10 deletions

View File

@ -555,6 +555,8 @@ Controller_Module::handle_control_changed ( Port *p )
pan->point( 0 )->azimuth( control_output[0].control_value() ); pan->point( 0 )->azimuth( control_output[0].control_value() );
pan->point( 0 )->elevation( control_output[1].control_value() ); pan->point( 0 )->elevation( control_output[1].control_value() );
pan->redraw();
} }
else else
{ {

View File

@ -117,8 +117,7 @@ Module_Parameter_Editor::Module_Parameter_Editor ( Module *module ) : Fl_Double_
Module_Parameter_Editor::~Module_Parameter_Editor ( ) Module_Parameter_Editor::~Module_Parameter_Editor ( )
{ {
controls_by_port.clear();
} }
@ -130,14 +129,17 @@ Module_Parameter_Editor::make_controls ( void )
control_pack->clear(); control_pack->clear();
controls_by_port.clear();
/* these are for detecting related parameter groups which can be /* these are for detecting related parameter groups which can be
better represented by a single control */ better represented by a single control */
int azimuth_port_number = -1; azimuth_port_number = -1;
float azimuth_value = 0.0f; float azimuth_value = 0.0f;
int elevation_port_number = -1; elevation_port_number = -1;
float elevation_value = 0.0f; float elevation_value = 0.0f;
controls_by_port.resize( module->control_input.size() );
for ( unsigned int i = 0; i < module->control_input.size(); ++i ) for ( unsigned int i = 0; i < module->control_input.size(); ++i )
{ {
Fl_Widget *w; Fl_Widget *w;
@ -243,6 +245,7 @@ Module_Parameter_Editor::make_controls ( void )
} }
controls_by_port[i] = w;
w->tooltip( p->osc_path() ); w->tooltip( p->osc_path() );
@ -309,6 +312,9 @@ Module_Parameter_Editor::make_controls ( void )
Fl_Labelpad_Group *flg = new Fl_Labelpad_Group( o ); Fl_Labelpad_Group *flg = new Fl_Labelpad_Group( o );
control_pack->add( flg ); control_pack->add( flg );
controls_by_port[azimuth_port_number] = o;
controls_by_port[elevation_port_number] = o;
} }
@ -387,21 +393,34 @@ void
Module_Parameter_Editor::handle_control_changed ( Module::Port *p ) Module_Parameter_Editor::handle_control_changed ( Module::Port *p )
{ {
int i = _module->control_input_port_index( p ); int i = _module->control_input_port_index( p );
Fl_Widget *w = controls_by_port[i];
/* FIXME: very hacky in that it assumes the control is an Fl_Valuator... (which buttons are not) */ if ( i == azimuth_port_number ||
Fl_Group *g = (Fl_Group*)control_pack->child( i ); i == elevation_port_number )
Fl_Group *g2 = (Fl_Group*)g->child( 0 ); {
Panner *_panner = (Panner*)w;
if ( i == azimuth_port_number )
_panner->point(0)->azimuth( p->control_value() );
else if ( i == elevation_port_number )
_panner->point(0)->elevation( p->control_value() );
_panner->redraw();
return;
}
if ( p->hints.type == Module::Port::Hints::BOOLEAN ) if ( p->hints.type == Module::Port::Hints::BOOLEAN )
{ {
Fl_Button *v = (Fl_Button*)g2->child( 0 ); Fl_Button *v = (Fl_Button*)w;
v->value( p->control_value() ); v->value( p->control_value() );
} }
else else
{ {
Fl_Valuator *v = (Fl_Valuator*)g2->child( 0 ); Fl_Valuator *v = (Fl_Valuator*)w;
v->value( p->control_value() ); v->value( p->control_value() );
} }

View File

@ -25,6 +25,9 @@ class Fl_Pack;
class Fl_Flowpack; class Fl_Flowpack;
class Module; class Module;
class Fl_Menu_Button; class Fl_Menu_Button;
class Panner;
#include <vector>
class Module_Parameter_Editor : public Fl_Double_Window class Module_Parameter_Editor : public Fl_Double_Window
{ {
@ -66,6 +69,11 @@ class Module_Parameter_Editor : public Fl_Double_Window
Fl_Menu_Button *mode_choice; Fl_Menu_Button *mode_choice;
bool _resized; bool _resized;
int azimuth_port_number;
int elevation_port_number;
std::vector<Fl_Widget*> controls_by_port;
public: public:
void handle_control_changed ( Module::Port *p ); void handle_control_changed ( Module::Port *p );