enable to pause clock and then continue playing from where we left off

pull/51/head
doctea 4 weeks ago
parent c336bdd7c3
commit 5dc12a7c1a
  1. 15
      src/uClock.cpp
  2. 1
      src/uClock.h

@ -183,13 +183,24 @@ void uClockClass::stop()
}
}
void uClockClass::continue_playing() {
if (state == PAUSED) {
start_timer = millis();
if (mode == INTERNAL_CLOCK) {
state = STARTED;
} else {
state = STARTING;
}
}
}
void uClockClass::pause()
{
if (mode == INTERNAL_CLOCK) {
if (state == PAUSED) {
start();
continue_playing();
} else {
stop();
state = PAUSED;
}
}
}

@ -127,6 +127,7 @@ class uClockClass {
void start();
void stop();
void pause();
void continue_playing();
void setTempo(float bpm);
float getTempo();

Loading…
Cancel
Save