changeset 362:5302c548adad tonioni

Merge
author Chris Cannam
date Fri, 13 Jun 2014 13:51:17 +0100
parents b38268e34c09 (current diff) 88bf6cc73275 (diff)
children f5c914661f6f
files framework/SVFileReader.cpp
diffstat 2 files changed, 15 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Fri Jun 13 13:45:40 2014 +0100
+++ b/framework/MainWindowBase.cpp	Fri Jun 13 13:51:17 2014 +0100
@@ -1219,7 +1219,9 @@
 
     size_t rate = 0;
 
-    if (Preferences::getInstance()->getResampleOnLoad()) {
+    if (Preferences::getInstance()->getFixedSampleRate() != 0) {
+        rate = Preferences::getInstance()->getFixedSampleRate();
+    } else if (Preferences::getInstance()->getResampleOnLoad()) {
         rate = m_playSource->getSourceSampleRate();
     }
 
@@ -3189,7 +3191,9 @@
 //    SVDEBUG << "MainWindowBase::mainModelChanged(" << model << ")" << endl;
     updateDescriptionLabel();
     if (model) m_viewManager->setMainModelSampleRate(model->getSampleRate());
-    if (model && !m_playTarget && m_audioOutput) createPlayTarget();
+    if (model && !m_playTarget && m_audioOutput) {
+        createPlayTarget();
+    }
 }
 
 void
--- 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);
 	}