fix crash when copy'ing latent plugins
[ardour.git] / libs / evoral / evoral / MIDIEvent.hpp
index 9b1d72c400bb8c30a98f28925921112172e563ae..00e8577cda76e3406e28c1a26f5d26a8c6065b20 100644 (file)
@@ -101,9 +101,24 @@ public:
        inline bool     is_spp()                  const { return this->_buf[0] == 0xF2 && this->size() == 1; }
        inline bool     is_mtc_quarter()          const { return this->_buf[0] == 0xF1 && this->size() == 1; }
        inline bool     is_mtc_full()             const {
-               return this->size() == 10    && this->_buf[0] == 0xf0 && this->_buf[1] == 0x7f && 
+               return this->size() == 10    && this->_buf[0] == 0xf0 && this->_buf[1] == 0x7f &&
                       this->_buf[3] == 0x01 && this->_buf[4] == 0x01;
        }
+
+       inline uint16_t value() const {
+               switch (type()) {
+               case MIDI_CMD_CONTROL:
+                       return cc_value();
+               case MIDI_CMD_BENDER:
+                       return pitch_bender_value();
+               case MIDI_CMD_NOTE_PRESSURE:
+                       return aftertouch();
+               case MIDI_CMD_CHANNEL_PRESSURE:
+                       return channel_pressure();
+               default:
+                       return 0;
+               }
+       }
 };
 
 } // namespace Evoral