From 21db36412aec2cc59cbddb12cf9e0d8935ba2d66 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Sat, 15 Mar 2008 00:59:54 -0500 Subject: [PATCH] Cosmetic panner changes. --- Mixer_Strip.fl | 6 +++--- Panner.C | 44 ++++++++++++++++++++++++++++++++++++++------ Panner.H | 30 ++++++++++++++++++++++-------- 3 files changed, 63 insertions(+), 17 deletions(-) diff --git a/Mixer_Strip.fl b/Mixer_Strip.fl index 9ea1544..eb1f344 100644 --- a/Mixer_Strip.fl +++ b/Mixer_Strip.fl @@ -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 } diff --git a/Panner.C b/Panner.C index 55f64cb..b39859c 100644 --- a/Panner.C +++ b/Panner.C @@ -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; diff --git a/Panner.H b/Panner.H index df166b0..8afcf1b 100644 --- a/Panner.H +++ b/Panner.H @@ -102,6 +102,8 @@ class Panner : public Fl_Widget int _ins, _outs; + bool _bypassed; + vector _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; + _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; +/* _points.push_back( Point( 1, FR ) ); */ +/* _points.push_back( Point( 1, RL ) ); */ +/* _points.push_back( Point( 1, RR ) ); */ + + } virtual ~Panner ( ) { } - virtual void draw ( void ); - virtual int handle ( int ); - + float gain ( int ich, int och ); };