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( "Meter", 0, 0 );
insert_menu->add( "Mono Pan", 0, 0 ); insert_menu->add( "Mono Pan", 0, 0 );
insert_menu->add( "Aux", 0, 0 ); insert_menu->add( "Aux", 0, 0 );
insert_menu->add( "Distance", 0, 0 );
insert_menu->add( "Spatializer", 0, 0 ); insert_menu->add( "Spatializer", 0, 0 );
insert_menu->add( "Plugin", 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 ( ) 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 )->azimuth( azimuth_value );
o->point( 0 )->elevation( elevation_value ); o->point( 0 )->elevation( elevation_value );
if ( radius_port_number >= 0 )
{
o->point( 0 )->radius_enabled = true;
o->point( 0 )->radius( radius_value ); o->point( 0 )->radius( radius_value );
}
Fl_Labelpad_Group *flg = new Fl_Labelpad_Group( o ); Fl_Labelpad_Group *flg = new Fl_Labelpad_Group( o );
@ -344,6 +347,7 @@ Module_Parameter_Editor::make_controls ( void )
controls_by_port[azimuth_port_number] = o; controls_by_port[azimuth_port_number] = o;
controls_by_port[elevation_port_number] = o; controls_by_port[elevation_port_number] = o;
if ( radius_port_number >= 0 )
controls_by_port[radius_port_number] = o; controls_by_port[radius_port_number] = o;
} }
@ -467,10 +471,12 @@ Module_Parameter_Editor::handle_control_changed ( Module::Port *p )
void void
Module_Parameter_Editor::set_value (int i, float value ) Module_Parameter_Editor::set_value (int i, float value )
{
if ( i >= 0 )
{ {
_module->control_input[i].control_value( value ); _module->control_input[i].control_value( value );
if ( _module->control_input[i].connected() ) if ( _module->control_input[i].connected() )
_module->control_input[i].connected_port()->module()->handle_control_changed( _module->control_input[i].connected_port() ); _module->control_input[i].connected_port()->module()->handle_control_changed( _module->control_input[i].connected_port() );
}
// _module->handle_control_changed( &_module->control_input[i] ); // _module->handle_control_changed( &_module->control_input[i] );
} }

View File

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

View File

@ -65,9 +65,6 @@ Spatialization_Console::~Spatialization_Console ( )
void void
@ -93,8 +90,12 @@ Spatialization_Console::make_controls ( void )
p.azimuth( o->spatializer()->control_output[0].control_value() ); p.azimuth( o->spatializer()->control_output[0].control_value() );
p.elevation( o->spatializer()->control_output[1].control_value() ); p.elevation( o->spatializer()->control_output[1].control_value() );
if ( o->spatializer()->control_output[2].connected() )
{
p.radius_enabled = true;
p.radius( o->spatializer()->control_output[2].control_value() ); p.radius( o->spatializer()->control_output[2].control_value() );
} }
}
else else
p.visible = false; p.visible = false;
@ -118,6 +119,7 @@ Spatialization_Console::cb_panner_value_handle ( Fl_Widget *w, void *v )
cm->control_output[0].control_value( p->azimuth() ); cm->control_output[0].control_value( p->azimuth() );
cm->control_output[1].control_value( p->elevation() ); cm->control_output[1].control_value( p->elevation() );
if ( p->radius_enabled )
cm->control_output[2].control_value( p->radius() ); cm->control_output[2].control_value( p->radius() );
} }
@ -136,6 +138,7 @@ Spatialization_Console::handle_control_changed ( Controller_Module *m )
{ {
p->azimuth( m->control_output[0].control_value() ); p->azimuth( m->control_output[0].control_value() );
p->elevation( m->control_output[1].control_value() ); p->elevation( m->control_output[1].control_value() );
if ( p->radius_enabled )
p->radius( m->control_output[2].control_value() ); p->radius( m->control_output[2].control_value() );
if ( panner->visible_r() ) if ( panner->visible_r() )