summaryrefslogtreecommitdiff
path: root/libs/ardour/midi_track.cc
diff options
context:
space:
mode:
authorHans Baier <hansfbaier@googlemail.com>2008-05-03 06:37:22 +0000
committerHans Baier <hansfbaier@googlemail.com>2008-05-03 06:37:22 +0000
commitb0d49651a77e6355e180c0a1d85ac3cb1288bc97 (patch)
treee3731789342c629376f6801e825f938e4c195706 /libs/ardour/midi_track.cc
parentfb1fbf71af452ecff0a257bda228d1b31912c8ee (diff)
* MidiModel::const_iterator::operator++: added AUTOMATION type
* automatable.cc/parameter.cc: Added friendly names for the new Midi parameter types * fixed a failed assertion problem (note on channel != note off channel), but have no idea how :) * changed lots of whitespace :| git-svn-id: svn://localhost/ardour2/branches/3.0@3309 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/midi_track.cc')
-rw-r--r--libs/ardour/midi_track.cc30
1 files changed, 27 insertions, 3 deletions
diff --git a/libs/ardour/midi_track.cc b/libs/ardour/midi_track.cc
index 9cdf36144b..a4a47e8be5 100644
--- a/libs/ardour/midi_track.cc
+++ b/libs/ardour/midi_track.cc
@@ -724,11 +724,35 @@ MidiTrack::write_immediate_event(size_t size, const Byte* buf)
void
MidiTrack::MidiControl::set_value(float val)
{
- assert(val >= 0);
- assert(val <= 127.0);
+ assert(val >= _list->parameter().min());
+ assert(val <= _list->parameter().max());
if ( ! _list->automation_playback()) {
- Byte ev[3] = { MIDI_CMD_CONTROL, _list->parameter().id(), (int)val };
+ Byte ev[3] = { _list->parameter().channel(), int(val), 0.0 };
+ switch(AutomationType type = _list->parameter().type()) {
+ case MidiCCAutomation:
+ ev[0] += MIDI_CMD_CONTROL;
+ ev[1] = _list->parameter().id();
+ ev[2] = int(val);
+ break;
+
+ case MidiPgmChangeAutomation:
+ ev[0] += MIDI_CMD_PGM_CHANGE;
+ break;
+
+ case MidiChannelAftertouchAutomation:
+ ev[0] += MIDI_CMD_CHANNEL_PRESSURE;
+ break;
+
+ case MidiPitchBenderAutomation:
+ ev[0] += MIDI_CMD_BENDER;
+ ev[1] = 0x7F & int(val);
+ ev[2] = 0x7F & (int(val) >> 7);
+ break;
+
+ default:
+ assert(false);
+ }
_route->write_immediate_event(3, ev);
}