summaryrefslogtreecommitdiff
path: root/libs/evoral
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
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')
-rw-r--r--libs/evoral/evoral/Sequence.hpp9
-rw-r--r--libs/evoral/src/Sequence.cpp19
2 files changed, 19 insertions, 9 deletions
diff --git a/libs/evoral/evoral/Sequence.hpp b/libs/evoral/evoral/Sequence.hpp
index 298ef48e52..98d4b190b1 100644
--- a/libs/evoral/evoral/Sequence.hpp
+++ b/libs/evoral/evoral/Sequence.hpp
@@ -97,7 +97,14 @@ public:
void start_write();
bool writing() const { return _writing; }
- void end_write (Time when=0, bool delete_stuck=false, bool resolve=false);
+
+ enum StuckNoteOption {
+ Relax,
+ DeleteStuckNotes,
+ ResolveStuckNotes
+ };
+
+ void end_write (StuckNoteOption, Time when = 0);
void append(const Event<Time>& ev, Evoral::event_id_t evid);
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;
}
}