changeset 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 5dcbda490794
children 2bc8bf6d016c
files framework/SVFileReader.cpp
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
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;