-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
#define AVTK_DIAL_H
#include <stdio.h>
#include <FL/Fl_Dial.H>
#include <FL/Fl_Slider.H>
@ -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)

View file

@ -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)