Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::midi::ChordMemory< MaximumActiveTriggers > Class Template Reference

Bounded chord memory: capture a chord once, then play it from single notes. More...

#include <chord_memory.hpp>

Public Member Functions

 ChordMemory (ChordMemorySpec spec={}) noexcept
bool valid () const noexcept
ChordMemorySpec spec () const noexcept
bool memory_empty () const noexcept
 True while nothing is captured, which is the kernel's declared bypass identity: every event passes through byte for byte.
bool learn (std::span< const std::uint8_t > notes) noexcept
 Capture notes as an interval shape relative to its own lowest note.
bool learn_for (std::uint8_t trigger, std::span< const std::uint8_t > notes) noexcept
 Capture notes as the shape trigger's pitch class plays.
void clear_memory () noexcept
std::size_t chord_for (std::uint8_t trigger, std::array< std::uint8_t, kMaxChordNotes > &out) const noexcept
 The chord trigger produces, written into out.
MidiUtilityProcessReport process (const MidiBuffer &input, MidiBuffer &output) noexcept
MidiUtilityProcessReport flush (MidiBuffer &output) noexcept
 Release every note the kernel owns.
MidiUtilityProcessReport reset (MidiBuffer &output) noexcept
MidiUtilityProcessReport replace_spec (ChordMemorySpec spec, MidiBuffer &output) noexcept
 Swap the spec.
bool empty () const noexcept

Static Public Member Functions

static constexpr MidiUtilityContract contract () noexcept
static constexpr bool valid_spec (ChordMemorySpec spec) noexcept

Static Public Attributes

static constexpr std::size_t kMaxChordNotes = music::ChordFormula::kMaxNotes

Detailed Description

template<std::size_t MaximumActiveTriggers = 16>
class pulp::midi::ChordMemory< MaximumActiveTriggers >

Bounded chord memory: capture a chord once, then play it from single notes.

Memory holds interval shapes, never absolute pitches, so a captured chord is meaningful at every trigger. With nothing captured the kernel is exact passthrough, which is its declared identity.

Constructor & Destructor Documentation

◆ ChordMemory()

template<std::size_t MaximumActiveTriggers = 16>
pulp::midi::ChordMemory< MaximumActiveTriggers >::ChordMemory ( ChordMemorySpec spec = {})
inlineexplicitnoexcept

Member Function Documentation

◆ chord_for()

template<std::size_t MaximumActiveTriggers = 16>
std::size_t pulp::midi::ChordMemory< MaximumActiveTriggers >::chord_for ( std::uint8_t trigger,
std::array< std::uint8_t, kMaxChordNotes > & out ) const
inlinenoexcept

The chord trigger produces, written into out.

Returns the note count, or 0 when nothing is captured for that trigger. Pure: it reads memory and the spec but no per-block state, so a test or a UI can predict the chord without pushing events through the kernel.

◆ clear_memory()

template<std::size_t MaximumActiveTriggers = 16>
void pulp::midi::ChordMemory< MaximumActiveTriggers >::clear_memory ( )
inlinenoexcept

◆ contract()

template<std::size_t MaximumActiveTriggers = 16>
constexpr MidiUtilityContract pulp::midi::ChordMemory< MaximumActiveTriggers >::contract ( )
inlinestaticconstexprnoexcept

◆ empty()

template<std::size_t MaximumActiveTriggers = 16>
bool pulp::midi::ChordMemory< MaximumActiveTriggers >::empty ( ) const
inlinenoexcept

◆ flush()

template<std::size_t MaximumActiveTriggers = 16>
MidiUtilityProcessReport pulp::midi::ChordMemory< MaximumActiveTriggers >::flush ( MidiBuffer & output)
inlinenoexcept

Release every note the kernel owns.

◆ learn()

template<std::size_t MaximumActiveTriggers = 16>
bool pulp::midi::ChordMemory< MaximumActiveTriggers >::learn ( std::span< const std::uint8_t > notes)
inlinenoexcept

Capture notes as an interval shape relative to its own lowest note.

Control-thread work: it validates and stores, and never emits.

◆ learn_for()

template<std::size_t MaximumActiveTriggers = 16>
bool pulp::midi::ChordMemory< MaximumActiveTriggers >::learn_for ( std::uint8_t trigger,
std::span< const std::uint8_t > notes )
inlinenoexcept

Capture notes as the shape trigger's pitch class plays.

Only meaningful in PerKey mode.

◆ memory_empty()

template<std::size_t MaximumActiveTriggers = 16>
bool pulp::midi::ChordMemory< MaximumActiveTriggers >::memory_empty ( ) const
inlinenoexcept

True while nothing is captured, which is the kernel's declared bypass identity: every event passes through byte for byte.

◆ process()

template<std::size_t MaximumActiveTriggers = 16>
MidiUtilityProcessReport pulp::midi::ChordMemory< MaximumActiveTriggers >::process ( const MidiBuffer & input,
MidiBuffer & output )
inlinenoexcept

◆ replace_spec()

template<std::size_t MaximumActiveTriggers = 16>
MidiUtilityProcessReport pulp::midi::ChordMemory< MaximumActiveTriggers >::replace_spec ( ChordMemorySpec spec,
MidiBuffer & output )
inlinenoexcept

Swap the spec.

Applied only once every owned note has been released, so a mode change can never orphan a sounding chord.

◆ reset()

template<std::size_t MaximumActiveTriggers = 16>
MidiUtilityProcessReport pulp::midi::ChordMemory< MaximumActiveTriggers >::reset ( MidiBuffer & output)
inlinenoexcept

◆ spec()

template<std::size_t MaximumActiveTriggers = 16>
ChordMemorySpec pulp::midi::ChordMemory< MaximumActiveTriggers >::spec ( ) const
inlinenoexcept

◆ valid()

template<std::size_t MaximumActiveTriggers = 16>
bool pulp::midi::ChordMemory< MaximumActiveTriggers >::valid ( ) const
inlinenoexcept

◆ valid_spec()

template<std::size_t MaximumActiveTriggers = 16>
constexpr bool pulp::midi::ChordMemory< MaximumActiveTriggers >::valid_spec ( ChordMemorySpec spec)
inlinestaticconstexprnoexcept

Member Data Documentation

◆ kMaxChordNotes

template<std::size_t MaximumActiveTriggers = 16>
std::size_t pulp::midi::ChordMemory< MaximumActiveTriggers >::kMaxChordNotes = music::ChordFormula::kMaxNotes
staticconstexpr

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