fix assumed typo from LV2_SUPPORT PR recently committed
[ardour.git] / libs / ardour / event_type_map.cc
index 8782162304a0d9155ee23ab37cb5c5c65bb3b102..ab6fd26f7e4c4d138eba90b0b2cf1b68217441b6 100644 (file)
@@ -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"
@@ -62,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
@@ -115,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);
        }
@@ -192,10 +195,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);
 }
 
@@ -250,6 +260,8 @@ EventTypeMap::to_symbol(const Evoral::Parameter& param) const
                return string_compose("midi-pitch-bender-%1", int(param.channel()));
        } else if (t == MidiChannelPressureAutomation) {
                return string_compose("midi-channel-pressure-%1", int(param.channel()));
+       } else if (t == MidiNotePressureAutomation) {
+               return string_compose("midi-note-pressure-%1-%2", int(param.channel()), param.id());
        } else {
                PBD::warning << "Uninitialized Parameter symbol() called." << endmsg;
                return "";