diff framework/SVFileReader.cpp @ 362:5302c548adad tonioni

Merge
author Chris Cannam
date Fri, 13 Jun 2014 13:51:17 +0100
parents b38268e34c09 88bf6cc73275
children f1cab64363d7
line wrap: on
line diff
--- a/framework/SVFileReader.cpp	Fri Jun 13 13:45:40 2014 +0100
+++ b/framework/SVFileReader.cpp	Fri Jun 13 13:51:17 2014 +0100
@@ -448,7 +448,7 @@
     READ_MANDATORY(int, sampleRate, toInt);
 
     QString type = attributes.value("type").trimmed();
-    bool mainModel = (attributes.value("mainModel").trimmed() == "true");
+    bool isMainModel = (attributes.value("mainModel").trimmed() == "true");
 
     if (type == "wavefile") {
 	
@@ -475,12 +475,13 @@
 
             size_t rate = sampleRate;
 
-            if (rate == 0) {
-                if (!mainModel &&
-                    Preferences::getInstance()->getResampleOnLoad()) {
-                    WaveFileModel *mm = m_document->getMainModel();
-                    if (mm) rate = mm->getSampleRate();
-                }
+            if (Preferences::getInstance()->getFixedSampleRate() != 0) {
+                rate = Preferences::getInstance()->getFixedSampleRate();
+            } else if (rate == 0 &&
+                       !isMainModel &&
+                       Preferences::getInstance()->getResampleOnLoad()) {
+                WaveFileModel *mm = m_document->getMainModel();
+                if (mm) rate = mm->getSampleRate();
             }
 
             model = new WaveFileModel(file, rate);
@@ -494,7 +495,7 @@
 
         model->setObjectName(name);
 	m_models[id] = model;
-	if (mainModel) {
+	if (isMainModel) {
 	    m_document->setMainModel(model);
 	    m_addedModels.insert(model);
 	}