-BPM dial has label (#93), shows BPM as number

This commit is contained in:
Harry van Haaren 2014-09-13 00:20:47 +01:00
parent 868dfe0dd3
commit 68bbfdb26d
2 changed files with 25 additions and 5 deletions

View file

@ -20,6 +20,7 @@
#ifndef AVTK_DIAL_H #ifndef AVTK_DIAL_H
#define AVTK_DIAL_H #define AVTK_DIAL_H
#include <stdio.h>
#include <FL/Fl_Dial.H> #include <FL/Fl_Dial.H>
#include <FL/Fl_Slider.H> #include <FL/Fl_Slider.H>
@ -29,8 +30,8 @@ namespace Avtk
class Dial : public Fl_Slider class Dial : public Fl_Slider
{ {
public: public:
Dial(int _x, int _y, int _w, int _h, const char* _label=0): Dial(int _x, int _y, int _w, int _h, const char* _lab=0):
Fl_Slider(_x, _y, _w, _h, _label) Fl_Slider(_x, _y, _w, _h, _lab)
{ {
x = _x; x = _x;
y = _y; y = _y;
@ -43,12 +44,18 @@ class Dial : public Fl_Slider
mouseClicked = false; mouseClicked = false;
highlight = false; highlight = false;
label = _label; _label = strdup( _lab );
}
~Dial()
{
if( _label )
free( _label );
} }
bool highlight; bool highlight;
int x, y, w, h; int x, y, w, h;
const char* label; char* _label;
float radius; float radius;
float lineWidth; float lineWidth;
@ -58,6 +65,17 @@ class Dial : public Fl_Slider
bool drawLabel; bool drawLabel;
void setLabel( const char* newLabel )
{
if( _label )
free( _label );
_label = strdup( newLabel );
label( _label );
redraw();
}
void draw() void draw()
{ {
if (damage() & FL_DAMAGE_ALL) if (damage() & FL_DAMAGE_ALL)

View file

@ -106,7 +106,6 @@ static void gmastertrack_mixVol_callback(Fl_Widget *w, void *data)
float v = b->value(); float v = b->value();
EventMasterInputTo e = EventMasterInputTo( INPUT_TO_MIX, v ); EventMasterInputTo e = EventMasterInputTo( INPUT_TO_MIX, v );
writeToDspRingbuffer( &e ); writeToDspRingbuffer( &e );
//printf("MIX dial\n");
} }
static void gmastertrack_transport_callback(Fl_Widget *w, void *data) static void gmastertrack_transport_callback(Fl_Widget *w, void *data)
@ -278,6 +277,9 @@ void GMasterTrack::setBpm( int b )
{ {
bpm = b; bpm = b;
tempoDial.value( ( bpm - 60 ) / 160.f ); tempoDial.value( ( bpm - 60 ) / 160.f );
std::stringstream s;
s << bpm;
tempoDial.setLabel( s.str().c_str() );
} }
void GMasterTrack::setInputVol(float f) void GMasterTrack::setInputVol(float f)