Mixer: Fix panner control connection to old ambisonics LADSPA plugins.

This commit is contained in:
Jonathan Moore Liles 2013-07-17 19:13:33 -07:00
parent be025b00b9
commit e95fd10775
4 changed files with 32 additions and 15 deletions

View File

@ -846,7 +846,6 @@ Module::menu ( void ) const
insert_menu->add( "Meter", 0, 0 );
insert_menu->add( "Mono Pan", 0, 0 );
insert_menu->add( "Aux", 0, 0 );
insert_menu->add( "Distance", 0, 0 );
insert_menu->add( "Spatializer", 0, 0 );
insert_menu->add( "Plugin", 0, 0 );

View File

@ -126,7 +126,6 @@ Module_Parameter_Editor::Module_Parameter_Editor ( Module *module ) : Fl_Double_
Module_Parameter_Editor::~Module_Parameter_Editor ( )
{
controls_by_port.clear();
}
@ -336,7 +335,11 @@ Module_Parameter_Editor::make_controls ( void )
o->point( 0 )->azimuth( azimuth_value );
o->point( 0 )->elevation( elevation_value );
o->point( 0 )->radius( radius_value );
if ( radius_port_number >= 0 )
{
o->point( 0 )->radius_enabled = true;
o->point( 0 )->radius( radius_value );
}
Fl_Labelpad_Group *flg = new Fl_Labelpad_Group( o );
@ -344,7 +347,8 @@ Module_Parameter_Editor::make_controls ( void )
controls_by_port[azimuth_port_number] = o;
controls_by_port[elevation_port_number] = o;
controls_by_port[radius_port_number] = o;
if ( radius_port_number >= 0 )
controls_by_port[radius_port_number] = o;
}
@ -468,9 +472,11 @@ Module_Parameter_Editor::handle_control_changed ( Module::Port *p )
void
Module_Parameter_Editor::set_value (int i, float value )
{
_module->control_input[i].control_value( value );
if ( _module->control_input[i].connected() )
_module->control_input[i].connected_port()->module()->handle_control_changed( _module->control_input[i].connected_port() );
if ( i >= 0 )
{
_module->control_input[i].control_value( value );
if ( _module->control_input[i].connected() )
_module->control_input[i].connected_port()->module()->handle_control_changed( _module->control_input[i].connected_port() );
}
// _module->handle_control_changed( &_module->control_input[i] );
}

View File

@ -46,6 +46,7 @@ public:
void *userdata;
Fl_Color color;
bool visible;
bool radius_enabled;
Point ( ) {
x = 1;
@ -54,6 +55,7 @@ public:
label = 0;
visible = 1;
color = FL_WHITE;
radius_enabled = false;
}
Point ( float D, float A )
@ -63,6 +65,7 @@ public:
label = 0;
visible = 1;
color = FL_WHITE;
radius_enabled = false;
}
static inline void spherical_to_cartesian (float a, float e, float &x, float &y, float &z )
@ -83,7 +86,10 @@ public:
return atan2f(z,sqrtf(powf(x,2)+powf(y,2)) ) * ( 180 / M_PI );
}
float radius ( void ) const {
return sqrtf(powf(x,2)+powf(y,2)+powf(z,2));
if ( ! radius_enabled )
return 1.0f;
else
return sqrtf(powf(x,2)+powf(y,2)+powf(z,2));
}
void azimuth ( float v )
@ -109,6 +115,9 @@ public:
void radius ( float v )
{
if (! radius_enabled )
return;
float r = v;
spherical_to_cartesian( azimuth(), elevation(), x,y,z );

View File

@ -65,9 +65,6 @@ Spatialization_Console::~Spatialization_Console ( )
void
@ -93,7 +90,11 @@ Spatialization_Console::make_controls ( void )
p.azimuth( o->spatializer()->control_output[0].control_value() );
p.elevation( o->spatializer()->control_output[1].control_value() );
p.radius( o->spatializer()->control_output[2].control_value() );
if ( o->spatializer()->control_output[2].connected() )
{
p.radius_enabled = true;
p.radius( o->spatializer()->control_output[2].control_value() );
}
}
else
p.visible = false;
@ -118,7 +119,8 @@ Spatialization_Console::cb_panner_value_handle ( Fl_Widget *w, void *v )
cm->control_output[0].control_value( p->azimuth() );
cm->control_output[1].control_value( p->elevation() );
cm->control_output[2].control_value( p->radius() );
if ( p->radius_enabled )
cm->control_output[2].control_value( p->radius() );
}
/* Display changes initiated via automation or from other parts of the GUI */
@ -136,7 +138,8 @@ Spatialization_Console::handle_control_changed ( Controller_Module *m )
{
p->azimuth( m->control_output[0].control_value() );
p->elevation( m->control_output[1].control_value() );
p->radius( m->control_output[2].control_value() );
if ( p->radius_enabled )
p->radius( m->control_output[2].control_value() );
if ( panner->visible_r() )
panner->redraw();