From 7e2c8ace4bf30ce8e27f1089370d63d7ef604cfa Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 26 Mar 2015 00:47:34 -0400 Subject: Follow MIDI control values with automation faders. Fixes bug #6166 (except record). This attempts to follow the "current" control value somewhat aggressively: * On locate, slider is set to the value from the top region at the new transport position. * Playback or MIDI input is followed "live". * Whenever the slider is moved (including automatically), that value is emitted as an immediate event to keep external gear in sync. General idea is that the Ardour slider should act as a mirror of an external hardware knob, and both should be synced to whatever the control is at the current transport position. Since we lack real playback/touch/etc modes for these for now, we must choose one behaviour, and this seems like the most reasonable one. Follow is handled in the audio thread, which is probably not ideal, but since these controls have no lists and do not record, should be fine. Probably. --- libs/evoral/evoral/MIDIEvent.hpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'libs/evoral/evoral') diff --git a/libs/evoral/evoral/MIDIEvent.hpp b/libs/evoral/evoral/MIDIEvent.hpp index 9b1d72c400..f0c9c74589 100644 --- a/libs/evoral/evoral/MIDIEvent.hpp +++ b/libs/evoral/evoral/MIDIEvent.hpp @@ -104,6 +104,21 @@ public: 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 -- cgit v1.2.3