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>
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 |
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 22 of file Metronome.h.
|
inline |
Constructor.
Declare a Metronome object.
delay_milliseconds | how long between each occasion when ready() returns true. |
Definition at line 31 of file Metronome.h.
|
inline |
Call this in updateControl() or updateAudio() to check if it is time for a beat.
Definition at line 75 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 40 of file Metronome.h.
|
inline |
Set the time between beats and start the metronome.
delay_milliseconds | delay time in milliseconds. |
Definition at line 51 of file Metronome.h.