Clean up session after test.
[ardour.git] / libs / ardour / audio_region_importer.cc
index c9203435d539dc0266acfca7934c84205ea78ca5..6f6bd8250136b12db62632f5aa31dea555b1e43c 100644 (file)
@@ -126,7 +126,7 @@ AudioRegionImporter::~AudioRegionImporter ()
 string
 AudioRegionImporter::get_info () const
 {
-       nframes_t length, position;
+       framecnt_t length, position;
        Timecode::Time length_time, position_time;
        std::ostringstream oss;
 
@@ -176,8 +176,6 @@ AudioRegionImporter::_move ()
        if (broken()) {
                return;
        }
-
-       session.add_regions (region);
 }
 
 bool
@@ -209,7 +207,7 @@ AudioRegionImporter::parse_xml_region ()
                } else if (!prop.compare("name")) {
                        // rename region if necessary
                        name = (*it)->value();
-                       name = session.new_region_name (name);
+                       name = RegionFactory::new_region_name (name);
                        (*it)->set_value (name);
                        name_ok = true;
                } else {
@@ -252,7 +250,7 @@ AudioRegionImporter::parse_source_xml ()
                return false;
        }
 
-       channels = atoi (prop->value());
+       channels = atoi (prop->value().c_str());
        for (uint32_t i = 0; i < channels; ++i) {
                bool source_found = false;
 
@@ -266,7 +264,7 @@ AudioRegionImporter::parse_source_xml ()
                string source_id = prop->value();
 
                // Get source
-               for (XMLNodeList::const_iterator it = sources.begin(); it != sources.end(); it++) {
+               for (XMLNodeList::const_iterator it = sources.begin(); it != sources.end(); ++it) {
                        prop = (*it)->property ("id");
                        if (prop && !source_id.compare (prop->value())) {
                                source_path = source_dir;
@@ -319,7 +317,11 @@ AudioRegionImporter::prepare_region ()
        }
 
        // create region and update XML
-       region.push_back (RegionFactory::create (source_list, xml_region));
+       boost::shared_ptr<Region> r = RegionFactory::create (source_list, xml_region);
+       if (session.config.get_glue_new_regions_to_bars_and_beats ()) {
+               r->set_position_lock_style (MusicTime);
+       }
+       region.push_back (r);
        if (*region.begin()) {
                xml_region = (*region.begin())->get_state();
        } else {
@@ -358,7 +360,7 @@ AudioRegionImporter::prepare_sources ()
        session.import_audiofiles (status);
 
        // Add imported sources to handlers map
-       std::vector<Glib::ustring>::iterator file_it = status.paths.begin();
+       std::vector<string>::iterator file_it = status.paths.begin();
        for (SourceList::iterator source_it = status.sources.begin(); source_it != status.sources.end(); ++source_it) {
                if (*source_it) {
                        handler.add_source(*file_it, *source_it);