changeset 1104:393134235fa0 simple-fft-model

Two-channel test
author Chris Cannam
date Tue, 16 Jun 2015 20:32:44 +0100
parents e86a7ea3dc38
children a27b1ce86e4f 16574eea3229
files base/StorageAdviser.cpp data/fileio/AudioFileSizeEstimator.cpp data/model/test/TestFFTModel.h data/model/test/test.pro
diffstat 4 files changed, 35 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/base/StorageAdviser.cpp	Tue Jun 16 20:28:23 2015 +0100
+++ b/base/StorageAdviser.cpp	Tue Jun 16 20:32:44 2015 +0100
@@ -22,7 +22,7 @@
 
 #include <iostream>
 
-#define DEBUG_STORAGE_ADVISER 1
+//#define DEBUG_STORAGE_ADVISER 1
 
 size_t StorageAdviser::m_discPlanned = 0;
 size_t StorageAdviser::m_memoryPlanned = 0;
--- a/data/fileio/AudioFileSizeEstimator.cpp	Tue Jun 16 20:28:23 2015 +0100
+++ b/data/fileio/AudioFileSizeEstimator.cpp	Tue Jun 16 20:32:44 2015 +0100
@@ -18,6 +18,8 @@
 
 #include <QFile>
 
+//#define DEBUG_AUDIO_FILE_SIZE_ESTIMATOR 1
+
 sv_frame_t
 AudioFileSizeEstimator::estimate(FileSource source,
 				 sv_samplerate_t targetRate)
@@ -61,7 +63,9 @@
 	{
 	    QFile f(source.getLocalFilename());
 	    if (f.open(QFile::ReadOnly)) {
+#ifdef DEBUG_AUDIO_FILE_SIZE_ESTIMATOR
 		cerr << "opened file, size is "  << f.size() << endl;
+#endif
 		sz = f.size();
 		f.close();
 	    }
@@ -90,11 +94,14 @@
 	    estimate = sv_frame_t(double(sz) * 1.2 * rateRatio);
 	}
 
+#ifdef DEBUG_AUDIO_FILE_SIZE_ESTIMATOR
 	cerr << "AudioFileSizeEstimator: for extension " << extension << ", estimate = " << estimate << endl;
-    
+#endif
     }
 
+#ifdef DEBUG_AUDIO_FILE_SIZE_ESTIMATOR
     cerr << "estimate = " << estimate << endl;
+#endif
     
     return estimate;
 }
--- a/data/model/test/TestFFTModel.h	Tue Jun 16 20:28:23 2015 +0100
+++ b/data/model/test/TestFFTModel.h	Tue Jun 16 20:32:44 2015 +0100
@@ -168,6 +168,31 @@
              { { {}, {}, {}, {}, {} } }, 4);
     }
     
+    void twochan_simple_rect() {
+	MockWaveModel mwm({ Sine, Cosine }, 16, 4);
+        // Test that the two channels are read and converted separately
+        test(&mwm, RectangularWindow, 8, 8, 8, 0,
+             {
+                 { {}, {}, {}, {}, {} },
+                 { {}, {}, {}, {}, {} }
+             }, 4);
+        test(&mwm, RectangularWindow, 8, 8, 8, 1,
+             {
+                 { {}, {  0.f, 2.f }, {}, {}, {} },
+                 { {}, { -2.f, 0.f }, {}, {}, {} }
+             }, 4);
+        test(&mwm, RectangularWindow, 8, 8, 8, 2,
+             {
+                 { {}, {  0.f, 2.f }, {}, {}, {} },
+                 { {}, { -2.f, 0.f }, {}, {}, {} }
+             }, 4);
+        test(&mwm, RectangularWindow, 8, 8, 8, 3,
+             {
+                 { {}, {}, {}, {}, {} },
+                 { {}, {}, {}, {}, {} }
+             }, 4);
+    }
+    
     void nyquist_simple_rect() {
 	MockWaveModel mwm({ Nyquist }, 16, 4);
         // Again, the sign is flipped. This has the same amount of
--- a/data/model/test/test.pro	Tue Jun 16 20:28:23 2015 +0100
+++ b/data/model/test/test.pro	Tue Jun 16 20:32:44 2015 +0100
@@ -61,7 +61,7 @@
 
 !win32 {
     !macx* {
-        QMAKE_POST_LINK=valgrind ./$${TARGET}
+        QMAKE_POST_LINK=./$${TARGET}
     }
     macx* {
         QMAKE_POST_LINK=./$${TARGET}.app/Contents/MacOS/$${TARGET}