summaryrefslogtreecommitdiff
path: root/libs/ardour/midi_stretch.cc
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-07-14 00:58:15 +0000
committerCarl Hetherington <carl@carlh.net>2010-07-14 00:58:15 +0000
commit593b421180290f46f39efcb21ed8192b624bbc73 (patch)
treef8a81aad5fae8683818103b192d3c53a26110728 /libs/ardour/midi_stretch.cc
parentb75977920e7cb02ae31bca0379dd3aa4d82f9cbc (diff)
A few fixes to interpolation of MIDI controller data. Don't interpolate
when writing these data back to a source, otherwise surprising new interpolated points appear in MIDI automation. Similarly don't interpolate when reading the model during MIDI stretch. Fix handling of interpolation state; controllers that have been set by the user to use a different interpolation style are noted in the <Source> tag of the session file and this state is sprayed around to MidiModel and the GUI as necessary. git-svn-id: svn://localhost/ardour2/branches/3.0@7409 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/midi_stretch.cc')
-rw-r--r--libs/ardour/midi_stretch.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/libs/ardour/midi_stretch.cc b/libs/ardour/midi_stretch.cc
index 585e0a07b2..21b5453da4 100644
--- a/libs/ardour/midi_stretch.cc
+++ b/libs/ardour/midi_stretch.cc
@@ -90,7 +90,10 @@ MidiStretch::run (boost::shared_ptr<Region> r)
boost::shared_ptr<MidiModel> new_model = new_src->model();
new_model->start_write();
- for (Evoral::Sequence<MidiModel::TimeType>::const_iterator i = old_model->begin();
+ /* Note: pass true into force_discrete for the begin() iterator so that the model doesn't
+ * do interpolation of controller data when we stretch.
+ */
+ for (Evoral::Sequence<MidiModel::TimeType>::const_iterator i = old_model->begin (0, true);
i != old_model->end(); ++i) {
const double new_time = i->time() * _request.time_fraction;
@@ -103,6 +106,8 @@ MidiStretch::run (boost::shared_ptr<Region> r)
new_model->end_write();
new_model->set_edited(true);
+ new_src->copy_interpolation_from (src);
+
const int ret = finish (region, nsrcs, new_name);
results[0]->set_length((nframes_t) floor (r->length() * _request.time_fraction), NULL);