|
Sound Byte Libs 0.5.1-340-gab5b79a
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
|
Routes MIDI CCs to app targets through a constexpr table. More...
Routes MIDI CCs to app targets through a constexpr table.
A constexpr table routes MIDI CCs: each row routes one controller on one channel to an app-defined target through a curve. Curves are LUTE cam tables (the same vocabulary as knob macros) or linear.
Dispatch is event-driven, inside the control tick's drain loop, after the app's CC store has taken the event - store before mapper. The store stays the only CC state: a Paired14 row reads the other half of its pair from it. Values are absolute; every matching row fires, so a CC with two rows fans out to two targets.
The sink is the app's write into the merge layer, e.g. pickups[param].hold(value). The mapper holds a pointer to the table, so the table must outlive the mapper.
Usage:
| Target | App-defined target type, usually a parameter enum |
Definition at line 85 of file cc_mapper.hpp.
#include <cc_mapper.hpp>
Public Types | |
| using | Sink = void(*)(void *context, Target target, float value) |
| The app's write into the merge layer: the context pointer, the row's target and the curve output. | |
Public Member Functions | |
| template<size_t N> | |
| CcMapper (const CcEntry< Target >(&table)[N], Sink sink, void *context) | |
| Construct over a table. | |
| template<typename Store > | |
| uint8_t | on_cc (uint8_t channel, uint8_t cc, uint8_t value, const Store &store) const |
| Route one ControlChange event. | |
| uint8_t | on_cc (uint8_t channel, uint8_t cc, uint8_t value) const |
| Route one ControlChange event through a map with no 14-bit rows. | |
| size_t | size () const |
| Rows in the map. | |
| const CcEntry< Target > * | begin () const |
| The first row, for a walk over them (an echo of the targets' values, a listing) | |
| const CcEntry< Target > * | end () const |
| One past the last row. | |
| using sbl::control::CcMapper< Target >::Sink = void (*)(void* context, Target target, float value) |
The app's write into the merge layer: the context pointer, the row's target and the curve output.
Definition at line 88 of file cc_mapper.hpp.
|
inline |
Construct over a table.
| table | The rows; the table must outlive the mapper |
| sink | Called once per matching row |
| context | Passed to sink unchanged |
Definition at line 97 of file cc_mapper.hpp.
|
inline |
Route one ControlChange event.
Call after store has taken the event.
| Store | Provides float cc(uint8_t number) const in [0, 1] |
| channel | MIDI channel, 0 to 15 |
| cc | Controller number, 0 to 127 |
| value | Controller value, 0 to 127 |
| store | The app's CC store; supplies the other half of a 14-bit pair |
Definition at line 113 of file cc_mapper.hpp.
References sbl::control::ANY_CHANNEL, sbl::control::cam_evaluate(), sbl::control::CcEntry< Target >::cc, sbl::control::CcEntry< Target >::channel, sbl::control::CcEntry< Target >::curve, sbl::control::CcEntry< Target >::flags, sbl::control::Paired14, sbl::control::CcEntry< Target >::target, and sbl::midi::to_7bit().
|
inline |
Route one ControlChange event through a map with no 14-bit rows.
| channel | MIDI channel, 0 to 15 |
| cc | Controller number, 0 to 127 |
| value | Controller value, 0 to 127 |
Definition at line 151 of file cc_mapper.hpp.
References sbl::control::CcMapper< Target >::on_cc().
Referenced by sbl::control::CcMapper< Target >::on_cc().
|
inline |
Rows in the map.
Definition at line 154 of file cc_mapper.hpp.
|
inline |
The first row, for a walk over them (an echo of the targets' values, a listing)
Definition at line 157 of file cc_mapper.hpp.
|
inline |
One past the last row.
Definition at line 159 of file cc_mapper.hpp.