summaryrefslogtreecommitdiff
path: root/libs/evoral
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-03-26 00:47:34 -0400
committerDavid Robillard <d@drobilla.net>2015-03-26 00:47:34 -0400
commit7e2c8ace4bf30ce8e27f1089370d63d7ef604cfa (patch)
treefe6812cf1b5abc337db5a2395fe1945881c32f7c /libs/evoral
parenta53bd7269797969bfb182a4caebc9361cac45795 (diff)
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.
Diffstat (limited to 'libs/evoral')
-rw-r--r--libs/evoral/evoral/MIDIEvent.hpp15
1 files changed, 15 insertions, 0 deletions
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