13
0

Prepare midi-export for midi-to-audio bouncing.

* shift event time into process cycle before calling processors
* reset note-trackers when exporting, don't allow any pending
  events into the queue
This commit is contained in:
Robin Gareus 2019-04-07 19:18:28 +02:00
parent 1ba391ab11
commit 8f9c1df183
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 13 additions and 2 deletions

View File

@ -478,13 +478,22 @@ MidiTrack::export_stuff (BufferSet& buffers,
if (!mpl) { if (!mpl) {
return -2; return -2;
} }
mpl->reset_note_trackers (); // TODO once at start and end ?
buffers.get_midi(0).clear(); buffers.get_midi(0).clear();
if (mpl->read(buffers.get_midi(0), start, nframes, 0) != nframes) { if (mpl->read(buffers.get_midi(0), start, nframes, 0) != nframes) {
return -1; return -1;
} }
//bounce_process (buffers, start, nframes, endpoint, include_endpoint, for_export, for_freeze); if (endpoint && !for_export) {
MidiBuffer& buf = buffers.get_midi(0);
for (MidiBuffer::iterator i = buf.begin(); i != buf.end(); ++i) {
MidiBuffer::TimeType *t = i.timeptr ();
*t -= start;
}
bounce_process (buffers, start, nframes, endpoint, include_endpoint, for_export, for_freeze);
}
mpl->reset_note_trackers ();
return 0; return 0;
} }

View File

@ -6238,7 +6238,9 @@ Session::write_one_track (Track& track, samplepos_t start, samplepos_t end,
const MidiBuffer& buf = buffers.get_midi(0); const MidiBuffer& buf = buffers.get_midi(0);
for (MidiBuffer::const_iterator i = buf.begin(); i != buf.end(); ++i) { for (MidiBuffer::const_iterator i = buf.begin(); i != buf.end(); ++i) {
Evoral::Event<samplepos_t> ev = *i; Evoral::Event<samplepos_t> ev = *i;
ev.set_time(ev.time() - position); if (!endpoint || for_export) {
ev.set_time(ev.time() - position);
}
ms->append_event_samples(lock, ev, ms->timeline_position()); ms->append_event_samples(lock, ev, ms->timeline_position());
} }
} }