|
Sound Byte Libs 0.5.1-121-g3358a44
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
|
Definition at line 56 of file sequencer.hpp.
#include <sequencer.hpp>
Public Types | |
| using | Sink = void(*)(void *context, uint8_t output, const MidiEvent &event) |
Public Member Functions | |
| Sequencer (Sink sink, void *context) | |
| void | set_sample_rate (uint32_t hz) |
| Natural units, before start(): the rate advance() counts in. | |
| bool | load (const SmfReader &smf) |
| Take a parsed file and apply the default map. Stops playback. | |
| void | set_track_output (uint8_t track, uint8_t output) |
| Format 1: which output a track plays into (NO_OUTPUT for none). | |
| void | set_channel_output (uint8_t channel, uint8_t output) |
| Format 0: which output a channel plays into (NO_OUTPUT for none). | |
| void | set_output_channel (uint8_t output, uint8_t channel) |
| Send every event on an output on this channel (KEEP_CHANNEL to leave them). | |
| void | set_loop (bool on) |
| bool | looping () const |
| void | start () |
| Start: play from the top with every output reset. | |
| void | stop () |
| Stop: hold the playhead, silence the outputs. | |
| void | resume () |
| Continue: play on from the playhead. Nothing to continue after the end. | |
| bool | playing () const |
| bool | finished () const |
| bool | loaded () const |
| uint64_t | position_us () const |
| Where the playhead is in the song, in microseconds from the top. | |
| void | advance (uint32_t elapsed_samples) |
Let elapsed_samples pass: emit every event that falls due. | |
Static Public Attributes | |
| static constexpr uint8_t | OUTPUTS = Outputs |
| static constexpr uint8_t | MAX_TRACKS = SmfReader::MAX_TRACKS |
| static constexpr uint8_t | CHANNELS = 16 |
| static constexpr uint8_t | NO_OUTPUT = 0xFF |
| static constexpr uint8_t | KEEP_CHANNEL = 0xFF |
| static constexpr uint8_t | MAX_SNAPSHOT = 64 |
| distinct (output, channel, controller) first values | |
| static constexpr uint32_t | DEFAULT_TEMPO_US = 500000 |
| 120 bpm: the SMF default | |
| static constexpr uint32_t | DEFAULT_SAMPLE_RATE = 48000 |
| static constexpr uint8_t | ALL_NOTES_OFF = 123 |
| using sbl::midi::Sequencer< Outputs >::Sink = void (*)(void* context, uint8_t output, const MidiEvent& event) |
Definition at line 70 of file sequencer.hpp.
|
inline |
Definition at line 72 of file sequencer.hpp.
References sbl::midi::Sequencer< Outputs >::KEEP_CHANNEL.
|
inline |
Natural units, before start(): the rate advance() counts in.
Definition at line 77 of file sequencer.hpp.
References sbl::midi::Sequencer< Outputs >::DEFAULT_SAMPLE_RATE.
|
inline |
Take a parsed file and apply the default map. Stops playback.
Definition at line 80 of file sequencer.hpp.
References sbl::midi::Sequencer< Outputs >::CHANNELS, sbl::midi::SmfReader::error(), sbl::midi::SmfReader::format(), sbl::midi::Sequencer< Outputs >::MAX_TRACKS, sbl::midi::Sequencer< Outputs >::NO_OUTPUT, sbl::midi::None, sbl::midi::SmfReader::ticks_per_quarter(), sbl::midi::SmfReader::track(), and sbl::midi::SmfReader::track_count().
|
inline |
Format 1: which output a track plays into (NO_OUTPUT for none).
Definition at line 99 of file sequencer.hpp.
References sbl::midi::Sequencer< Outputs >::MAX_TRACKS, and sbl::midi::Sequencer< Outputs >::NO_OUTPUT.
|
inline |
Format 0: which output a channel plays into (NO_OUTPUT for none).
Definition at line 106 of file sequencer.hpp.
References sbl::midi::Sequencer< Outputs >::CHANNELS, and sbl::midi::Sequencer< Outputs >::NO_OUTPUT.
|
inline |
Send every event on an output on this channel (KEEP_CHANNEL to leave them).
Definition at line 113 of file sequencer.hpp.
References sbl::midi::Sequencer< Outputs >::CHANNELS, and sbl::midi::Sequencer< Outputs >::KEEP_CHANNEL.
|
inline |
Definition at line 119 of file sequencer.hpp.
|
inline |
Definition at line 120 of file sequencer.hpp.
|
inline |
Start: play from the top with every output reset.
Definition at line 125 of file sequencer.hpp.
|
inline |
Stop: hold the playhead, silence the outputs.
Definition at line 139 of file sequencer.hpp.
|
inline |
Continue: play on from the playhead. Nothing to continue after the end.
Definition at line 146 of file sequencer.hpp.
|
inline |
Definition at line 150 of file sequencer.hpp.
|
inline |
Definition at line 151 of file sequencer.hpp.
|
inline |
Definition at line 152 of file sequencer.hpp.
|
inline |
Where the playhead is in the song, in microseconds from the top.
Definition at line 155 of file sequencer.hpp.
|
inline |
Let elapsed_samples pass: emit every event that falls due.
Time counts while stopped too, so a resume picks up at the playhead without replaying the pause.
Definition at line 163 of file sequencer.hpp.
References sbl::midi::SmfEvent::Channel, sbl::midi::SmfEvent::kind, sbl::midi::SmfEvent::midi, sbl::midi::SmfTrack::peek(), sbl::midi::SmfTrack::pop(), sbl::midi::SmfEvent::Tempo, sbl::midi::SmfEvent::tempo_us, and sbl::midi::SmfEvent::tick.
|
staticconstexpr |
Definition at line 60 of file sequencer.hpp.
|
staticconstexpr |
Definition at line 61 of file sequencer.hpp.
Referenced by sbl::midi::Sequencer< Outputs >::load(), and sbl::midi::Sequencer< Outputs >::set_track_output().
|
staticconstexpr |
Definition at line 62 of file sequencer.hpp.
Referenced by sbl::midi::Sequencer< Outputs >::load(), sbl::midi::Sequencer< Outputs >::set_channel_output(), and sbl::midi::Sequencer< Outputs >::set_output_channel().
|
staticconstexpr |
Definition at line 63 of file sequencer.hpp.
Referenced by sbl::midi::Sequencer< Outputs >::load(), sbl::midi::Sequencer< Outputs >::set_channel_output(), and sbl::midi::Sequencer< Outputs >::set_track_output().
|
staticconstexpr |
Definition at line 64 of file sequencer.hpp.
Referenced by sbl::midi::Sequencer< Outputs >::Sequencer(), and sbl::midi::Sequencer< Outputs >::set_output_channel().
|
staticconstexpr |
distinct (output, channel, controller) first values
Definition at line 65 of file sequencer.hpp.
|
staticconstexpr |
120 bpm: the SMF default
Definition at line 66 of file sequencer.hpp.
|
staticconstexpr |
Definition at line 67 of file sequencer.hpp.
Referenced by sbl::midi::Sequencer< Outputs >::set_sample_rate().
|
staticconstexpr |
Definition at line 68 of file sequencer.hpp.