diff framework/SVFileReader.cpp @ 116:9554c19c42fd

* Fix #1903059 "resample on import" not applied when reloading session
author Chris Cannam
date Tue, 20 May 2008 10:14:15 +0000
parents c82913d31a53
children e2aec1708a2c
line wrap: on
line diff
--- a/framework/SVFileReader.cpp	Mon May 19 17:23:11 2008 +0000
+++ b/framework/SVFileReader.cpp	Tue May 20 10:14:15 2008 +0000
@@ -19,6 +19,7 @@
 #include "view/View.h"
 #include "base/PlayParameters.h"
 #include "base/PlayParameterRepository.h"
+#include "base/Preferences.h"
 
 #include "data/fileio/AudioFileReaderFactory.h"
 #include "data/fileio/FileSource.h"
@@ -456,7 +457,16 @@
         } else {
 
             file.waitForData();
-            model = new WaveFileModel(file);
+
+            size_t rate = 0;
+
+            if (!mainModel &&
+                Preferences::getInstance()->getResampleOnLoad()) {
+                WaveFileModel *mm = m_document->getMainModel();
+                if (mm) rate = mm->getSampleRate();
+            }
+
+            model = new WaveFileModel(file, rate);
             if (!model->isOK()) {
                 delete model;
                 model = 0;