changeset 361:b38268e34c09 tonioni

The session file records the sample rate that each audio file was saved at. Use it. This is a fix to part of https://code.soundsoftware.ac.uk/issues/970, but it also replaces the commit at https://code.soundsoftware.ac.uk/projects/svapp/repository/revisions/9554c19c42fd with a fix to the earlier bug http://sourceforge.net/p/sv1/bugs/107/. I think this is a better way than the earlier code.
author Chris Cannam
date Fri, 13 Jun 2014 13:45:40 +0100
parents 1f2a4ad79967
children 5302c548adad
files framework/SVFileReader.cpp
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/framework/SVFileReader.cpp	Fri Jun 13 10:37:04 2014 +0100
+++ b/framework/SVFileReader.cpp	Fri Jun 13 13:45:40 2014 +0100
@@ -473,12 +473,14 @@
 
             file.waitForData();
 
-            size_t rate = 0;
+            size_t rate = sampleRate;
 
-            if (!mainModel &&
-                Preferences::getInstance()->getResampleOnLoad()) {
-                WaveFileModel *mm = m_document->getMainModel();
-                if (mm) rate = mm->getSampleRate();
+            if (rate == 0) {
+                if (!mainModel &&
+                    Preferences::getInstance()->getResampleOnLoad()) {
+                    WaveFileModel *mm = m_document->getMainModel();
+                    if (mm) rate = mm->getSampleRate();
+                }
             }
 
             model = new WaveFileModel(file, rate);