|
FabGL2 2.0.0
Graphics, audio, GUI and retro-computing library for the ESP32 (ESP-IDF)
|
A drum pattern: up to 32 steps (1/16 notes) for 16 instruments. More...
#include <drummachine.h>
Public Member Functions | |
| void | clear () |
| Removes all hits and sets the defaults: 16 steps, 120 BPM, no swing, no name. | |
| void | clearInstrument (int instrument) |
| Removes all hits of an instrument. | |
| void | clearSteps () |
| Removes all hits of all instruments. | |
| bool | empty () const |
| Determines whether the pattern has no hits. | |
| int | get (int step, int instrument) const |
| Gets the velocity of an instrument at a step. | |
| void | set (int step, int instrument, int velocity) |
| Sets the velocity of an instrument at a step. | |
| void | setName (char const *value) |
| Sets the name (truncated to NAME_LENGTH characters). | |
| void | setRow (int instrument, char const *text) |
| Sets the hits of an instrument from a text, one character per step. | |
Public Attributes | |
| uint8_t | length |
| char | name [NAME_LENGTH+1] |
| uint32_t | steps [MAX_STEPS] |
| uint8_t | swing |
| uint16_t | tempo |
Static Public Attributes | |
| static constexpr int | INSTRUMENTS = 16 |
| Number of instruments. | |
| static constexpr int | MAX_STEPS = 32 |
| Maximum number of steps. | |
| static constexpr int | NAME_LENGTH = 15 |
| Maximum name length (terminator not included). | |
A drum pattern: up to 32 steps (1/16 notes) for 16 instruments.
Each step stores the velocity of every instrument: 0 = no hit, 1 = soft, 2 = normal, 3 = accent (2 bits per instrument, a 32 bit word per step). A pattern also has its tempo, swing and name.
Factory patterns can be written as text, one string per instrument (see setRow()):
pattern.setRow(0, "X...x...X...x..."); // bass drum pattern.setRow(1, "....X.......X..."); // snare
Definition at line 209 of file drummachine.h.