summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/ardour/playlist.h1
-rw-r--r--libs/ardour/ardour/region.h1
-rw-r--r--libs/ardour/playlist.cc11
-rw-r--r--libs/ardour/region.cc19
4 files changed, 32 insertions, 0 deletions
diff --git a/libs/ardour/ardour/playlist.h b/libs/ardour/ardour/playlist.h
index f3277c6b9c..754e48cc25 100644
--- a/libs/ardour/ardour/playlist.h
+++ b/libs/ardour/ardour/playlist.h
@@ -132,6 +132,7 @@ public:
void remove_region_by_source (boost::shared_ptr<Source>);
void get_equivalent_regions (boost::shared_ptr<Region>, std::vector<boost::shared_ptr<Region> >&);
void get_region_list_equivalent_regions (boost::shared_ptr<Region>, std::vector<boost::shared_ptr<Region> >&);
+ void get_source_equivalent_regions (boost::shared_ptr<Region>, std::vector<boost::shared_ptr<Region> >&);
void replace_region (boost::shared_ptr<Region> old, boost::shared_ptr<Region> newr, framepos_t pos);
void split_region (boost::shared_ptr<Region>, framepos_t position);
void split (framepos_t at);
diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h
index 85cdce6e92..bc8e7383f2 100644
--- a/libs/ardour/ardour/region.h
+++ b/libs/ardour/ardour/region.h
@@ -200,6 +200,7 @@ class Region
bool overlap_equivalent (boost::shared_ptr<const Region>) const;
bool region_list_equivalent (boost::shared_ptr<const Region>) const;
bool source_equivalent (boost::shared_ptr<const Region>) const;
+ bool any_source_equivalent (boost::shared_ptr<const Region>) const;
bool uses_source (boost::shared_ptr<const Source>) const;
std::string source_string () const;
diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc
index 4e731ee06c..c5d52f7345 100644
--- a/libs/ardour/playlist.cc
+++ b/libs/ardour/playlist.cc
@@ -845,6 +845,17 @@ Playlist::flush_notifications (bool from_undo)
}
void
+ Playlist::get_source_equivalent_regions (boost::shared_ptr<Region> other, vector<boost::shared_ptr<Region> >& results)
+ {
+ for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) {
+
+ if ((*i) && (*i)->any_source_equivalent (other)) {
+ results.push_back (*i);
+ }
+ }
+ }
+
+ void
Playlist::partition (framepos_t start, framepos_t end, bool cut)
{
RegionList thawlist;
diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc
index c74ce4e419..952e8b5c9c 100644
--- a/libs/ardour/region.cc
+++ b/libs/ardour/region.cc
@@ -1407,6 +1407,25 @@ Region::source_equivalent (boost::shared_ptr<const Region> other) const
return true;
}
+bool
+Region::any_source_equivalent (boost::shared_ptr<const Region> other) const
+{
+ if (!other) {
+ return false;
+ }
+
+ SourceList::const_iterator i;
+ SourceList::const_iterator io;
+
+ for (i = _sources.begin(), io = other->_sources.begin(); i != _sources.end() && io != other->_sources.end(); ++i, ++io) {
+ if ((*i)->id() == (*io)->id()) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
std::string
Region::source_string () const
{