From b6bab4f8cfb7bd1d7276e2c194c44d8df67afea4 Mon Sep 17 00:00:00 2001 From: paul Date: Thu, 3 Jun 2010 15:58:15 +0000 Subject: [PATCH] Sequence::contains() and Sequence::overlaps() now use pitch-based indexing to speed things up in pathological cases git-svn-id: http://subversion.ardour.org/svn/ardour2/ardour2/branches/3.0@7221 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/evoral/evoral/Sequence.hpp | 34 +++++++++++++++++++-------- libs/evoral/src/Sequence.cpp | 52 ++++++++++++++++++++++++++--------------- 2 files changed, 57 insertions(+), 29 deletions(-) diff --git a/libs/evoral/evoral/Sequence.hpp b/libs/evoral/evoral/Sequence.hpp index acfe6970e..ae9ab0510 100644 --- a/libs/evoral/evoral/Sequence.hpp +++ b/libs/evoral/evoral/Sequence.hpp @@ -137,10 +137,6 @@ public: inline Notes& notes() { return _notes; } inline const Notes& notes() const { return _notes; } - typedef std::multiset >, NoteNumberComparator> Pitches; - inline Pitches& pitches(uint8_t chan) { return _pitches[chan&0xf]; } - inline const Pitches& pitches(uint8_t chan) const { return _pitches[chan&0xf]; } - enum NoteOperator { PitchEqual, PitchLessThan, @@ -157,8 +153,19 @@ public: void get_notes (Notes&, NoteOperator, uint8_t val, int chan_mask = 0) const; void remove_overlapping_notes (); + void trim_overlapping_notes (); void remove_duplicate_notes (); + enum OverlapPitchResolution { + LastOnFirstOff, + FirstOnFirstOff + }; + + bool overlapping_pitches_accepted() const { return _overlapping_pitches_accepted; } + void overlapping_pitches_accepted(bool yn) { _overlapping_pitches_accepted = yn; } + OverlapPitchResolution overlap_pitch_resolution() const { return _overlap_pitch_resolution; } + void set_overlap_pitch_resolution(OverlapPitchResolution opr); + void set_notes (const Sequence