MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ on_note()

HookId MayaFlux::Nodes::Input::MIDINode::on_note ( std::function< void(uint8_t note, uint8_t velocity, bool is_on)>  callback)
inline

Callback for note events with note number and velocity.

Parameters
callbackFunction receiving (note_number, velocity, is_note_on)

Definition at line 156 of file MIDINode.hpp.

157 {
158 return m_note_callbacks.add(
159 [this, callback](NodeContext&) {
160 if (!m_last_midi_message) {
161 return;
162 }
163 const auto& midi = *m_last_midi_message;
164 if (midi.type() == 0x90) {
165 callback(midi.data1, midi.data2, midi.data2 > 0);
166 } else {
167 callback(midi.data1, 0, false);
168 }
169 },
170 callback.target_type());
171 }
PickCallback callback
Definition Picker.cpp:22
HookId add(NodeHook hook, const std::type_info &key, uint8_t tag=0, std::array< double, 2 > params={})
Appends a hook with no duplicate check and returns its id.
std::optional< Core::InputValue::MIDIMessage > m_last_midi_message
Definition MIDINode.hpp:208

References callback.