16 #include "EventDelay.h"
52 void start(
unsigned int delay_milliseconds)
54 set(delay_milliseconds);
66 set((
unsigned int) (60000.f/bpm));
79 if ((now<deadline) || stopped)
return false;
81 deadline=now-(now-deadline)+ticks;
A non-blocking replacement for Arduino's delay() function.
void set(unsigned int delay_milliseconds)
Set the delay time.
A metronome class which is like an EventDelay which retriggers itself when the delay time is up,...
Metronome(unsigned int delay_milliseconds=0)
Constructor.
void setBPM(float bpm)
Set the beats per minute.
void start()
Start the metronome.
void start(unsigned int delay_milliseconds)
Set the time between beats and start the metronome.
bool ready()
Call this in updateControl() or updateAudio() to check if it is time for a beat.
unsigned long audioTicks()
An alternative for Arduino time functions like micros() and millis().