A metronome class which is like an EventDelay which retriggers itself when the delay time is up, to produce a repeating beat. More...
#include <Metronome.h>
A metronome class which is like an EventDelay which retriggers itself when the delay time is up, to produce a repeating beat.
Metronome can be set() to a number of milliseconds, then after calling start(), ready() will return true when the time is up.
Alternatively, start(milliseconds) will call set() and start() together. This is called Metronome to avoid conflict with the Arduino Metro library.
Definition at line 23 of file Metronome.h.
Public Member Functions | |
Metronome (unsigned int delay_milliseconds=0) | |
Constructor. More... | |
void | start () |
Start the metronome. More... | |
void | start (unsigned int delay_milliseconds) |
Set the time between beats and start the metronome. More... | |
void | setBPM (float bpm) |
Set the beats per minute. More... | |
bool | ready () |
Call this in updateControl() or updateAudio() to check if it is time for a beat. More... | |
void | stop () |
void | set (unsigned int delay_milliseconds) |
Set the delay time. More... | |
Protected Attributes | |
unsigned long | deadline |
unsigned long | ticks |
|
inline |
Constructor.
Declare a Metronome object.
delay_milliseconds | how long between each occasion when ready() returns true. |
Definition at line 32 of file Metronome.h.
|
inline |
Call this in updateControl() or updateAudio() to check if it is time for a beat.
Definition at line 76 of file Metronome.h.
|
inlineinherited |
Set the delay time.
This setting is persistent, until you change it by using set() again.
delay_milliseconds | delay time in milliseconds. |
Definition at line 40 of file EventDelay.h.
|
inline |
|
inline |
Start the metronome.
Definition at line 41 of file Metronome.h.
|
inline |
Set the time between beats and start the metronome.
delay_milliseconds | delay time in milliseconds. |
Definition at line 52 of file Metronome.h.