22#include "definitions_cxx.hpp"
23#include "io/midi/learned_midi.h"
24#include "playback/playback_handler.h"
35 void const* source_{
nullptr};
37 MIDISource() =
default;
38 ~MIDISource() =
default;
40 MIDISource(MIDICable
const* cable) : source_(cable) {};
41 MIDISource(MIDIInstrument
const* instrument) : source_(instrument) {};
42 MIDISource(PlaybackHandler
const* handler) : source_(handler) {};
43 MIDISource(MidiFollow
const* follow) : source_(follow) {};
44 MIDISource(MIDIDrum
const* drum) : source_(drum) {};
45 MIDISource(Sound
const* sound) : source_(sound) {};
47 MIDISource(MIDICable
const& cable) : source_(&cable) {};
48 MIDISource(MIDIInstrument
const& instrument) : source_(&instrument) {};
49 MIDISource(MIDIDrum
const& drum) : source_(&drum) {};
50 MIDISource(Sound
const& sound) : source_(&sound) {};
51 MIDISource(MidiFollow
const& follow) : source_(&follow) {};
52 MIDISource(PlaybackHandler
const& handler) : source_(&handler) {};
54 MIDISource(MIDISource
const& other) =
default;
55 MIDISource(MIDISource&& other) =
default;
57 MIDISource& operator=(MIDISource
const& other) =
default;
58 MIDISource& operator=(MIDISource&& other) =
default;
60 bool operator==(MIDISource
const& other)
const {
return source_ == other.source_; }
67 void sendNote(MIDISource source,
bool on, int32_t note, uint8_t velocity, uint8_t channel, int32_t filter);
68 void sendCC(MIDISource source, int32_t channel, int32_t cc, int32_t value, int32_t filter);
70 void sendMidi(MIDISource source, MIDIMessage message, int32_t filter = kMIDIOutputFilterNoMPE,
bool sendUSB =
true);
71 void sendClock(MIDISource source,
bool sendUSB =
true, int32_t howMany = 1);
72 void sendStart(MIDISource source);
73 void sendStop(MIDISource source);
74 void sendPositionPointer(MIDISource source, uint16_t positionPointer);
75 void sendContinue(MIDISource source);
77 void checkIncomingMidi();
79 void sendUsbMidi(MIDIMessage message, int32_t filter);
81 void sendPGMChange(MIDISource source, int32_t channel, int32_t pgm, int32_t filter);
82 void sendAllNotesOff(MIDISource source, int32_t channel, int32_t filter);
83 void sendBank(MIDISource source, int32_t channel, int32_t num, int32_t filter);
84 void sendSubBank(MIDISource source, int32_t channel, int32_t num, int32_t filter);
88 void sendPitchBend(MIDISource source, int32_t channel, uint16_t bend, int32_t filter);
89 void sendChannelAftertouch(MIDISource source, int32_t channel, uint8_t value, int32_t filter);
90 void sendPolyphonicAftertouch(MIDISource source, int32_t channel, uint8_t value, uint8_t noteCode, int32_t filter);
91 bool anythingInOutputBuffer();
94 LearnedMIDI globalMIDICommands[kNumGlobalMIDICommands];
97 LearnedMIDI midiFollowChannelType[kNumMIDIFollowChannelTypes];
98 MIDIFollowChannelType midiFollowFeedbackChannelType;
99 uint8_t midiFollowKitRootNote;
100 bool midiFollowDisplayParam;
101 MIDIFollowFeedbackAutomationMode midiFollowFeedbackAutomation;
102 bool midiFollowFeedbackFilter;
103 MIDITakeoverMode midiTakeover;
104 bool midiSelectKitRow;
108 uint8_t sysex_fmt_buffer[1024];
119 void midiMessageReceived(MIDICable& cable, uint8_t statusType, uint8_t channel, uint8_t data1, uint8_t data2,
120 uint32_t* timer =
nullptr);
127 void midiSysexReceived(MIDICable& cable, uint8_t* data, int32_t len);
130 uint8_t serialMidiInput[3];
131 uint8_t numSerialMidiInput;
133 bool currentlyReceivingSysExSerial;
135 using EventStackStorage = std::array<MIDISource, 16>;
138 EventStackStorage eventStack_;
140 EventStackStorage::iterator eventStackTop_;
143extern MidiEngine midiEngine;
A MIDI cable connection. Stores all state specific to a given cable and its contained ports and chann...
Definition midi_device.h:94
Definition midi_drum.h:22
Definition midi_instrument.h:37
Definition midi_follow.h:39
Definition playback_handler.h:54