summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/playlist.h14
-rw-r--r--libs/ardour/ardour/types.h1
-rw-r--r--libs/ardour/enums.cc1
-rw-r--r--libs/ardour/playlist.cc71
-rw-r--r--libs/ardour/utils.cc5
5 files changed, 86 insertions, 6 deletions
diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h
index 5629a04629..ababa60063 100644
--- a/libs/ardour/ardour/playlist.h
+++ b/libs/ardour/ardour/playlist.h
@@ -144,6 +144,14 @@ public:
void uncombine (boost::shared_ptr<Region>);
void shuffle (boost::shared_ptr<Region>, int dir);
+ void ripple (framepos_t at, framecnt_t distance, RegionList *exclude);
+ void ripple (framepos_t at, framecnt_t distance, boost::shared_ptr<Region> exclude) {
+ RegionList el;
+ if (exclude)
+ el.push_back (exclude);
+ ripple (at, distance, &el);
+ }
+
void update_after_tempo_map_change ();
boost::shared_ptr<Playlist> cut (std::list<AudioRange>&, bool result_is_hidden = true);
@@ -283,6 +291,7 @@ public:
bool first_set_state;
bool _hidden;
bool _splicing;
+ bool _rippling;
bool _shuffling;
bool _nudging;
uint32_t _refcnt;
@@ -337,6 +346,11 @@ public:
void splice_locked (framepos_t at, framecnt_t distance, boost::shared_ptr<Region> exclude);
void splice_unlocked (framepos_t at, framecnt_t distance, boost::shared_ptr<Region> exclude);
+ void core_ripple (framepos_t at, framecnt_t distance, RegionList *exclude);
+ void ripple_locked (framepos_t at, framecnt_t distance, RegionList *exclude);
+ void ripple_unlocked (framepos_t at, framecnt_t distance, RegionList *exclude);
+
+
virtual void remove_dependents (boost::shared_ptr<Region> /*region*/) {}
virtual XMLNode& state (bool);
diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h
index 1b9c3326c0..92a8c0da5b 100644
--- a/libs/ardour/ardour/types.h
+++ b/libs/ardour/ardour/types.h
@@ -341,6 +341,7 @@ namespace ARDOUR {
enum EditMode {
Slide,
Splice,
+ Ripple,
Lock
};
diff --git a/libs/ardour/enums.cc b/libs/ardour/enums.cc
index 948025cc2b..3f5ce75eb3 100644
--- a/libs/ardour/enums.cc
+++ b/libs/ardour/enums.cc
@@ -237,6 +237,7 @@ setup_enum_writer ()
REGISTER_ENUM (Slide);
REGISTER_ENUM (Splice);
+ REGISTER_ENUM (Ripple); // XXX do the old enum values have to stay in order?
REGISTER_ENUM (Lock);
REGISTER (_EditMode);
diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc
index d939ba61b0..11ca20972e 100644
--- a/libs/ardour/playlist.cc
+++ b/libs/ardour/playlist.cc
@@ -172,6 +172,7 @@ Playlist::Playlist (boost::shared_ptr<const Playlist> other, string namestr, boo
in_set_state--;
_splicing = other->_splicing;
+ _rippling = other->_rippling;
_nudging = other->_nudging;
_edit_mode = other->_edit_mode;
@@ -302,6 +303,7 @@ Playlist::init (bool hide)
_refcnt = 0;
_hidden = hide;
_splicing = false;
+ _rippling = false;
_shuffling = false;
_nudging = false;
in_set_state = 0;
@@ -1399,7 +1401,7 @@ Playlist::flush_notifications (bool from_undo)
if (_edit_mode == Splice) {
splice_locked (at, distance, exclude);
- }
+ }
}
void
@@ -1456,12 +1458,63 @@ Playlist::flush_notifications (bool from_undo)
_splicing = false;
notify_contents_changed ();
- }
+}
- void
- Playlist::region_bounds_changed (const PropertyChange& what_changed, boost::shared_ptr<Region> region)
- {
- if (in_set_state || _splicing || _nudging || _shuffling) {
+void
+Playlist::ripple_locked (framepos_t at, framecnt_t distance, RegionList *exclude)
+{
+ {
+ RegionWriteLock rl (this);
+ core_ripple (at, distance, exclude);
+ }
+}
+
+void
+Playlist::ripple_unlocked (framepos_t at, framecnt_t distance, RegionList *exclude)
+{
+ core_ripple (at, distance, exclude);
+}
+
+void
+Playlist::core_ripple (framepos_t at, framecnt_t distance, RegionList *exclude)
+{
+ if (distance == 0) {
+ return;
+ }
+
+ _rippling = true;
+ RegionListProperty copy = regions;
+ for (RegionList::iterator i = copy.begin(); i != copy.end(); ++i) {
+ assert (i != copy.end());
+
+ if (exclude) {
+ if (std::find(exclude->begin(), exclude->end(), (*i)) != exclude->end()) {
+ continue;
+ }
+ }
+
+ if ((*i)->position() >= at) {
+ framepos_t new_pos = (*i)->position() + distance;
+ framepos_t limit = max_framepos - (*i)->length();
+ if (new_pos < 0) {
+ new_pos = 0;
+ } else if (new_pos >= limit ) {
+ new_pos = limit;
+ }
+
+ (*i)->set_position (new_pos);
+ }
+ }
+
+ _rippling = false;
+ notify_contents_changed ();
+}
+
+
+void
+Playlist::region_bounds_changed (const PropertyChange& what_changed, boost::shared_ptr<Region> region)
+{
+ if (in_set_state || _splicing || _rippling || _nudging || _shuffling) {
return;
}
@@ -2695,6 +2748,12 @@ Playlist::region_is_shuffle_constrained (boost::shared_ptr<Region>)
}
void
+Playlist::ripple (framepos_t at, framecnt_t distance, RegionList *exclude)
+{
+ ripple_locked (at, distance, exclude);
+}
+
+void
Playlist::update_after_tempo_map_change ()
{
RegionWriteLock rlock (const_cast<Playlist*> (this));
diff --git a/libs/ardour/utils.cc b/libs/ardour/utils.cc
index d1d2372977..715c0d67dc 100644
--- a/libs/ardour/utils.cc
+++ b/libs/ardour/utils.cc
@@ -396,6 +396,8 @@ string_to_edit_mode (string str)
return Splice;
} else if (str == _("Slide")) {
return Slide;
+ } else if (str == _("Ripple")) {
+ return Ripple;
} else if (str == _("Lock")) {
return Lock;
}
@@ -414,6 +416,9 @@ edit_mode_to_string (EditMode mode)
case Lock:
return _("Lock");
+ case Ripple:
+ return _("Ripple");
+
default:
case Splice:
return _("Splice");