ensure that imported regions have names based on the files they are based on
[ardour.git] / libs / ardour / audio_playlist.cc
index acb44e43c477b9841c4799a0db54c916d6c26c5a..6e8b35a07238e8661058cef8f5453f42ab9fa85d 100644 (file)
@@ -102,10 +102,6 @@ AudioPlaylist::AudioPlaylist (boost::shared_ptr<const AudioPlaylist> other, nfra
 
 AudioPlaylist::~AudioPlaylist ()
 {
-       drop_references ();
-
-       /* drop connections to signals */
-
        _crossfades.clear ();
 }
 
@@ -424,7 +420,7 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh)
                                   audio engineering.
                                */
 
-                               xfade_length = min ((nframes_t) 720, top->length());
+                               xfade_length = min ((framecnt_t) 720, top->length());
 
                                if (top_region_at (top->first_frame()) == top) {
 
@@ -458,7 +454,7 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh)
                                } else {
 
                                        touched_regions = regions_touched (top->first_frame(),
-                                                                          top->first_frame() + min ((nframes_t)_session.config.get_short_xfade_seconds() * _session.frame_rate(),
+                                                                          top->first_frame() + min ((framecnt_t) _session.config.get_short_xfade_seconds() * _session.frame_rate(),
                                                                                                     top->length()));
                                        if (touched_regions->size() <= 2) {
                                                xfade = boost::shared_ptr<Crossfade> (new Crossfade (region, other, _session.config.get_xfade_model(), _session.config.get_xfades_active()));
@@ -484,7 +480,7 @@ AudioPlaylist::check_dependents (boost::shared_ptr<Region> r, bool norefresh)
 
                                } else {
                                        touched_regions = regions_touched (bottom->first_frame(),
-                                                                          bottom->first_frame() + min ((nframes_t)_session.config.get_short_xfade_seconds() * _session.frame_rate(),
+                                                                          bottom->first_frame() + min ((framecnt_t)_session.config.get_short_xfade_seconds() * _session.frame_rate(),
                                                                                                        bottom->length()));
                                        if (touched_regions->size() <= 2) {
                                                xfade = boost::shared_ptr<Crossfade> (new Crossfade (region, other, _session.config.get_xfade_model(), _session.config.get_xfades_active()));
@@ -528,8 +524,8 @@ AudioPlaylist::add_crossfade (boost::shared_ptr<Crossfade> xfade)
        } else {
                _crossfades.push_back (xfade);
 
-               scoped_connect (xfade->Invalidated, boost::bind (&AudioPlaylist::crossfade_invalidated, this, _1));
-               scoped_connect (xfade->StateChanged, boost::bind (&AudioPlaylist::crossfade_changed, this, _1));
+               xfade->Invalidated.connect_same_thread (*this, boost::bind (&AudioPlaylist::crossfade_invalidated, this, _1));
+               xfade->PropertyChanged.connect_same_thread (*this, boost::bind (&AudioPlaylist::crossfade_changed, this, _1));
 
                notify_crossfade_added (xfade);
        }
@@ -584,8 +580,8 @@ AudioPlaylist::set_state (const XMLNode& node, int version)
                try {
                        boost::shared_ptr<Crossfade> xfade = boost::shared_ptr<Crossfade> (new Crossfade (*((const Playlist *)this), *child));
                        _crossfades.push_back (xfade);
-                       scoped_connect (xfade->Invalidated, boost::bind (&AudioPlaylist::crossfade_invalidated, this, _1));
-                       scoped_connect (xfade->StateChanged, boost::bind (&AudioPlaylist::crossfade_changed, this, _1));
+                       xfade->Invalidated.connect_same_thread (*this, boost::bind (&AudioPlaylist::crossfade_invalidated, this, _1));
+                       xfade->PropertyChanged.connect_same_thread (*this, boost::bind (&AudioPlaylist::crossfade_changed, this, _1));
                        NewCrossfade(xfade);
                }
 
@@ -730,7 +726,7 @@ AudioPlaylist::destroy_region (boost::shared_ptr<Region> region)
 }
 
 void
-AudioPlaylist::crossfade_changed (Change)
+AudioPlaylist::crossfade_changed (const PropertyChange&)
 {
        if (in_flush || in_set_state) {
                return;
@@ -742,29 +738,32 @@ AudioPlaylist::crossfade_changed (Change)
           that occured.
        */
 
-       notify_modified ();
+       notify_contents_changed ();
 }
 
 bool
-AudioPlaylist::region_changed (Change what_changed, boost::shared_ptr<Region> region)
+AudioPlaylist::region_changed (const PropertyChange& what_changed, boost::shared_ptr<Region> region)
 {
        if (in_flush || in_set_state) {
                return false;
        }
 
-       Change our_interests = Change (AudioRegion::FadeInChanged|
-                                      AudioRegion::FadeOutChanged|
-                                      AudioRegion::FadeInActiveChanged|
-                                      AudioRegion::FadeOutActiveChanged|
-                                      AudioRegion::EnvelopeActiveChanged|
-                                      AudioRegion::ScaleAmplitudeChanged|
-                                      AudioRegion::EnvelopeChanged);
+       PropertyChange our_interests;
+
+       our_interests.add (Properties::fade_in_active);
+       our_interests.add (Properties::fade_out_active);
+       our_interests.add (Properties::scale_amplitude);
+       our_interests.add (Properties::envelope_active);
+       our_interests.add (Properties::envelope);
+       our_interests.add (Properties::fade_in);
+       our_interests.add (Properties::fade_out);
+
        bool parent_wants_notify;
 
        parent_wants_notify = Playlist::region_changed (what_changed, region);
 
-       if ((parent_wants_notify || (what_changed & our_interests))) {
-               notify_modified ();
+       if (parent_wants_notify || (what_changed.contains (our_interests))) {
+               notify_contents_changed ();
        }
 
        return true;