6#include "dsp/chord_descriptor.h"
7#include "dsp/graph_node.h"
8#include "dsp/midi_event_buffer.h"
10#include <boost/container/static_vector.hpp>
11#include <farbot/RealtimeObject.hpp>
43 static constexpr midi_byte_t kDefaultVelocity = 100;
48 std::uint8_t velocity;
49 bool operator== (
const PitchEntry &)
const =
default;
109 struct ActiveChordEntry
120 void rebuild_active_pitches ();
122 static constexpr size_t kMaxActiveChords = 32;
129 boost::container::static_vector<ActiveChordEntry, kMaxActiveChords>
135 farbot::RealtimeObject<
137 farbot::RealtimeObjectOptions::nonRealtimeMutatable>
Realtime-safe chord audition state machine with polyphonic support.
void stopAll()
Stop all auditioning.
void process(MidiEventBuffer &out_events, const graph::ProcessBlockInfo &time_nfo) noexcept
Process audition state and generate MIDI events.
boost::container::static_vector< PitchEntry, 128 > ActivePitches
Merged pitch set shared between main and audio threads.
void stop(const ChordDescriptor &descriptor)
Stop auditioning a chord.
void stop(const ChordDescriptor::ChordPitches &pitches)
Stop auditioning by exact pitches.
void start(const ChordDescriptor &descriptor, midi_byte_t velocity=kDefaultVelocity)
Start auditioning a chord.
Describes a musical chord by its root note, type, accent, inversion, and optional bass note.
Packed contiguous buffer for RT MIDI events.
std::uint8_t midi_byte_t
MIDI byte.
Stack-allocated container for chord MIDI pitches.
Common struct to pass around during processing to avoid repeating the data in function arguments.