Work on VU meter and mixer strip.

This commit is contained in:
Jonathan Moore Liles 2008-03-11 22:07:41 -05:00
parent 481698caae
commit 39549d1113
3 changed files with 71 additions and 5 deletions

56
Mixer_Strip.fl Normal file
View File

@ -0,0 +1,56 @@
# data file for the Fltk User Interface Designer (fluid)
version 1.0108
header_name {.H}
code_name {.C}
decl {\#include "VU_Meter.H"} {}
widget_class Mixer_Strip {open
xywh {1051 42 124 816} type Double box UP_FRAME color 32 selection_color 63 resizable
code0 {size( 120, h() );} visible
} {
Fl_Box {} {
label {<track name>}
xywh {7 7 110 19} box RSHADOW_BOX color 95 labelcolor 32
}
Fl_Box {} {
label {<Oscilloscope>}
xywh {7 33 110 104} box UP_FRAME
}
Fl_Group {} {open
xywh {7 143 110 25}
} {
Fl_Button {} {
label {@circle}
private xywh {7 143 35 25} type Toggle
}
Fl_Button {} {
label m
private xywh {46 143 32 25} type Toggle
}
Fl_Button {} {
label s
private xywh {82 143 35 25} type Toggle
}
}
Fl_Group {} {open
xywh {13 178 104 509} resizable
} {
Fl_Value_Slider {} {
label Gain
callback {// parent()->parent()->damage( FL_DAMAGE_ALL, x(), y(), w(), h() );}
xywh {14 195 33 471} type {Vert Knob} color 32 selection_color 1 minimum 1.5 maximum 0 step 0.01 value 1 textsize 14
}
Fl_Box {} {
label VU selected
xywh {57 193 55 484} box ROUNDED_BOX selection_color 88
class VU_Meter
}
}
Fl_Box {} {
label {<Panner>}
xywh {6 693 110 90} box UP_FRAME
}
Fl_Progress {} {
xywh {8 789 110 21} labeltype NO_LABEL
}
}

View File

@ -36,21 +36,21 @@ VU_Meter::VU_Meter ( int X, int Y, int W, int H, const char *L ) :
dim( 0.80f );
color( FL_GREEN );
selection_color( FL_RED );
min_color( FL_GREEN );
max_color( FL_RED );
box( FL_ROUNDED_BOX );
minimum( 0.0f );
maximum( 1.0f );
value( 0.4f );
value( 0.0f );
}
void
VU_Meter::draw ( void )
{
draw_box( FL_FLAT_BOX, x(), y(), w(), h(), FL_BLACK );
// draw_box( FL_FLAT_BOX, x(), y(), w(), h(), color() );
int v = (value() / maximum()) * _divisions;
@ -59,9 +59,10 @@ VU_Meter::draw ( void )
for ( int p = _divisions; p > 0; p-- )
{
Fl_Color c = fl_color_average( selection_color(), color(), (float)p / _divisions );
Fl_Color c = fl_color_average( _max_color, _min_color, (float)p / _divisions );
if ( p > v )
// c = fl_color_average( color(), c, _dim );
c = fl_color_average( FL_BLACK, c, _dim );
if ( ! active_r() )

View File

@ -32,6 +32,9 @@ class VU_Meter : public Fl_Widget
int _divisions;
float _dim;
Fl_Color _min_color;
Fl_Color _max_color;
protected:
virtual void draw ( void );
@ -59,4 +62,10 @@ public:
float dim ( void ) const { return _dim; }
void dim ( float v ) { _dim = v; redraw(); }
Fl_Color min_color ( void ) const { return _min_color; }
void min_color ( Fl_Color v ) { _min_color = v; }
Fl_Color max_color ( void ) const { return _max_color; }
void max_color ( Fl_Color v ) { _max_color = v; }
};