timemanager: error check tempos from "Use Tempo"
This commit adds a bpm conversion from the fpb to set the tempo to, and then limits the values to the range as set in config.hxx. A message is safely printed to the console when a message is dropped. Fixes #240. Signed-off-by: Harry van Haaren <harryhaaren@gmail.com>main
parent
5533a99913
commit
e3491dbe5f
|
@ -86,6 +86,16 @@ void TimeManager::queueBpmChangeZeroOne(float b)
|
|||
|
||||
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);
|
||||
EventGuiPrint e( buffer );
|
||||
writeToGuiRingbuffer( &e );
|
||||
return;
|
||||
}
|
||||
|
||||
_bpmChangeQueued = true;
|
||||
_nextFpb = f;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue