Change internal representation of bpm to float
parent
335571ad17
commit
c60ec24db7
|
@ -77,7 +77,7 @@ public:
|
|||
virtual void trackJackSendActivate(int t, bool a) {}
|
||||
|
||||
/// Time
|
||||
virtual void bpm(int bpm) {}
|
||||
virtual void bpm(float bpm) {}
|
||||
virtual void tapTempo(bool b) {}
|
||||
|
||||
/// Special
|
||||
|
|
|
@ -130,7 +130,7 @@ void LupppGUI::tapTempo( bool b )
|
|||
writeToGuiRingbuffer( &e );
|
||||
}
|
||||
|
||||
void LupppGUI::bpm(int bpm)
|
||||
void LupppGUI::bpm(float bpm)
|
||||
{
|
||||
EventTimeBPM e(bpm);
|
||||
writeToGuiRingbuffer( &e );
|
||||
|
|
|
@ -48,7 +48,7 @@ public:
|
|||
virtual void trackJackSend(int t, float v);
|
||||
virtual void trackJackSendActivate(int t, bool a);
|
||||
|
||||
void bpm(int bpm);
|
||||
void bpm(float bpm);
|
||||
void tapTempo( bool b );
|
||||
|
||||
void specialScene(int t, int scene);
|
||||
|
|
|
@ -117,9 +117,9 @@ void AudioEditor::show( AudioBuffer* buf, bool modal )
|
|||
for( int i = 0; i < 7; i++ ) {
|
||||
int beat = beats[i];
|
||||
int fpb = size / beat;
|
||||
int bpm = (gui->samplerate / fpb) * 60;
|
||||
float bpm = (gui->samplerate / fpb) * 60;
|
||||
|
||||
if ( bpm < 60 || bpm > 220 ) {
|
||||
if ( bpm < MIN_TEMPO || bpm > MAX_TEMPO ) {
|
||||
// disable option: not valid
|
||||
beatButtons[i]->setGreyOut( true );
|
||||
beatButtons[i]->setColor( 0.4, 0.4, 0.4 );
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
static void gmastertrack_tempoDial_callback(Fl_Widget *w, void *data)
|
||||
{
|
||||
Avtk::Dial* b = (Avtk::Dial*)w;
|
||||
float bpm = (int)(b->value() * (float)(MAX_TEMPO - MIN_TEMPO) + MIN_TEMPO);
|
||||
float bpm = (b->value() * (float)(MAX_TEMPO - MIN_TEMPO) + MIN_TEMPO);
|
||||
if(std::fabs(bpm-round(bpm))) {
|
||||
LUPPP_WARN("%f",bpm);
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ static void gmastertrack_button_callback(Fl_Widget *w, void *data)
|
|||
if ( Fl::event_button() == FL_RIGHT_MOUSE ) {
|
||||
const char* answer = fl_input("Enter BPM value (range %d and %d):", 0, MIN_TEMPO, MAX_TEMPO);
|
||||
if(answer) {
|
||||
int bpm = atoi(answer);
|
||||
float bpm = atof(answer);
|
||||
|
||||
if ( bpm >= MIN_TEMPO && bpm <= MAX_TEMPO) {
|
||||
EventTimeBPM e = EventTimeBPM( bpm );
|
||||
|
@ -316,7 +316,7 @@ GMasterTrack::GMasterTrack(int x, int y, int w, int h, const char *l)
|
|||
end(); // close the group
|
||||
}
|
||||
|
||||
void GMasterTrack::setBpm( int b )
|
||||
void GMasterTrack::setBpm( float b )
|
||||
{
|
||||
bpm = b;
|
||||
if(!tempoDial.mouseClicked) {
|
||||
|
@ -324,7 +324,7 @@ void GMasterTrack::setBpm( int b )
|
|||
(bpm - MIN_TEMPO) / (float)(MAX_TEMPO - MIN_TEMPO));
|
||||
}
|
||||
std::stringstream s;
|
||||
s << bpm;
|
||||
s << round(bpm*10)/10;
|
||||
tempoDial.copy_label( s.str().c_str() );
|
||||
}
|
||||
|
||||
|
@ -381,7 +381,7 @@ GMasterTrack::setClipLength(int l)
|
|||
autoStopRecButton.copy_label(str);
|
||||
}
|
||||
|
||||
int GMasterTrack::getBpm()
|
||||
float GMasterTrack::getBpm()
|
||||
{
|
||||
return bpm;
|
||||
}
|
||||
|
|
|
@ -48,8 +48,8 @@ class GMasterTrack : public Fl_Group
|
|||
public:
|
||||
GMasterTrack(int x, int y, int w, int h, const char* l = 0 );
|
||||
|
||||
int getBpm();
|
||||
void setBpm( int bpm );
|
||||
float getBpm();
|
||||
void setBpm( float bpm );
|
||||
void setTapTempo( bool b );
|
||||
void setBarBeat(int b, int beat);
|
||||
|
||||
|
@ -81,7 +81,7 @@ private:
|
|||
char* title;
|
||||
|
||||
int bar;
|
||||
int bpm;
|
||||
float bpm;
|
||||
|
||||
Avtk::Background bg;
|
||||
|
||||
|
|
|
@ -89,8 +89,8 @@ void TimeManager::queueFpbChange( double f )
|
|||
float bpm = (samplerate * 60.f) / f;
|
||||
if(bpm < MIN_TEMPO || bpm > MAX_TEMPO) {
|
||||
char buffer[128];
|
||||
snprintf(buffer, sizeof(buffer), "drop TM::qfpb() %d bpm = %d",
|
||||
(int)f, (int)bpm);
|
||||
snprintf(buffer, sizeof(buffer), "drop TM::qfpb() %d bpm = %f",
|
||||
(int)f, bpm);
|
||||
EventGuiPrint e( buffer );
|
||||
writeToGuiRingbuffer( &e );
|
||||
return;
|
||||
|
@ -107,11 +107,11 @@ void TimeManager::setFpb(double f)
|
|||
beatFrameCountdown = beatFrameCountdown * ratio;
|
||||
|
||||
_fpb = f;
|
||||
int bpm = ( samplerate * 60) / f;
|
||||
float bpm = ( samplerate * 60) / f;
|
||||
|
||||
char buffer [50];
|
||||
snprintf(buffer, sizeof(buffer), "TM, setFpb() %i, bpm = %i",
|
||||
int(f), int(bpm) );
|
||||
snprintf(buffer, sizeof(buffer), "TM, setFpb() %i, bpm = %f",
|
||||
int(f), bpm );
|
||||
EventGuiPrint e( buffer );
|
||||
writeToGuiRingbuffer( &e );
|
||||
|
||||
|
@ -129,7 +129,7 @@ void TimeManager::registerObserver(TimeObserver* o)
|
|||
observers.push_back(o);
|
||||
o->setFpb( _fpb );
|
||||
|
||||
int bpm = ( samplerate * 60) / _fpb;
|
||||
float bpm = ( samplerate * 60) / _fpb;
|
||||
EventTimeBPM e2( bpm );
|
||||
writeToGuiRingbuffer( &e2 );
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ void TimeManager::process(Buffers* buffers)
|
|||
totalFrameCounter += nframes;
|
||||
|
||||
// write BPM / transport info to JACK
|
||||
int bpm = ( samplerate * 60) / _fpb;
|
||||
float bpm = ( samplerate * 60) / _fpb;
|
||||
if ( buffers->transportPosition ) {
|
||||
buffers->transportPosition->valid = (jack_position_bits_t)(JackPositionBBT | JackTransportPosition);
|
||||
|
||||
|
|
Loading…
Reference in New Issue