Browse Source

Mixer: Fix azimuth/elevation reporting. Load current values in Module_Parameter_Editor.

tags/non-daw-v1.1.0
Jonathan Moore Liles 12 years ago
parent
commit
82583365f6
3 changed files with 35 additions and 9 deletions
  1. +18
    -5
      mixer/src/Module_Parameter_Editor.C
  2. +2
    -2
      mixer/src/Panner.C
  3. +15
    -2
      mixer/src/Panner.H

+ 18
- 5
mixer/src/Module_Parameter_Editor.C View File

@@ -135,7 +135,9 @@ Module_Parameter_Editor::make_controls ( void )
/* these are for detecting related parameter groups which can be
better represented by a single control */
int azimuth_port_number = -1;
float azimuth_value;
int elevation_port_number = -1;
float elevation_value;

for ( unsigned int i = 0; i < module->control_input.size(); ++i )
{
@@ -143,14 +145,20 @@ Module_Parameter_Editor::make_controls ( void )

Module::Port *p = &module->control_input[i];

if ( !strcasecmp( "Azimuth", p->name() ) )
if ( !strcasecmp( "Azimuth", p->name() ) &&
180.0f == p->hints.maximum &&
-180.0f == p->hints.minimum )
{
azimuth_port_number = i;
azimuth_value = p->control_value();
continue;
}
else if ( !strcasecmp( "Elevation", p->name() ) )
else if ( !strcasecmp( "Elevation", p->name() ) &&
90.0f == p->hints.maximum &&
-90.0f == p->hints.minimum )
{
elevation_port_number = i;
elevation_value = p->control_value();
continue;
}

@@ -288,7 +296,12 @@ Module_Parameter_Editor::make_controls ( void )
o->labelsize( 10 );
o->callback( cb_panner_value_handle, new callback_data( this, azimuth_port_number, elevation_port_number ) );

control_pack->add( o );
o->point( 0 )->azimuth( azimuth_value );
o->point( 0 )->elevation( elevation_value );

Fl_Labelpad_Group *flg = new Fl_Labelpad_Group( o );

control_pack->add( flg );
}


@@ -312,8 +325,8 @@ Module_Parameter_Editor::cb_panner_value_handle ( Fl_Widget *w, void *v )
{
callback_data *cd = (callback_data*)v;

cd->base_widget->set_value( cd->port_number[0], ((Panner*)w)->point( 0 ).azimuth() );
cd->base_widget->set_value( cd->port_number[1], ((Panner*)w)->point( 0 ).elevation() );
cd->base_widget->set_value( cd->port_number[0], ((Panner*)w)->point( 0 )->azimuth() );
cd->base_widget->set_value( cd->port_number[1], ((Panner*)w)->point( 0 )->elevation() );
}

void


+ 2
- 2
mixer/src/Panner.C View File

@@ -263,10 +263,10 @@ Panner::draw ( void )
}

/* return the current gain setting for the path in/out */
Panner::Point
Panner::Point *
Panner::point( int i )
{
return _points[ i ];
return &_points[ i ];
}

int


+ 15
- 2
mixer/src/Panner.H View File

@@ -56,14 +56,27 @@ class Panner : public Fl_Widget

float azimuth ( void ) const
{
return a;
return a > 180.0f ? a - 360.0f : a;
}


float elevation ( void ) const
{
return ( 1.0f - d ) * 90.0f;
}

void azimuth ( float v )
{
a = v < -180.0f ? 360.0f - v : v;
a = a < 0.0f ? 0.0f : a > 360.0f ? 360.0f : a;
}

void elevation ( float v )
{
d = 1.0f - ( v / 90.0f );
d = d < 0.0f ? 0.0f : d > 1.0f ? 1.0f : d;
}

/** set point position in X, Y coordinates (0.0 to 1.0) */
void
angle ( float X1, float Y1 )
@@ -179,6 +192,6 @@ public:

virtual ~Panner ( ) { }

Panner::Point point ( int i );
Panner::Point *point ( int i );

};

Loading…
Cancel
Save