libmetro
metro::Metronome Class Reference

Metronome class. More...

#include <libmetro.h>

Public Member Functions

 Metronome (int bpm)
 Metronome constructor. More...
 
void add_measure (Measure &measure)
 add a measure More...
 
void start ()
 start the loop More...
 
void start_and_loop ()
 start the loop and block
 

Detailed Description

Metronome class.

Metronome is the main ticker of libmetro.

The flow of libmetro goes something like:

  1. Create a metronome with the desired quarter note bpm
  2. Create measures with notes
  3. Add the measures to the metronome
  4. Start and loop the metronome object

The metronome will take care of emitting the notes on your output device and cycling through the measures at every tick appropriately.

Constructor & Destructor Documentation

◆ Metronome()

metro::Metronome::Metronome ( int  bpm)

Metronome constructor.

Create a metronome with the given bpm.

Parameters
[in]bpmbpm to cycle through the measure

Member Function Documentation

◆ add_measure()

void metro::Metronome::add_measure ( Measure measure)

add a measure

Add a measure to the metronome which will be cycled through at a tempo set by the bpm param.

Parameters
[in]note_lengthnote length of the measure
[in]measuremeasure

◆ start()

void metro::Metronome::start ( )

start the loop

This method requires the user to block afterwards or else the code will exit. Useful if you want your own custom blocking logic e.g. waiting for user key presses.


The documentation for this class was generated from the following file: