13
0

libardour: add Locations::ripple()

This commit is contained in:
Paul Davis 2021-05-28 14:33:31 -06:00
parent ac1fd6d448
commit 9766132a53
2 changed files with 37 additions and 0 deletions

View File

@ -205,6 +205,8 @@ public:
bool clear_xrun_markers ();
bool clear_ranges ();
void ripple (samplepos_t at, samplecnt_t distance, bool include_locked, bool notify);
XMLNode& get_state (void);
int set_state (const XMLNode&, int version);
Location *get_location_by_id(PBD::ID);

View File

@ -1612,3 +1612,38 @@ Locations::range_starts_at(samplepos_t pos, samplecnt_t slop, bool incl) const
return closest;
}
void
Locations::ripple (samplepos_t at, samplecnt_t distance, bool include_locked, bool notify)
{
Glib::Threads::RWLock::WriterLock lm (_lock);
for (LocationList::iterator i = locations.begin(); i != locations.end(); ) {
if (!include_locked && (*i)->locked()) {
continue;
}
bool locked = (*i)->locked();
if (locked) {
(*i)->unlock ();
}
if ((*i)->start() >= at) {
(*i)->set_start ((*i)->start() - distance);
if (!(*i)->is_mark()) {
(*i)->set_end ((*i)->end() - distance);
}
}
if (locked) {
(*i)->locked();
}
}
if (notify) {
changed(); /* EMIT SIGNAL */
}
}