diff options
Diffstat (limited to 'muse2')
-rw-r--r-- | muse2/ChangeLog | 3 | ||||
-rw-r--r-- | muse2/muse/eventlist.cpp | 53 |
2 files changed, 49 insertions, 7 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog index ed60b698..d27e00e9 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -1,3 +1,6 @@ +04.09.2012: + - Fix for forum topic "Ordering of simultaneous events". (Tim) + Methods EventList::add() and ::move() now sort all same-time notes AFTER controllers. 03.09.2012: summer sleep is over! plugins can now be grouped (flo) 14.08.2012: * Introducing: Improved Wave Editor. (Tim) diff --git a/muse2/muse/eventlist.cpp b/muse2/muse/eventlist.cpp index 66780adb..25acd5a8 100644 --- a/muse2/muse/eventlist.cpp +++ b/muse2/muse/eventlist.cpp @@ -74,11 +74,29 @@ iEvent EventList::add(Event& event) // Note that in a med file, the tempo list is loaded AFTER all the tracks. // There was a bug that all the wave events' tick values were not correct, // since they were computed BEFORE the tempo map was loaded. +// REMOVE Tim. Original +// if(event.type() == Wave) +// return std::multimap<unsigned, Event, std::less<unsigned> >::insert(std::pair<const unsigned, Event> (event.frame(), event)); +// else +// +// return std::multimap<unsigned, Event, std::less<unsigned> >::insert(std::pair<const unsigned, Event> (event.tick(), event)); + if(event.type() == Wave) - return std::multimap<unsigned, Event, std::less<unsigned> >::insert(std::pair<const unsigned, Event> (event.frame(), event)); + return insert(std::pair<const unsigned, Event> (event.frame(), event)); + + unsigned key = event.tick(); + if(event.type() == Note) // Place notes after controllers. + { + iEvent i = upper_bound(key); + return insert(i, std::pair<const unsigned, Event> (key, event)); + } else - - return std::multimap<unsigned, Event, std::less<unsigned> >::insert(std::pair<const unsigned, Event> (event.tick(), event)); + { + iEvent i = lower_bound(key); + while(i != end() && i->first == key && i->second.type() != Note) + ++i; + return insert(i, std::pair<const unsigned, Event> (key, event)); + } } //--------------------------------------------------------- @@ -90,12 +108,33 @@ void EventList::move(Event& event, unsigned tick) iEvent i = find(event); erase(i); - // Added by T356. +// REMOVE Tim. Original. +// if(event.type() == Wave) +// std::multimap<unsigned, Event, std::less<unsigned> >::insert(std::pair<const unsigned, Event> (MusEGlobal::tempomap.tick2frame(tick), event)); +// else +// +// std::multimap<unsigned, Event, std::less<unsigned> >::insert(std::pair<const unsigned, Event> (tick, event)); + if(event.type() == Wave) - std::multimap<unsigned, Event, std::less<unsigned> >::insert(std::pair<const unsigned, Event> (MusEGlobal::tempomap.tick2frame(tick), event)); - else + { + insert(std::pair<const unsigned, Event> (MusEGlobal::tempomap.tick2frame(tick), event)); + return; + } - std::multimap<unsigned, Event, std::less<unsigned> >::insert(std::pair<const unsigned, Event> (tick, event)); + if(event.type() == Note) // Place notes after controllers. + { + iEvent i = upper_bound(tick); + insert(i, std::pair<const unsigned, Event> (tick, event)); + return; + } + else + { + iEvent i = lower_bound(tick); + while(i != end() && i->first == tick && i->second.type() != Note) + ++i; + insert(i, std::pair<const unsigned, Event> (tick, event)); + return; + } } //--------------------------------------------------------- |