Fix potential deadlock on session-load
[ardour.git] / libs / ardour / event_type_map.cc
index cd3aeacebd9f02a87160bf80be3035afb055468a..ca7b51eb2724d7b28a707c712ca47f1cfc540c68 100644 (file)
@@ -62,10 +62,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 +115,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);
        }
@@ -130,6 +131,8 @@ 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 == "mute") {
@@ -190,10 +193,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);
 }
 
@@ -207,6 +217,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) {
@@ -246,6 +258,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 "";