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
Harry van Haaren 2018-07-20 23:56:15 +01:00
parent 5533a99913
commit e3491dbe5f
1 changed files with 10 additions and 0 deletions

View File

@ -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;
}