diff options
author | Hans Baier <hansfbaier@googlemail.com> | 2009-01-28 04:55:31 +0000 |
---|---|---|
committer | Hans Baier <hansfbaier@googlemail.com> | 2009-01-28 04:55:31 +0000 |
commit | 3705a2d6307cf443acbf8419b0e0f560591f2016 (patch) | |
tree | 0702629940e808aa553d1d344ac49dac2d7ca9c2 /libs/ardour | |
parent | 6c538ab719c49262da159e9568bb1f8fb30e1518 (diff) |
* MIDI control lanes: Set Interpolationtype according to Parameter
git-svn-id: svn://localhost/ardour2/branches/3.0@4452 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r-- | libs/ardour/ardour/event_type_map.h | 4 | ||||
-rw-r--r-- | libs/ardour/event_type_map.cc | 57 | ||||
-rw-r--r-- | libs/ardour/midi_source.cc | 6 | ||||
-rw-r--r-- | libs/ardour/smf_source.cc | 25 |
4 files changed, 82 insertions, 10 deletions
diff --git a/libs/ardour/ardour/event_type_map.h b/libs/ardour/ardour/event_type_map.h index b0ccdc8efd..feddc45968 100644 --- a/libs/ardour/ardour/event_type_map.h +++ b/libs/ardour/ardour/event_type_map.h @@ -23,8 +23,7 @@ #include <string> #include <evoral/TypeMap.hpp> - -namespace Evoral { class Parameter; } +#include <evoral/ControlList.hpp> namespace ARDOUR { @@ -36,6 +35,7 @@ public: bool type_is_midi(uint32_t type) const; uint8_t parameter_midi_type(const Evoral::Parameter& param) const; uint32_t midi_event_type(uint8_t status) const; + Evoral::ControlList::InterpolationStyle interpolation_of(const Evoral::Parameter& param); bool is_integer(const Evoral::Parameter& param) const; Evoral::Parameter new_parameter(uint32_t type, uint8_t channel=0, uint32_t id=0) const; diff --git a/libs/ardour/event_type_map.cc b/libs/ardour/event_type_map.cc index a4d8317a42..3b4fefdcea 100644 --- a/libs/ardour/event_type_map.cc +++ b/libs/ardour/event_type_map.cc @@ -75,6 +75,63 @@ EventTypeMap::is_integer(const Evoral::Parameter& param) const && param.type() <= MidiChannelPressureAutomation); } +Evoral::ControlList::InterpolationStyle +EventTypeMap::interpolation_of(const Evoral::Parameter& param) +{ + switch (param.type()) { + case MidiCCAutomation: + switch (param.id()) { + case MIDI_CTL_LSB_BANK: + case MIDI_CTL_MSB_BANK: + case MIDI_CTL_LSB_EFFECT1: + case MIDI_CTL_LSB_EFFECT2: + case MIDI_CTL_MSB_EFFECT1: + case MIDI_CTL_MSB_EFFECT2: + case MIDI_CTL_MSB_GENERAL_PURPOSE1: + case MIDI_CTL_MSB_GENERAL_PURPOSE2: + case MIDI_CTL_MSB_GENERAL_PURPOSE3: + case MIDI_CTL_MSB_GENERAL_PURPOSE4: + case MIDI_CTL_SUSTAIN: + case MIDI_CTL_PORTAMENTO: + case MIDI_CTL_SOSTENUTO: + case MIDI_CTL_SOFT_PEDAL: + case MIDI_CTL_LEGATO_FOOTSWITCH: + case MIDI_CTL_HOLD2: + case MIDI_CTL_GENERAL_PURPOSE5: + case MIDI_CTL_GENERAL_PURPOSE6: + case MIDI_CTL_GENERAL_PURPOSE7: + case MIDI_CTL_GENERAL_PURPOSE8: + case MIDI_CTL_DATA_INCREMENT: + case MIDI_CTL_DATA_DECREMENT: + case MIDI_CTL_NONREG_PARM_NUM_LSB: + case MIDI_CTL_NONREG_PARM_NUM_MSB: + case MIDI_CTL_REGIST_PARM_NUM_LSB: + case MIDI_CTL_REGIST_PARM_NUM_MSB: + case MIDI_CTL_ALL_SOUNDS_OFF: + case MIDI_CTL_RESET_CONTROLLERS: + case MIDI_CTL_LOCAL_CONTROL_SWITCH: + case MIDI_CTL_ALL_NOTES_OFF: + case MIDI_CTL_OMNI_OFF: + case MIDI_CTL_OMNI_ON: + case MIDI_CTL_MONO: + case MIDI_CTL_POLY: + + return Evoral::ControlList::Discrete; + break; + + default: return Evoral::ControlList::Linear; break; + } + + break; + + case MidiPgmChangeAutomation: return Evoral::ControlList::Discrete; break; + case MidiChannelPressureAutomation: return Evoral::ControlList::Linear; break; + case MidiPitchBenderAutomation: return Evoral::ControlList::Linear; break; + default: assert(false); + } +} + + Evoral::Parameter EventTypeMap::new_parameter(uint32_t type, uint8_t channel, uint32_t id) const { diff --git a/libs/ardour/midi_source.cc b/libs/ardour/midi_source.cc index ac52b81ee5..2aed2cad28 100644 --- a/libs/ardour/midi_source.cc +++ b/libs/ardour/midi_source.cc @@ -147,8 +147,9 @@ MidiSource::mark_streaming_midi_write_started (NoteMode mode, nframes_t start_fr void MidiSource::mark_streaming_write_started () { - if (_model) + if (_model) { _model->start_write(); + } _writing = true; } @@ -156,8 +157,9 @@ MidiSource::mark_streaming_write_started () void MidiSource::mark_streaming_write_completed () { - if (_model) + if (_model) { _model->end_write(false); // FIXME: param? + } _writing = false; } diff --git a/libs/ardour/smf_source.cc b/libs/ardour/smf_source.cc index 9caf005833..cc521336e3 100644 --- a/libs/ardour/smf_source.cc +++ b/libs/ardour/smf_source.cc @@ -241,8 +241,9 @@ SMFSource::write_unlocked (MidiRingBuffer& src, nframes_t cnt) append_event_unlocked(Frames, ev); - if (_model) + if (_model) { _model->append(ev); + } } SMF::flush(); @@ -601,14 +602,18 @@ SMFSource::set_source_name (string newname, bool destructive) void SMFSource::load_model(bool lock, bool force_reload) { - if (_writing) + if (_writing) { return; + } + - if (lock) + if (lock) { Glib::Mutex::Lock lm (_lock); + } - if (_model && !force_reload && !_model->empty()) + if (_model && !force_reload && !_model->empty()) { return; + } if (! _model) { _model = boost::shared_ptr<MidiModel>(new MidiModel(this)); @@ -648,10 +653,18 @@ SMFSource::load_model(bool lock, bool force_reload) _model->append(ev); } - if (ev.size() > scratch_size) + if (ev.size() > scratch_size) { scratch_size = ev.size(); - else + } else { ev.size() = scratch_size; + } + } + + // set interpolation style to defaults, can be changed by the GUI later + Evoral::ControlSet::Controls controls = _model->controls(); + for (Evoral::ControlSet::Controls::iterator c = controls.begin(); c != controls.end(); ++c) { + (*c).second->list()->set_interpolation( + EventTypeMap::instance().interpolation_of((*c).first)); } _model->end_write(false); |