Bounded note-retention kernel over a MIDI event stream. More...
#include <latch.hpp>
Public Member Functions | |
| constexpr | Latch (LatchSpec spec={}) noexcept |
| constexpr bool | valid () const noexcept |
| constexpr LatchSpec | spec () const noexcept |
| MidiUtilityProcessReport | process (const MidiBuffer &input, MidiBuffer &output) noexcept |
| MidiUtilityProcessReport | flush (MidiBuffer &output) noexcept |
| Release every note the latch still owns. | |
| MidiUtilityProcessReport | reset (MidiBuffer &output) noexcept |
| MidiUtilityProcessReport | replace_spec (LatchSpec spec, MidiBuffer &output) noexcept |
| Swap the retention mode. | |
| bool | empty () const noexcept |
| std::uint32_t | owned_depth (std::uint8_t channel, std::uint8_t note) const noexcept |
| Number of note-offs the latch still owes for channel/note. | |
Static Public Member Functions | |
| static constexpr MidiUtilityContract | contract () noexcept |
| static constexpr bool | valid_spec (LatchSpec spec) noexcept |
Static Public Attributes | |
| static constexpr std::size_t | kKeySpace = 16 * 128 |
Bounded note-retention kernel over a MIDI event stream.
The kernel owns every note it retains: a retained note-on is forwarded once and its authored note-off is swallowed, so the matching note-off is emitted later by the latch itself. Retention depth is counted per (channel, note) key, so repeated attacks on one key never leak or double-release. The key space is the whole 16x128 MIDI grid, so retention never overflows and the kernel needs no dynamic allocation on any path.
|
inlineexplicitconstexprnoexcept |
|
inlinestaticconstexprnoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Release every note the latch still owns.
Used on transport discontinuities and when the caller tears the kernel down.
|
inlinenoexcept |
Number of note-offs the latch still owes for channel/note.
|
inlinenoexcept |
|
inlinenoexcept |
Swap the retention mode.
The pending mode is applied only once every owned note has been released, so a mode change can never orphan a sounding note.
|
inlinenoexcept |
|
inlineconstexprnoexcept |
|
inlineconstexprnoexcept |
|
inlinestaticconstexprnoexcept |
|
staticconstexpr |