X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fevent_type_map.cc;h=708a52205f776056115f37e6ab885cd3b838ee75;hb=69b9ad6bccf95dbff9bf32f0f362c75d90918275;hp=f818b301728f498140175ca30522f9332311ee12;hpb=cf47d71761ec5b7539a4dce493e711387f442e43;p=ardour.git diff --git a/libs/ardour/event_type_map.cc b/libs/ardour/event_type_map.cc index f818b30172..708a52205f 100644 --- a/libs/ardour/event_type_map.cc +++ b/libs/ardour/event_type_map.cc @@ -24,7 +24,9 @@ #include "ardour/event_type_map.h" #include "ardour/parameter_descriptor.h" #include "ardour/parameter_types.h" +#ifdef LV2_SUPPORT #include "ardour/uri_map.h" +#endif #include "evoral/Parameter.hpp" #include "evoral/ParameterDescriptor.hpp" #include "evoral/midi_events.h" @@ -41,7 +43,11 @@ EventTypeMap& EventTypeMap::instance() { if (!EventTypeMap::event_type_map) { - EventTypeMap::event_type_map = new EventTypeMap(URIMap::instance()); +#ifdef LV2_SUPPORT + EventTypeMap::event_type_map = new EventTypeMap(&URIMap::instance()); +#else + EventTypeMap::event_type_map = new EventTypeMap(NULL); +#endif } return *EventTypeMap::event_type_map; } @@ -58,10 +64,10 @@ EventTypeMap::parameter_midi_type(const Evoral::Parameter& param) const return ARDOUR::parameter_midi_type((AutomationType)param.type()); } -uint32_t -EventTypeMap::midi_event_type(uint8_t status) const +Evoral::ParameterType +EventTypeMap::midi_parameter_type(const uint8_t* buf, uint32_t len) const { - return (uint32_t)ARDOUR::midi_parameter_type(status); + return (uint32_t)ARDOUR::midi_parameter_type(buf[0]); } Evoral::ControlList::InterpolationStyle @@ -111,6 +117,7 @@ EventTypeMap::interpolation_of(const Evoral::Parameter& param) break; case MidiPgmChangeAutomation: return Evoral::ControlList::Discrete; break; case MidiChannelPressureAutomation: return Evoral::ControlList::Linear; break; + case MidiNotePressureAutomation: return Evoral::ControlList::Linear; break; case MidiPitchBenderAutomation: return Evoral::ControlList::Linear; break; default: assert(false); } @@ -126,8 +133,14 @@ EventTypeMap::from_symbol(const string& str) const if (str == "gain") { p_type = GainAutomation; + } else if (str == "trim") { + p_type = TrimAutomation; } else if (str == "solo") { p_type = SoloAutomation; + } else if (str == "solo-iso") { + p_type = SoloIsolateAutomation; + } else if (str == "solo-safe") { + p_type = SoloSafeAutomation; } else if (str == "mute") { p_type = MuteAutomation; } else if (str == "fadein") { @@ -146,17 +159,29 @@ EventTypeMap::from_symbol(const string& str) const p_type = PanFrontBackAutomation; } else if (str == "pan-lfe") { p_type = PanLFEAutomation; + } else if (str == "rec-enable") { + p_type = RecEnableAutomation; + } else if (str == "rec-safe") { + p_type = RecSafeAutomation; + } else if (str == "phase") { + p_type = PhaseAutomation; + } else if (str == "monitor") { + p_type = MonitoringAutomation; + } else if (str == "pan-lfe") { + p_type = PanLFEAutomation; } else if (str.length() > 10 && str.substr(0, 10) == "parameter-") { p_type = PluginAutomation; p_id = atoi(str.c_str()+10); +#ifdef LV2_SUPPORT } else if (str.length() > 9 && str.substr(0, 9) == "property-") { p_type = PluginPropertyAutomation; const char* name = str.c_str() + 9; if (isdigit(str.c_str()[0])) { p_id = atoi(name); } else { - p_id = _uri_map.uri_to_id(name); + p_id = _uri_map->uri_to_id(name); } +#endif } else if (str.length() > 7 && str.substr(0, 7) == "midicc-") { p_type = MidiCCAutomation; uint32_t channel = 0; @@ -184,10 +209,17 @@ EventTypeMap::from_symbol(const string& str) const assert(channel < 16); p_id = 0; p_channel = channel; + } else if (str.length() > 19 && str.substr(0, 19) == "midi-note-pressure-") { + p_type = MidiNotePressureAutomation; + uint32_t channel = 0; + sscanf(str.c_str(), "midi-note-pressure-%d-%d", &channel, &p_id); + assert(channel < 16); + assert(p_id < 127); + p_channel = channel; } else { PBD::warning << "Unknown Parameter '" << str << "'" << endmsg; } - + return Evoral::Parameter(p_type, p_channel, p_id); } @@ -201,6 +233,8 @@ EventTypeMap::to_symbol(const Evoral::Parameter& param) const if (t == GainAutomation) { return "gain"; + } else if (t == TrimAutomation) { + return "trim"; } else if (t == PanAzimuthAutomation) { return "pan-azimuth"; } else if (t == PanElevationAutomation) { @@ -221,23 +255,39 @@ EventTypeMap::to_symbol(const Evoral::Parameter& param) const return "fadeout"; } else if (t == EnvelopeAutomation) { return "envelope"; + } else if (t == PhaseAutomation) { + return "phase"; + } else if (t == SoloIsolateAutomation) { + return "solo-iso"; + } else if (t == SoloSafeAutomation) { + return "solo-safe"; + } else if (t == MonitoringAutomation) { + return "monitor"; + } else if (t == RecEnableAutomation) { + return "rec-enable"; + } else if (t == RecSafeAutomation) { + return "rec-safe"; } else if (t == PluginAutomation) { - return string_compose("parameter-%1", param.id()); + return std::string("parameter-") + PBD::to_string(param.id()); +#ifdef LV2_SUPPORT } else if (t == PluginPropertyAutomation) { - const char* uri = _uri_map.id_to_uri(param.id()); + const char* uri = _uri_map->id_to_uri(param.id()); if (uri) { - return string_compose("property-%1", uri); + return std::string("property-") + uri; } else { - return string_compose("property-%1", param.id()); + return std::string("property-") + PBD::to_string(param.id()); } +#endif } else if (t == MidiCCAutomation) { - return string_compose("midicc-%1-%2", int(param.channel()), param.id()); + return std::string("midicc-") + PBD::to_string (param.channel()) + "-" + PBD::to_string (param.id()); } else if (t == MidiPgmChangeAutomation) { - return string_compose("midi-pgm-change-%1", int(param.channel())); + return std::string("midi-pgm-change-") + PBD::to_string(param.channel()); } else if (t == MidiPitchBenderAutomation) { - return string_compose("midi-pitch-bender-%1", int(param.channel())); + return std::string("midi-pitch-bender-") + PBD::to_string(param.channel()); } else if (t == MidiChannelPressureAutomation) { - return string_compose("midi-channel-pressure-%1", int(param.channel())); + return std::string("midi-channel-pressure-") + PBD::to_string(param.channel()); + } else if (t == MidiNotePressureAutomation) { + return std::string ("midi-note-pressure-") + PBD::to_string (param.channel()) + "-" + PBD::to_string (param.id()); } else { PBD::warning << "Uninitialized Parameter symbol() called." << endmsg; return "";