20class MidiMapping :
public QObject
28 Q_DISABLE_COPY_MOVE (MidiMapping)
31 friend void init_from (
33 const MidiMapping &other,
36 void set_enabled (
bool enabled) {
enabled_.store (enabled); }
38 void apply (std::array<midi_byte_t, 3> buf);
41 static constexpr auto kKeyKey =
"key"sv;
42 static constexpr auto kDeviceIdKey =
"deviceIdentifier"sv;
43 static constexpr auto kDestIdKey =
"destId"sv;
44 static constexpr auto kEnabledKey =
"enabled"sv;
45 friend void to_json (nlohmann::json &j,
const MidiMapping &mapping);
46 friend void from_json (
const nlohmann::json &j, MidiMapping &mapping);
52 std::array<midi_byte_t, 3>
key_ = {};
62 std::optional<dsp::ProcessorParameterUuidReference>
dest_id_;
72class MidiMappings final
86 std::array<midi_byte_t, 3> buf,
87 std::optional<utils::Utf8String> device_id,
88 dsp::ProcessorParameterUuidReference dest_port,
98 void unbind (
int idx,
bool fire_events);
101 std::array<midi_byte_t, 3> buf,
102 std::optional<utils::Utf8String> device_id,
103 dsp::ProcessorParameterUuidReference dest_port,
107 buf, device_id, dest_port,
static_cast<int> (mappings_.size ()),
112 std::array<midi_byte_t, 3> buf,
113 dsp::ProcessorParameterUuidReference dest_port,
117 buf, std::nullopt, dest_port,
static_cast<int> (mappings_.size ()),
121 int get_mapping_index (
const MidiMapping &mapping)
const;
146 std::vector<MidiMapping *> * arr)
const;
148 friend void init_from (
150 const MidiMappings &other,
158 static constexpr auto kMappingsKey =
"mappings"sv;
159 friend void to_json (nlohmann::json &j,
const MidiMappings &mappings);
160 friend void from_json (
const nlohmann::json &j,
MidiMappings &mappings);
163 std::vector<std::unique_ptr<MidiMapping>> mappings_;
void bind_at(std::array< midi_byte_t, 3 > buf, std::optional< utils::Utf8String > device_id, dsp::ProcessorParameterUuidReference dest_port, int idx, bool fire_events)
Binds the CC represented by the given raw buffer (must be size 3) to the given Port.