summaryrefslogtreecommitdiff
path: root/libs/evoral/src/Sequence.cpp
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-07-14 17:41:06 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-07-14 17:41:06 +0000
commita5efa9a500d2c1b592656e91e9ea7ef7d535dcb3 (patch)
tree02203a2821f22bd5d1b346484c97d400276076c7 /libs/evoral/src/Sequence.cpp
parent2d83ffc45a2a144181d0f3449345868da11efff5 (diff)
initial pass at session-renaming functionality
git-svn-id: svn://localhost/ardour2/branches/3.0@9876 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/evoral/src/Sequence.cpp')
-rw-r--r--libs/evoral/src/Sequence.cpp35
1 files changed, 24 insertions, 11 deletions
diff --git a/libs/evoral/src/Sequence.cpp b/libs/evoral/src/Sequence.cpp
index 7296ff4e1c..5c06e8c2ca 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 (bool delete_stuck)
+Sequence<Time>::end_write (Time when, bool delete_stuck, bool resolve)
{
WriteLock lock(write_lock());
@@ -631,27 +631,40 @@ Sequence<Time>::end_write (bool delete_stuck)
return;
}
+ if (resolve) {
+ assert (when != 0);
+ assert (!delete_stuck);
+ }
+
DEBUG_TRACE (DEBUG::Sequence, string_compose ("%1 : end_write (%2 notes)\n", this, _notes.size()));
- if (!_percussive && delete_stuck) {
+ if (!_percussive) {
+
for (typename Notes::iterator n = _notes.begin(); n != _notes.end() ;) {
typename Notes::iterator next = n;
++next;
if ((*n)->length() == 0) {
- cerr << "WARNING: Stuck note lost: " << (*n)->note() << endl;
- _notes.erase(n);
- }
-
+ if (delete_stuck) {
+ cerr << "WARNING: Stuck note lost: " << (*n)->note() << endl;
+ _notes.erase(n);
+ } else if (resolve) {
+ if (when <= (*n)->time()) {
+ cerr << "WARNING: Stuck note resolution - end time @ "
+ << when << " is before note on: " << (**n) << endl;
+ _notes.erase (*n);
+ } else {
+ (*n)->set_length (when - (*n)->time());
+ cerr << "WARNING: resolved note-on with no note-off to generate " << (**n) << endl;
+ }
+ }
+ }
+
n = next;
}
}
for (int i = 0; i < 16; ++i) {
- if (!_write_notes[i].empty()) {
- cerr << "WARNING: Sequence<Time>::end_write: Channel " << i << " has "
- << _write_notes[i].size() << " stuck notes" << endl;
- }
_write_notes[i].clear();
}
@@ -925,7 +938,7 @@ Sequence<Time>::append_note_off_unlocked (NotePtr note)
nn->set_off_velocity (note->velocity());
_write_notes[note->channel()].erase(n);
- DEBUG_TRACE (DEBUG::Sequence, string_compose ("resolved note, length: %1\n", nn->length()));
+ DEBUG_TRACE (DEBUG::Sequence, string_compose ("resolved note @ %2 length: %1\n", nn->length(), nn->time()));
resolved = true;
break;
}