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

◆ matches_filters()

bool MayaFlux::Nodes::Input::MIDINode::matches_filters ( const Core::InputValue value) const
private

Definition at line 63 of file MIDINode.cpp.

64{
65 const auto& midi = value.as_midi();
66
67 if (m_config.channel.has_value() && midi.channel() != m_config.channel.value()) {
68 return false;
69 }
70
71 if (m_config.message_type.has_value() && midi.type() != m_config.message_type.value()) {
72 return false;
73 }
74
75 uint8_t msg_type = midi.type();
76
77 if (m_config.note_number.has_value() && (msg_type == 0x90 || msg_type == 0x80)) {
78 if (midi.data1 != m_config.note_number.value()) {
79 return false;
80 }
81 }
82
83 if (m_config.cc_number.has_value() && msg_type == 0xB0) {
84 if (midi.data1 != m_config.cc_number.value()) {
85 return false;
86 }
87 }
88
89 return true;
90}
std::optional< uint8_t > channel
MIDI channel filter (0-15)
Definition MIDINode.hpp:11
std::optional< uint8_t > cc_number
CC number filter (0-127)
Definition MIDINode.hpp:13
std::optional< uint8_t > message_type
Message type filter (0x80-0xF0)
Definition MIDINode.hpp:14
std::optional< uint8_t > note_number
Note number filter (0-127)
Definition MIDINode.hpp:12

References MayaFlux::Core::InputValue::as_midi(), MayaFlux::Nodes::Input::MIDIConfig::cc_number, MayaFlux::Nodes::Input::MIDIConfig::channel, m_config, MayaFlux::Nodes::Input::MIDIConfig::message_type, MayaFlux::Nodes::Input::MIDIConfig::note_number, and MayaFlux::Core::InputValue::MIDIMessage::type().

Referenced by extract_value().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: