ensure that imported regions have names based on the files they are based on
[ardour.git] / libs / ardour / session.cc
index c7270e6ce98239152414e7eef4db7f0ff1ff84e3..decb2603fe98a73fd7268a7eea62c16a646d269f 100644 (file)
@@ -41,6 +41,7 @@
 #include "pbd/basename.h"
 #include "pbd/stacktrace.h"
 #include "pbd/file_utils.h"
+#include "pbd/convert.h"
 
 #include "ardour/amp.h"
 #include "ardour/analyser.h"
@@ -2809,7 +2810,7 @@ Session::add_regions (vector<boost::shared_ptr<Region> >& new_regions)
                                }
                        }
 
-                       region->StateChanged.connect_same_thread (*this, boost::bind (&Session::region_changed, this, _1, boost::weak_ptr<Region>(region)));
+                       region->PropertyChanged.connect_same_thread (*this, boost::bind (&Session::region_changed, this, _1, boost::weak_ptr<Region>(region)));
                        update_region_name_map (region);
                }
 
@@ -2839,7 +2840,7 @@ Session::update_region_name_map (boost::shared_ptr<Region> region)
 }
 
 void
-Session::region_changed (Change what_changed, boost::weak_ptr<Region> weak_region)
+Session::region_changed (const PropertyChange& what_changed, boost::weak_ptr<Region> weak_region)
 {
        boost::shared_ptr<Region> region (weak_region.lock ());
 
@@ -2847,12 +2848,12 @@ Session::region_changed (Change what_changed, boost::weak_ptr<Region> weak_regio
                return;
        }
 
-       if (what_changed & Region::HiddenChanged) {
+       if (what_changed.contains (Properties::hidden)) {
                /* relay hidden changes */
                RegionHiddenChange (region);
        }
 
-       if (what_changed & NameChanged) {
+       if (what_changed.contains (Properties::name)) {
                update_region_name_map (region);
        }
 }
@@ -3674,7 +3675,7 @@ Session::bundle_by_name (string name) const
 }
 
 void
-Session::tempo_map_changed (Change)
+Session::tempo_map_changed (const PropertyChange&)
 {
        clear_clicks ();
 
@@ -4068,9 +4069,14 @@ Session::write_one_track (AudioTrack& track, nframes_t start, nframes_t end,
 
                /* construct a region to represent the bounced material */
 
-               result = RegionFactory::create (srcs, 0,
-                               srcs.front()->length(srcs.front()->timeline_position()),
-                               region_name_from_path (srcs.front()->name(), true));
+               PropertyList plist;
+               
+               plist.add (Properties::start, 0);
+               plist.add (Properties::length, srcs.front()->length(srcs.front()->timeline_position()));
+               plist.add (Properties::name, region_name_from_path (srcs.front()->name(), true));
+               
+               result = RegionFactory::create (srcs, plist);
+                          
        }
 
   out: