diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-05-20 22:38:12 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-05-20 22:38:12 +0000 |
commit | a196405da9fab534b5ece4d165e871d02d671b36 (patch) | |
tree | 17cf937e579046c2fb84c30db5c09bb87def6451 /libs/evoral/src/Sequence.cpp | |
parent | e58f6752af39d5aa032b45eca1c8f392fd874b16 (diff) |
various minor MIDI fixes: prevent duplicate note entry with mouse, show note info more often with verbose cursor, fix some crashes from click+move on notes ... lots more where this comes from
git-svn-id: svn://localhost/ardour2/branches/3.0@7128 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/evoral/src/Sequence.cpp')
-rw-r--r-- | libs/evoral/src/Sequence.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/libs/evoral/src/Sequence.cpp b/libs/evoral/src/Sequence.cpp index 281aec514b..523643665f 100644 --- a/libs/evoral/src/Sequence.cpp +++ b/libs/evoral/src/Sequence.cpp @@ -730,12 +730,38 @@ Sequence<Time>::append_sysex_unlocked(const MIDIEvent<Time>& ev) } template<typename Time> -void +bool +Sequence<Time>::contains(const boost::shared_ptr< Note<Time> > note) const +{ + ReadLock lock (read_lock()); + + for (typename Sequence<Time>::Notes::const_iterator i = note_lower_bound(note->time()); + i != _notes.end() && (*i)->time() == note->time(); ++i) { + if (*i == note) { + cerr << "Existing note matches: " << *i << endl; + return true; + } + } + cerr << "No matching note for " << note << endl; + return false; +} + +template<typename Time> +bool Sequence<Time>::add_note_unlocked(const boost::shared_ptr< Note<Time> > note) { DUMP(format("%1% add note %2% @ %3%\n") % this % (int)note->note() % note->time()); + + for (typename Sequence<Time>::Notes::iterator i = note_lower_bound(note->time()); + i != _notes.end() && (*i)->time() == note->time(); ++i) { + if (*i == note) { + return false; + } + } + _edited = true; _notes.insert(note); + return true; } template<typename Time> |