interpolation.cc/.h: Spline-Bugfixes: Crash bug at tempos close to 0, wrong calculati...
[ardour.git] / libs / ardour / audio_region_importer.cc
index ab8261a369cc950d16806a2e1fe221bf24b3a783..de5d6f7102cd97bde49576f0553cc5b3c2bf30be 100644 (file)
 
 */
 
-#include <ardour/audio_region_importer.h>
+#include "ardour/audio_region_importer.h"
 
 #include <sstream>
 
-#include <pbd/failed_constructor.h>
-#include <pbd/compose.h>
-#include <pbd/error.h>
+#include "pbd/failed_constructor.h"
+#include "pbd/compose.h"
+#include "pbd/error.h"
 
-#include <ardour/session.h>
-#include <ardour/region.h>
-#include <ardour/source_factory.h>
-#include <ardour/region_factory.h>
-#include <ardour/session_directory.h>
+#include "ardour/session.h"
+#include "ardour/region.h"
+#include "ardour/source_factory.h"
+#include "ardour/region_factory.h"
+#include "ardour/session_directory.h"
 
 #include "i18n.h"
 
+using namespace std;
 using namespace PBD;
 using namespace ARDOUR;
 
@@ -118,6 +119,10 @@ AudioRegionImporter::AudioRegionImporter (XMLTree const & source, Session & sess
        handler.register_id (old_id, id);
 }
 
+AudioRegionImporter::~AudioRegionImporter ()
+{
+}
+
 string
 AudioRegionImporter::get_info () const
 {
@@ -148,20 +153,18 @@ AudioRegionImporter::get_info () const
 }
 
 bool
-AudioRegionImporter::prepare_move ()
+AudioRegionImporter::_prepare_move ()
 {
-       queued = true;
        return true;
 }
 
 void
-AudioRegionImporter::cancel_move ()
+AudioRegionImporter::_cancel_move ()
 {
-       queued = false;
 }
 
 void
-AudioRegionImporter::move ()
+AudioRegionImporter::_move ()
 {
        if (!region_prepared) {
                prepare_region();
@@ -180,7 +183,7 @@ AudioRegionImporter::move ()
 bool
 AudioRegionImporter::parse_xml_region ()
 {
-       XMLPropertyList const & props = xml_region.properties();;
+       XMLPropertyList const & props = xml_region.properties();
        bool id_ok = false;
        bool name_ok = false;
        
@@ -190,6 +193,7 @@ AudioRegionImporter::parse_xml_region ()
                  !prop.compare ("shift") || !prop.compare ("first_edit") ||
                  !prop.compare ("layer") || !prop.compare ("flags") ||
                  !prop.compare ("scale-gain") || !prop.compare("channels") ||
+                 !prop.compare ("first-edit") ||
                  prop.find ("master-source-") == 0 || prop.find ("source-") == 0) {
                        // All ok
                } else if (!prop.compare ("start") || !prop.compare ("length") ||
@@ -209,7 +213,7 @@ AudioRegionImporter::parse_xml_region ()
                        (*it)->set_value (name);
                        name_ok = true;
                } else {
-                       std::cerr << string_compose (X_("AudioRegionImporter (%1): did not recognise XML-property \"%1\""), name, prop) << endmsg;
+                       std::cerr << string_compose (X_("AudioRegionImporter (%1): did not recognise XML-property \"%2\""), name, prop) << endmsg;
                }
        }
        
@@ -256,7 +260,7 @@ AudioRegionImporter::parse_source_xml ()
                snprintf (buf, sizeof(buf), X_("source-%d"), i);
                prop = xml_region.property (buf);
                if (!prop) {
-                       error << string_compose (X_("AudioRegionImporter (%1): did not find necessary XML-property \"%3\""), name, buf) << endmsg;
+                       error << string_compose (X_("AudioRegionImporter (%1): did not find necessary XML-property \"%2\""), name, buf) << endmsg;
                        return false;
                }
                string source_id = prop->value();
@@ -333,23 +337,22 @@ AudioRegionImporter::prepare_sources ()
                return;
        }
        
-       Session::import_status status;
+       status.total = 0;
+       status.replace_existing_source = false;
+       status.done = false;
+       status.cancel = false;
+       status.freeze = false;
+       status.progress = 0.0;
+       status.quality = SrcBest; // TODO other qualities also
        
        // Get sources that still need to be imported
        for (std::list<string>::iterator it = filenames.begin(); it != filenames.end(); ++it) {
                if (!handler.check_source (*it)) {
                        status.paths.push_back (*it);
+                       status.total++;
                }
        }
        
-       // Prepare rest of import struct TODO quality
-       status.replace_existing_source = false;
-       status.done = false;
-       status.cancel = false;
-       status.freeze = false;
-       status.progress = 0.0;
-       status.quality = SrcBest;
-       
        // import files
        // TODO: threading & exception handling
        session.import_audiofiles (status);