diff options
author | Carl Hetherington <carl@carlh.net> | 2011-03-08 12:34:25 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2011-03-08 12:34:25 +0000 |
commit | d2bcfc07471645214e81b2d7284aabd16c6e25df (patch) | |
tree | 018088a326772d2b7ccaf42792f0a5b6c9cb2d94 /libs | |
parent | b88c77389485971c7426af925cc350f9178d7164 (diff) |
Allow out-of-time-order writes to nascent event list, sorting before merge. Fixes #3537.
git-svn-id: svn://localhost/ardour2/branches/3.0@9103 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/evoral/src/ControlList.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/libs/evoral/src/ControlList.cpp b/libs/evoral/src/ControlList.cpp index 6738e8c1ac..f88bda323e 100644 --- a/libs/evoral/src/ControlList.cpp +++ b/libs/evoral/src/ControlList.cpp @@ -223,6 +223,13 @@ ControlList::write_pass_finished (double when) merge_nascent (when); } + +struct ControlEventTimeComparator { + bool operator() (ControlEvent* a, ControlEvent* b) { + return a->when < b->when; + } +}; + void ControlList::merge_nascent (double when) { @@ -244,6 +251,8 @@ ControlList::merge_nascent (double when) delete ninfo; continue; } + + nascent_events.sort (ControlEventTimeComparator ()); if (ninfo->start_time < 0.0) { ninfo->start_time = nascent_events.front()->when; @@ -372,9 +381,9 @@ ControlList::rt_add (double when, double value) if (lm.locked()) { assert (!nascent.empty()); - if (!nascent.back()->events.empty()) { - assert (when > nascent.back()->events.back()->when); - } + /* we don't worry about adding events out of time order as we will + sort them in merge_nascent. + */ nascent.back()->events.push_back (new ControlEvent (when, value)); } } |