13
0

actually paste MIDI at the right spot

git-svn-id: svn://localhost/ardour2/branches/3.0@5521 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2009-08-13 12:19:28 +00:00
parent 02e3f7c769
commit 84fb6ae9ba

View File

@ -1722,22 +1722,17 @@ MidiRegionView::paste (nframes64_t pos, const MidiCutBuffer& mcb)
{
MidiModel::DeltaCommand* cmd = _model->new_delta_command("paste");
MidiModel::TimeType beat_delta;
nframes64_t paste_pos_beats;
MidiModel::TimeType paste_pos_beats;
paste_pos_beats = frames_to_beats (pos);
beat_delta = mcb.notes().front()->time() - paste_pos_beats;
cerr << "For paste @ " << pos << " beats = " << paste_pos_beats
<< " first pasted note @ " << mcb.notes().front()->time()
<< " ... delta = " << beat_delta << endl;
for (Evoral::Sequence<MidiModel::TimeType>::Notes::const_iterator i = mcb.notes().begin(); i != mcb.notes().end(); ++i) {
boost::shared_ptr<NoteType> copied_note (new NoteType (*((*i).get())));
copied_note->set_time (copied_note->time() - beat_delta);
cmd->add (copied_note);
}
_model->apply_command(trackview.session(), cmd);
_model->apply_command(trackview.session(), cmd);
}