diff options
author | Carl Hetherington <carl@carlh.net> | 2010-12-20 13:30:31 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2010-12-20 13:30:31 +0000 |
commit | 3ec58e478ccd0a495e6fb916de8da0b26d5d15b5 (patch) | |
tree | 35f4127eeac90fa3a38f6a84edaefa8139ba7803 /libs | |
parent | 570ed69d2a791486a907b62ee2336a3953a7a1c0 (diff) |
Allow deletion of program changes in the same way as notes.
git-svn-id: svn://localhost/ardour2/branches/3.0@8304 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/evoral/evoral/ControlList.hpp | 1 | ||||
-rw-r--r-- | libs/evoral/src/ControlList.cpp | 22 |
2 files changed, 23 insertions, 0 deletions
diff --git a/libs/evoral/evoral/ControlList.hpp b/libs/evoral/evoral/ControlList.hpp index 16d0400145..8b8083f31c 100644 --- a/libs/evoral/evoral/ControlList.hpp +++ b/libs/evoral/evoral/ControlList.hpp @@ -124,6 +124,7 @@ public: void erase_range (double start, double end); void erase (iterator); void erase (iterator, iterator); + void erase (double, double); bool move_ranges (std::list< RangeMove<double> > const &); void modify (iterator, double, double); diff --git a/libs/evoral/src/ControlList.cpp b/libs/evoral/src/ControlList.cpp index b717190768..cc8ba45001 100644 --- a/libs/evoral/src/ControlList.cpp +++ b/libs/evoral/src/ControlList.cpp @@ -449,6 +449,28 @@ ControlList::erase (iterator start, iterator end) maybe_signal_changed (); } +/** Erase the first event which matches the given time and value */ +void +ControlList::erase (double when, double value) +{ + { + Glib::Mutex::Lock lm (_lock); + + iterator i = begin (); + while (i != end() && ((*i)->when != when || (*i)->value != value)) { + ++i; + } + + if (i != end ()) { + _events.erase (i); + } + + mark_dirty (); + } + + maybe_signal_changed (); +} + void ControlList::reset_range (double start, double endt) { |