use "extends to numeric_limits<Beats>::max()" rather than "zero length" for nascent...
authorPaul Davis <paul@linuxaudiosystems.com>
Sat, 11 Jan 2020 17:56:19 +0000 (10:56 -0700)
committerPaul Davis <paul@linuxaudiosystems.com>
Sat, 11 Jan 2020 17:57:21 +0000 (10:57 -0700)
libs/evoral/Sequence.cc

index a1f166cd7712ec0e04adeaf418c9b5c5a88b022e..448a9ab199f197a5090f4b1294de3645999cc477 100644 (file)
@@ -664,7 +664,7 @@ Sequence<Time>::end_write (StuckNoteOption option, Time when)
                typename Notes::iterator next = n;
                ++next;
 
-               if (!(*n)->length()) {
+               if ((*n)->end_time() == std::numeric_limits<Temporal::Beats>::max()) {
                        switch (option) {
                        case Relax:
                                break;
@@ -997,7 +997,11 @@ Sequence<Time>::append_note_on_unlocked (const Event<Time>& ev, event_id_t evid)
                return;
        }
 
-       NotePtr note(new Note<Time>(ev.channel(), ev.time(), Time(), ev.note(), ev.velocity()));
+       /* nascent (incoming notes without a note-off ...yet) have a duration
+          that extends to Beats::max()
+       */
+       NotePtr note(new Note<Time>(ev.channel(), ev.time(), std::numeric_limits<Temporal::Beats>::max() - ev.time(), ev.note(), ev.velocity()));
+       assert (note->end_time() == std::numeric_limits<Temporal::Beats>::max());
        note->set_id (evid);
 
        add_note_unlocked (note);