diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-06-03 21:27:36 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-06-03 21:27:36 +0000 |
commit | db1fa42f14c54d9a9714aafe35d669a81469f964 (patch) | |
tree | b90ae0e1ac3373306475ddc343d5f5cc1203d6a8 /libs | |
parent | 1abbb506b84edc05d50b8d30ed27b9001885f768 (diff) |
start tracking note overlaps while moving notes
git-svn-id: svn://localhost/ardour2/branches/3.0@7228 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/evoral/evoral/Sequence.hpp | 6 | ||||
-rw-r--r-- | libs/evoral/src/Sequence.cpp | 16 |
2 files changed, 14 insertions, 8 deletions
diff --git a/libs/evoral/evoral/Sequence.hpp b/libs/evoral/evoral/Sequence.hpp index ae9ab05104..9e1083b3fd 100644 --- a/libs/evoral/evoral/Sequence.hpp +++ b/libs/evoral/evoral/Sequence.hpp @@ -231,7 +231,8 @@ public: bool edited() const { return _edited; } void set_edited(bool yn) { _edited = yn; } - bool overlaps (const boost::shared_ptr< Note<Time> >& ev) const; + bool overlaps (const boost::shared_ptr< Note<Time> >& ev, + const boost::shared_ptr< Note<Time> >& ignore_this_note) const; bool contains (const boost::shared_ptr< Note<Time> >& ev) const; bool add_note_unlocked(const boost::shared_ptr< Note<Time> > note); @@ -254,7 +255,8 @@ private: inline Pitches& pitches(uint8_t chan) { return _pitches[chan&0xf]; } inline const Pitches& pitches(uint8_t chan) const { return _pitches[chan&0xf]; } - bool overlaps_unlocked (const boost::shared_ptr< Note<Time> >& ev) const; + bool overlaps_unlocked (const boost::shared_ptr< Note<Time> >& ev, + const boost::shared_ptr< Note<Time> >& ignore_this_note) const; bool contains_unlocked (const boost::shared_ptr< Note<Time> >& ev) const; void append_note_on_unlocked (boost::shared_ptr< Note<Time> >); diff --git a/libs/evoral/src/Sequence.cpp b/libs/evoral/src/Sequence.cpp index 4b9fed035a..d11ec7c4fd 100644 --- a/libs/evoral/src/Sequence.cpp +++ b/libs/evoral/src/Sequence.cpp @@ -587,7 +587,7 @@ Sequence<Time>::add_note_unlocked(const boost::shared_ptr< Note<Time> > note) DEBUG_TRACE (DEBUG::Sequence, string_compose ("%1 add note %2 @ %3\n", this, (int)note->note(), note->time())); - if (!_overlapping_pitches_accepted && overlaps_unlocked (note)) { + if (!_overlapping_pitches_accepted && overlaps_unlocked (note, boost::shared_ptr<Note<Time> >())) { return false; } @@ -827,7 +827,7 @@ Sequence<Time>::remove_note_unlocked(const boost::shared_ptr< const Note<Time> > Sequence<Time>::contains_unlocked (const boost::shared_ptr< Note<Time> >& note) const { const Pitches& p (pitches (note->channel())); - boost::shared_ptr< Note<Time> > search_note(new Note<Time>(0, 0, 0, 0, note->note())); + boost::shared_ptr< Note<Time> > search_note(new Note<Time>(0, 0, 0, note->note())); for (typename Pitches::const_iterator i = p.lower_bound (search_note); i != p.end() && (*i)->note() == note->note(); ++i) { @@ -843,25 +843,29 @@ Sequence<Time>::remove_note_unlocked(const boost::shared_ptr< const Note<Time> > template<typename Time> bool - Sequence<Time>::overlaps (const boost::shared_ptr< Note<Time> >& note) const + Sequence<Time>::overlaps (const boost::shared_ptr< Note<Time> >& note, const boost::shared_ptr<Note<Time> >& without) const { ReadLock lock (read_lock()); - return overlaps_unlocked (note); + return overlaps_unlocked (note, without); } template<typename Time> bool - Sequence<Time>::overlaps_unlocked (const boost::shared_ptr< Note<Time> >& note) const + Sequence<Time>::overlaps_unlocked (const boost::shared_ptr< Note<Time> >& note, const boost::shared_ptr<Note<Time> >& without) const { Time sa = note->time(); Time ea = note->end_time(); const Pitches& p (pitches (note->channel())); - boost::shared_ptr< Note<Time> > search_note(new Note<Time>(0, 0, 0, 0, note->note())); + boost::shared_ptr< Note<Time> > search_note(new Note<Time>(0, 0, 0, note->note())); for (typename Pitches::const_iterator i = p.lower_bound (search_note); i != p.end() && (*i)->note() == note->note(); ++i) { + if (without && (**i) == *without) { + continue; + } + Time sb = (*i)->time(); Time eb = (*i)->end_time(); |