Cosmetic panner changes.

pull/3/head
Jonathan Moore Liles 2008-03-15 00:59:54 -05:00
parent 21ced50797
commit 21db36412a
3 changed files with 64 additions and 18 deletions

View File

@ -86,8 +86,8 @@ widget_class Mixer_Strip {open
}
}
Fl_Box {} {
label Pan
xywh {6 693 110 90} box THIN_UP_BOX labelsize 11 align 1
label Pan selected
xywh {6 693 110 90} box THIN_UP_BOX color 32 labelsize 11 align 1
class Panner
}
Fl_Progress {} {
@ -97,7 +97,7 @@ widget_class Mixer_Strip {open
xywh {10 36 41 39} box OVAL_FRAME color 52 selection_color 55
class Fl_Arc_Dial
}
Fl_Dial {} {selected
Fl_Dial {} {
xywh {10 80 41 39} box OVAL_FRAME color 52 selection_color 55
class Fl_Arc_Dial
}

View File

@ -117,10 +117,19 @@ Panner::event_point ( void )
void
Panner::draw ( void )
{
// draw_box();
draw_box( FL_FLAT_BOX, x(), y(), w(), h(), FL_BLACK );
draw_box();
// draw_box( FL_FLAT_BOX, x(), y(), w(), h(), FL_BLACK );
draw_label();
if ( _bypassed )
{
fl_color( 0 );
fl_font( FL_HELVETICA, 12 );
fl_draw( "(bypass)", x(), y(), w(), h(), FL_ALIGN_CENTER );
return;
}
int tw, th, tx, ty;
bbox( tx, ty, tw, th );
@ -213,6 +222,21 @@ Panner::draw ( void )
fl_pop_clip();
}
/* return the current gain setting for the path in/out */
float
Panner::gain ( int ich, int och )
{
int a = _configs[ _outs ][ och ];
// float g = 1.0f - drag->distance( Point( 1.0f, a ) ) / 2.0f;
float g = _points[ ich ].distance( Point( 1.0f, a ) ) / 2.0f;
/* g = 1.0f / pow( g, 2 ); */
/* g = 20.0f * log10f( g ); */
return g;
}
int
Panner::handle ( int m )
@ -223,11 +247,15 @@ Panner::handle ( int m )
{
case FL_PUSH:
if ( ( drag = event_point() ) )
if ( Fl::event_button2() )
{
printf( "bing\n" );
return 1;
_bypassed = ! _bypassed;
redraw();
return 0;
}
else if ( Fl::event_button1() && ( drag = event_point() ) )
return 1;
else
return 0;
case FL_RELEASE:
@ -241,12 +269,16 @@ Panner::handle ( int m )
int tx, ty, tw, th;
bbox( tx, ty, tw, th );
drag->angle( (float)(X / (tw / 2)) - 1.0f, (float)(Y / (th / 2)) - 1.0f );
if ( _outs < 3 )
drag->angle( (float)(X / (tw / 2)) - 1.0f, 0.0f );
else
drag->angle( (float)(X / (tw / 2)) - 1.0f, (float)(Y / (th / 2)) - 1.0f );
/* calculate gains for all output channels */
{
for ( int i = _ins; i--; )
{
int a = _configs[ _outs ][ i ];
// float g = 1.0f - drag->distance( Point( 1.0f, a ) ) / 2.0f;

View File

@ -102,6 +102,8 @@ class Panner : public Fl_Widget
int _ins,
_outs;
bool _bypassed;
vector <Point> _points;
static int pw ( void ) { return 12; }
@ -133,25 +135,37 @@ class Panner : public Fl_Widget
RR = 135,
};
protected:
virtual void draw ( void );
virtual int handle ( int );
public:
Panner ( int X, int Y, int W, int H, const char *L = 0 ) :
Fl_Widget( X, Y, W, H, L )
{
_ins = _outs = 4;
_points.push_back( Point( 1, FL ) );
_points.push_back( Point( 1, FR ) );
_points.push_back( Point( 1, RL ) );
_points.push_back( Point( 1, RR ) );
_bypassed = false;
_ins = 1;
_outs = 7;
// _ins = _outs = 4;
_points.push_back( Point( 1, FL ) );
/* _points.push_back( Point( 1, FR ) ); */
/* _points.push_back( Point( 1, RL ) ); */
/* _points.push_back( Point( 1, RR ) ); */
_outs = 5;
}
virtual ~Panner ( ) { }
virtual void draw ( void );
virtual int handle ( int );
float gain ( int ich, int och );
};