Commit 68bbfdb2 authored by Harry van Haaren's avatar Harry van Haaren

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

parent 868dfe0d
......@@ -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)
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment