summaryrefslogtreecommitdiff
path: root/libs/evoral/src/Sequence.cpp
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-07-20 18:13:03 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-07-20 18:13:03 +0000
commitc99738d88e8a2ad806b219b9f3614a6b55b6bf37 (patch)
treed506a27d404e1b63063372ebe2f63aacc7e6ebb4 /libs/evoral/src/Sequence.cpp
parent8c7fda11cf47cd8dd04c6eabffc437dd942403d5 (diff)
try to fix data loss at end of a capture pass for MIDI - add a new virtual method to MidiSource that specifies what should be done with stuck notes, remove duplicate(i hope) _last_flush_frame from SMFSource that mirrored, more or less, MidiSource::_last_write_end; use new virtual method when stopping after capture.
git-svn-id: svn://localhost/ardour2/branches/3.0@9910 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/evoral/src/Sequence.cpp')
-rw-r--r--libs/evoral/src/Sequence.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/libs/evoral/src/Sequence.cpp b/libs/evoral/src/Sequence.cpp
index 3d0fe771fb..d1fd64382b 100644
--- a/libs/evoral/src/Sequence.cpp
+++ b/libs/evoral/src/Sequence.cpp
@@ -623,7 +623,7 @@ Sequence<Time>::start_write()
*/
template<typename Time>
void
-Sequence<Time>::end_write (Time when, bool delete_stuck, bool resolve)
+Sequence<Time>::end_write (StuckNoteOption option, Time when)
{
WriteLock lock(write_lock());
@@ -631,11 +631,7 @@ Sequence<Time>::end_write (Time when, bool delete_stuck, bool resolve)
return;
}
- if (resolve) {
- assert (!delete_stuck);
- }
-
- DEBUG_TRACE (DEBUG::Sequence, string_compose ("%1 : end_write (%2 notes)\n", this, _notes.size()));
+ DEBUG_TRACE (DEBUG::Sequence, string_compose ("%1 : end_write (%2 notes) delete stuck option %3 @ %4\n", this, _notes.size(), option, when));
if (!_percussive) {
@@ -643,11 +639,17 @@ Sequence<Time>::end_write (Time when, bool delete_stuck, bool resolve)
typename Notes::iterator next = n;
++next;
+ cerr << "!!!!!!! note length = " << (*n)->length() << endl;
+
if ((*n)->length() == 0) {
- if (delete_stuck) {
+ switch (option) {
+ case Relax:
+ break;
+ case DeleteStuckNotes:
cerr << "WARNING: Stuck note lost: " << (*n)->note() << endl;
_notes.erase(n);
- } else if (resolve) {
+ break;
+ case ResolveStuckNotes:
if (when <= (*n)->time()) {
cerr << "WARNING: Stuck note resolution - end time @ "
<< when << " is before note on: " << (**n) << endl;
@@ -656,6 +658,7 @@ Sequence<Time>::end_write (Time when, bool delete_stuck, bool resolve)
(*n)->set_length (when - (*n)->time());
cerr << "WARNING: resolved note-on with no note-off to generate " << (**n) << endl;
}
+ break;
}
}