diff --git a/libs/ardour/ardour/location.h b/libs/ardour/ardour/location.h index df31dde5a2..d7c7d79869 100644 --- a/libs/ardour/ardour/location.h +++ b/libs/ardour/ardour/location.h @@ -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); diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc index 636f7d9154..7f9af25950 100644 --- a/libs/ardour/location.cc +++ b/libs/ardour/location.cc @@ -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 */ + } +}