diff --git a/src/avtk/avtk_dial.h b/src/avtk/avtk_dial.h index 62da557..cd7bd09 100644 --- a/src/avtk/avtk_dial.h +++ b/src/avtk/avtk_dial.h @@ -20,6 +20,7 @@ #ifndef AVTK_DIAL_H #define AVTK_DIAL_H +#include #include #include @@ -29,8 +30,8 @@ namespace Avtk class Dial : public Fl_Slider { public: - Dial(int _x, int _y, int _w, int _h, const char* _label=0): - Fl_Slider(_x, _y, _w, _h, _label) + Dial(int _x, int _y, int _w, int _h, const char* _lab=0): + Fl_Slider(_x, _y, _w, _h, _lab) { x = _x; y = _y; @@ -43,12 +44,18 @@ class Dial : public Fl_Slider mouseClicked = false; highlight = false; - label = _label; + _label = strdup( _lab ); + } + + ~Dial() + { + if( _label ) + free( _label ); } bool highlight; int x, y, w, h; - const char* label; + char* _label; float radius; float lineWidth; @@ -58,6 +65,17 @@ class Dial : public Fl_Slider bool drawLabel; + void setLabel( const char* newLabel ) + { + if( _label ) + free( _label ); + + _label = strdup( newLabel ); + + label( _label ); + redraw(); + } + void draw() { if (damage() & FL_DAMAGE_ALL) diff --git a/src/gmastertrack.cxx b/src/gmastertrack.cxx index 5c77682..05ad1dd 100644 --- a/src/gmastertrack.cxx +++ b/src/gmastertrack.cxx @@ -106,7 +106,6 @@ static void gmastertrack_mixVol_callback(Fl_Widget *w, void *data) float v = b->value(); EventMasterInputTo e = EventMasterInputTo( INPUT_TO_MIX, v ); writeToDspRingbuffer( &e ); - //printf("MIX dial\n"); } static void gmastertrack_transport_callback(Fl_Widget *w, void *data) @@ -278,6 +277,9 @@ void GMasterTrack::setBpm( int b ) { bpm = b; tempoDial.value( ( bpm - 60 ) / 160.f ); + std::stringstream s; + s << bpm; + tempoDial.setLabel( s.str().c_str() ); } void GMasterTrack::setInputVol(float f)