changeset 286:5ba121f3889e piper-nopiper

Update for latest audio file reader changes & tests
author Chris Cannam
date Fri, 02 Dec 2016 09:33:00 +0000
parents 10cd9443fe48
children bd6e98b348cf
files .hgsubstate runner/FeatureExtractionManager.cpp
diffstat 2 files changed, 17 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/.hgsubstate	Wed Nov 30 20:59:59 2016 +0000
+++ b/.hgsubstate	Fri Dec 02 09:33:00 2016 +0000
@@ -3,5 +3,5 @@
 896aefe629c85b05ae0880ec93a396b9e3a5a304 dataquay
 3257ddb6fff110cc88f3ffeaeefa0f29d5eb3b6f piper-cpp
 5f67a29f0fc7f1b908f7cde4866173a7af337862 sv-dependency-builds
-079e553dc16e5b5586f7b5f967b9765057983544 svcore
+a421e752d22c71a9cd55db40a62f053f61d9ce57 svcore
 0eebd22a081a824067bf3d5de65326696feab653 vamp-plugin-sdk
--- a/runner/FeatureExtractionManager.cpp	Wed Nov 30 20:59:59 2016 +0000
+++ b/runner/FeatureExtractionManager.cpp	Fri Dec 02 09:33:00 2016 +0000
@@ -590,9 +590,14 @@
         // Open to determine validity, channel count, sample rate only
         // (then close, and open again later with actual desired rate &c)
 
+        AudioFileReaderFactory::Parameters params;
+        params.normalisation = (m_normalise ?
+                                AudioFileReaderFactory::Normalisation::Peak :
+                                AudioFileReaderFactory::Normalisation::None);
+        
         AudioFileReader *reader =
             AudioFileReaderFactory::createReader
-            (source, 0, m_normalise, m_verbose ? &retrievalProgress : 0);
+            (source, params, m_verbose ? &retrievalProgress : 0);
     
         if (!reader) {
             throw FailedToOpenFile(audioSource);
@@ -686,14 +691,23 @@
             reader = 0;
         }
     }
+
     if (!reader) {
         ProgressPrinter retrievalProgress("Retrieving audio data...");
         FileSource fs(source, m_verbose ? &retrievalProgress : 0);
         fs.waitForData();
+
+        AudioFileReaderFactory::Parameters params;
+        params.targetRate = m_sampleRate;
+        params.normalisation = (m_normalise ?
+                                AudioFileReaderFactory::Normalisation::Peak :
+                                AudioFileReaderFactory::Normalisation::None);
+        
         reader = AudioFileReaderFactory::createReader
-            (fs, m_sampleRate, m_normalise, m_verbose ? &retrievalProgress : 0);
+            (fs, params, m_verbose ? &retrievalProgress : 0);
         if (m_verbose) retrievalProgress.done();
     }
+    
     if (!reader) {
         throw FailedToOpenFile(source);
     }