diff options
author | Robin Gareus <robin@gareus.org> | 2019-03-12 15:15:44 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2019-03-12 15:17:12 +0100 |
commit | d7314e0048b92a1694abc79727134ebd59e288fc (patch) | |
tree | 40e3b577b1d9da3c5b024c5d6f343ec51fc6f874 /libs | |
parent | eea603d998be2f33a058c455fa6b86f6f10da815 (diff) |
Add a time+layer equivalence check
This is more useful than exact_equivalent() since _start offset
may not match in some cases (compounds, import, record with different
capture latencies).
However shared group editing (range, copy/paste) does result in
consistent layers and matching position+length.
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/region.h | 1 | ||||
-rw-r--r-- | libs/ardour/ardour/types.h | 3 | ||||
-rw-r--r-- | libs/ardour/enums.cc | 1 | ||||
-rw-r--r-- | libs/ardour/playlist.cc | 7 | ||||
-rw-r--r-- | libs/ardour/region.cc | 8 |
5 files changed, 19 insertions, 1 deletions
diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h index 5d0413beb8..ab3e2886d6 100644 --- a/libs/ardour/ardour/region.h +++ b/libs/ardour/ardour/region.h @@ -205,6 +205,7 @@ public: bool size_equivalent (boost::shared_ptr<const Region>) const; bool overlap_equivalent (boost::shared_ptr<const Region>) const; bool enclosed_equivalent (boost::shared_ptr<const Region>) const; + bool layer_and_time_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; diff --git a/libs/ardour/ardour/types.h b/libs/ardour/ardour/types.h index 733429b175..19c96fb130 100644 --- a/libs/ardour/ardour/types.h +++ b/libs/ardour/ardour/types.h @@ -631,7 +631,8 @@ typedef std::vector<boost::shared_ptr<Bundle> > BundleList; enum RegionEquivalence { Exact, Enclosed, - Overlap + Overlap, + LayerTime }; enum WaveformScale { diff --git a/libs/ardour/enums.cc b/libs/ardour/enums.cc index d0afc9a07b..1fd1359d5d 100644 --- a/libs/ardour/enums.cc +++ b/libs/ardour/enums.cc @@ -694,6 +694,7 @@ setup_enum_writer () REGISTER_ENUM(Exact); REGISTER_ENUM(Enclosed); REGISTER_ENUM(Overlap); + REGISTER_ENUM(LayerTime); REGISTER(_RegionEquivalence); REGISTER_ENUM(Linear); diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index 3dce9123a9..bf95fde434 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -846,6 +846,13 @@ Playlist::get_equivalent_regions (boost::shared_ptr<Region> other, vector<boost: } } break; + case LayerTime: + for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) { + if ((*i)->layer_and_time_equivalent (other)) { + results.push_back (*i); + } + } + break; case Enclosed: for (RegionList::iterator i = regions.begin(); i != regions.end(); ++i) { if ((*i)->enclosed_equivalent (other)) { diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index deffd11224..13dcdff326 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -1485,6 +1485,14 @@ Region::enclosed_equivalent (boost::shared_ptr<const Region> other) const } bool +Region::layer_and_time_equivalent (boost::shared_ptr<const Region> other) const +{ + return _layer == other->_layer && + _position == other->_position && + _length == other->_length; +} + +bool Region::exact_equivalent (boost::shared_ptr<const Region> other) const { return _start == other->_start && |