Heavy-duty abstraction work to split type-specific classes into
[ardour.git] / libs / ardour / audioregion.cc
index 4a8593cd631e35c6f21574a1996b820c45d68ab6..fff1c99598fa18c848646c04dadcf9e99b2253db 100644 (file)
@@ -48,13 +48,13 @@ using namespace ARDOUR;
 
 /* a Session will reset these to its chosen defaults by calling AudioRegion::set_default_fade() */
 
-Change AudioRegion::FadeInChanged = ARDOUR::new_change();
-Change AudioRegion::FadeOutChanged = ARDOUR::new_change();
-Change AudioRegion::FadeInActiveChanged = ARDOUR::new_change();
-Change AudioRegion::FadeOutActiveChanged = ARDOUR::new_change();
+Change AudioRegion::FadeInChanged         = ARDOUR::new_change();
+Change AudioRegion::FadeOutChanged        = ARDOUR::new_change();
+Change AudioRegion::FadeInActiveChanged   = ARDOUR::new_change();
+Change AudioRegion::FadeOutActiveChanged  = ARDOUR::new_change();
 Change AudioRegion::EnvelopeActiveChanged = ARDOUR::new_change();
 Change AudioRegion::ScaleAmplitudeChanged = ARDOUR::new_change();
-Change AudioRegion::EnvelopeChanged = ARDOUR::new_change();
+Change AudioRegion::EnvelopeChanged       = ARDOUR::new_change();
 
 AudioRegionState::AudioRegionState (string why)
        : RegionState (why),
@@ -633,12 +633,6 @@ AudioRegion::_read_at (const SourceList& srcs, Sample *buf, Sample *mixdown_buff
        return to_read;
 }
        
-XMLNode&
-AudioRegion::get_state ()
-{
-       return state (true);
-}
-
 XMLNode&
 AudioRegion::state (bool full)
 {
@@ -1139,24 +1133,22 @@ AudioRegion::master_source_names ()
 }
 
 bool
-AudioRegion::region_list_equivalent (const AudioRegion& other) const
+AudioRegion::source_equivalent (const Region& o) const
 {
-       return size_equivalent (other) && source_equivalent (other) && _name == other._name;
-}
+       const AudioRegion* other = dynamic_cast<const AudioRegion*>(&o);
+       if (!other)
+               return false;
 
-bool
-AudioRegion::source_equivalent (const AudioRegion& other) const
-{
        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) {
+       for (i = sources.begin(), io = other->sources.begin(); i != sources.end() && io != other->sources.end(); ++i, ++io) {
                if ((*i)->id() != (*io)->id()) {
                        return false;
                }
        }
 
-       for (i = master_sources.begin(), io = other.master_sources.begin(); i != master_sources.end() && io != other.master_sources.end(); ++i, ++io) {
+       for (i = master_sources.begin(), io = other->master_sources.begin(); i != master_sources.end() && io != other->master_sources.end(); ++i, ++io) {
                if ((*i)->id() != (*io)->id()) {
                        return false;
                }
@@ -1165,27 +1157,6 @@ AudioRegion::source_equivalent (const AudioRegion& other) const
        return true;
 }
 
-bool
-AudioRegion::overlap_equivalent (const AudioRegion& other) const
-{
-       return coverage (other.first_frame(), other.last_frame()) != OverlapNone;
-}
-
-bool
-AudioRegion::equivalent (const AudioRegion& other) const
-{
-       return _start == other._start &&
-               _position == other._position &&
-               _length == other._length;
-}
-
-bool
-AudioRegion::size_equivalent (const AudioRegion& other) const
-{
-       return _start == other._start &&
-               _length == other._length;
-}
-
 int
 AudioRegion::apply (AudioFilter& filter)
 {