Browse Source

Cosmetic panner changes.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
21db36412a
3 changed files with 63 additions and 17 deletions
  1. +3
    -3
      Mixer_Strip.fl
  2. +38
    -6
      Panner.C
  3. +22
    -8
      Panner.H

+ 3
- 3
Mixer_Strip.fl View File

@@ -86,8 +86,8 @@ widget_class Mixer_Strip {open
} }
} }
Fl_Box {} { 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 class Panner
} }
Fl_Progress {} { Fl_Progress {} {
@@ -97,7 +97,7 @@ widget_class Mixer_Strip {open
xywh {10 36 41 39} box OVAL_FRAME color 52 selection_color 55 xywh {10 36 41 39} box OVAL_FRAME color 52 selection_color 55
class Fl_Arc_Dial class Fl_Arc_Dial
} }
Fl_Dial {} {selected
Fl_Dial {} {
xywh {10 80 41 39} box OVAL_FRAME color 52 selection_color 55 xywh {10 80 41 39} box OVAL_FRAME color 52 selection_color 55
class Fl_Arc_Dial class Fl_Arc_Dial
} }


+ 38
- 6
Panner.C View File

@@ -117,10 +117,19 @@ Panner::event_point ( void )
void void
Panner::draw ( 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(); 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; int tw, th, tx, ty;


bbox( tx, ty, tw, th ); bbox( tx, ty, tw, th );
@@ -213,6 +222,21 @@ Panner::draw ( void )
fl_pop_clip(); 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 int
Panner::handle ( int m ) Panner::handle ( int m )
@@ -223,11 +247,15 @@ Panner::handle ( int m )
{ {


case FL_PUSH: 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 else
return 0; return 0;
case FL_RELEASE: case FL_RELEASE:
@@ -241,12 +269,16 @@ Panner::handle ( int m )
int tx, ty, tw, th; int tx, ty, tw, th;
bbox( 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 */ /* calculate gains for all output channels */
{ {
for ( int i = _ins; i--; ) for ( int i = _ins; i--; )
{ {

int a = _configs[ _outs ][ i ]; int a = _configs[ _outs ][ i ];


// float g = 1.0f - drag->distance( Point( 1.0f, a ) ) / 2.0f; // float g = 1.0f - drag->distance( Point( 1.0f, a ) ) / 2.0f;


+ 22
- 8
Panner.H View File

@@ -102,6 +102,8 @@ class Panner : public Fl_Widget
int _ins, int _ins,
_outs; _outs;


bool _bypassed;

vector <Point> _points; vector <Point> _points;


static int pw ( void ) { return 12; } static int pw ( void ) { return 12; }
@@ -133,25 +135,37 @@ class Panner : public Fl_Widget
RR = 135, RR = 135,
}; };



protected:

virtual void draw ( void );
virtual int handle ( int );

public: public:




Panner ( int X, int Y, int W, int H, const char *L = 0 ) : Panner ( int X, int Y, int W, int H, const char *L = 0 ) :
Fl_Widget( X, Y, W, H, L ) 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, 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 ~Panner ( ) { }


virtual void draw ( void );
virtual int handle ( int );

float gain ( int ich, int och );


}; };

Loading…
Cancel
Save