mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 16:24:57 +01:00
Remove duplicates from ControlList
This commit is contained in:
parent
3d15499cda
commit
8dcc28c9ad
2 changed files with 23 additions and 0 deletions
|
|
@ -356,6 +356,7 @@ private:
|
||||||
bool did_write_during_pass;
|
bool did_write_during_pass;
|
||||||
bool _in_write_pass;
|
bool _in_write_pass;
|
||||||
|
|
||||||
|
void unlocked_remove_duplicates ();
|
||||||
void unlocked_invalidate_insert_iterator ();
|
void unlocked_invalidate_insert_iterator ();
|
||||||
void add_guard_point (double when);
|
void add_guard_point (double when);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -314,6 +314,7 @@ ControlList::list_merge (ControlList const& other, boost::function<double(double
|
||||||
_events.clear ();
|
_events.clear ();
|
||||||
_events = nel;
|
_events = nel;
|
||||||
|
|
||||||
|
unlocked_remove_duplicates ();
|
||||||
unlocked_invalidate_insert_iterator ();
|
unlocked_invalidate_insert_iterator ();
|
||||||
mark_dirty ();
|
mark_dirty ();
|
||||||
}
|
}
|
||||||
|
|
@ -426,6 +427,24 @@ ControlList::unlocked_invalidate_insert_iterator ()
|
||||||
most_recent_insert_iterator = _events.end();
|
most_recent_insert_iterator = _events.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ControlList::unlocked_remove_duplicates ()
|
||||||
|
{
|
||||||
|
if (_events.size() < 2) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
iterator i = _events.begin();
|
||||||
|
iterator prev = i++;
|
||||||
|
while (i != _events.end()) {
|
||||||
|
if ((*prev)->when == (*i)->when && (*prev)->value == (*i)->value) {
|
||||||
|
i = _events.erase (i);
|
||||||
|
} else {
|
||||||
|
++prev;
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ControlList::start_write_pass (double when)
|
ControlList::start_write_pass (double when)
|
||||||
{
|
{
|
||||||
|
|
@ -954,6 +973,7 @@ ControlList::modify (iterator iter, double when, double val)
|
||||||
|
|
||||||
if (!_frozen) {
|
if (!_frozen) {
|
||||||
_events.sort (event_time_less_than);
|
_events.sort (event_time_less_than);
|
||||||
|
unlocked_remove_duplicates ();
|
||||||
unlocked_invalidate_insert_iterator ();
|
unlocked_invalidate_insert_iterator ();
|
||||||
} else {
|
} else {
|
||||||
_sort_pending = true;
|
_sort_pending = true;
|
||||||
|
|
@ -1018,6 +1038,7 @@ ControlList::thaw ()
|
||||||
|
|
||||||
if (_sort_pending) {
|
if (_sort_pending) {
|
||||||
_events.sort (event_time_less_than);
|
_events.sort (event_time_less_than);
|
||||||
|
unlocked_remove_duplicates ();
|
||||||
unlocked_invalidate_insert_iterator ();
|
unlocked_invalidate_insert_iterator ();
|
||||||
_sort_pending = false;
|
_sort_pending = false;
|
||||||
}
|
}
|
||||||
|
|
@ -1859,6 +1880,7 @@ ControlList::move_ranges (const list< RangeMove<double> >& movements)
|
||||||
|
|
||||||
if (!_frozen) {
|
if (!_frozen) {
|
||||||
_events.sort (event_time_less_than);
|
_events.sort (event_time_less_than);
|
||||||
|
unlocked_remove_duplicates ();
|
||||||
unlocked_invalidate_insert_iterator ();
|
unlocked_invalidate_insert_iterator ();
|
||||||
} else {
|
} else {
|
||||||
_sort_pending = true;
|
_sort_pending = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue