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

pull/51/head
doctea 1 month 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() void uClockClass::pause()
{ {
if (mode == INTERNAL_CLOCK) { if (mode == INTERNAL_CLOCK) {
if (state == PAUSED) { if (state == PAUSED) {
start(); continue_playing();
} else { } else {
stop(); state = PAUSED;
} }
} }
} }

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

Loading…
Cancel
Save