13
0

fix MIDI timestretch (libardour part)

This commit is contained in:
Paul Davis 2020-12-27 17:46:44 -07:00
parent 3197d24f38
commit 968da60e90

View File

@ -100,14 +100,18 @@ MidiStretch::run (boost::shared_ptr<Region> r, Progress*)
/* Note: pass true into force_discrete for the begin() iterator so that the model doesn't
* do interpolation of controller data when we stretch.
*/
MidiModel::TimeType final_time;
for (Evoral::Sequence<MidiModel::TimeType>::const_iterator i = old_model->begin (MidiModel::TimeType(), true); i != old_model->end(); ++i) {
const MidiModel::TimeType new_time = i->time().operator* (_request.time_fraction);
const MidiModel::TimeType new_time = i->time() * _request.time_fraction;
// FIXME: double copy
Evoral::Event<MidiModel::TimeType> ev(*i, true);
ev.set_time(new_time);
ev.set_time (new_time);
new_model->append(ev, Evoral::next_event_id());
final_time = max (final_time, new_time);
}
new_model->end_write (Evoral::Sequence<Temporal::Beats>::ResolveStuckNotes);
@ -117,10 +121,9 @@ MidiStretch::run (boost::shared_ptr<Region> r, Progress*)
const int ret = finish (region, nsrcs, new_name);
/* non-musical */
#warning NUTEMPO FIXME do we still need this?
results[0]->set_length (r->length().operator* ( _request.time_fraction));
/* set length of new region to precisely match source length */
results[0]->set_length (region->length() * _request.time_fraction);
return ret;
}