# HG changeset patch # User Chris Cannam # Date 1435656383 -3600 # Node ID 16574eea3229569733af0ce77db646366d8391e6 # Parent 393134235fa0f1aa9cd4d1fc68a732030296365e# Parent bead35921256d7d21b83beffebe5f9a3b7641ea9 Merge diff -r bead35921256 -r 16574eea3229 base/StorageAdviser.cpp --- a/base/StorageAdviser.cpp Tue Jun 30 10:25:32 2015 +0100 +++ b/base/StorageAdviser.cpp Tue Jun 30 10:26:23 2015 +0100 @@ -22,7 +22,7 @@ #include -#define DEBUG_STORAGE_ADVISER 1 +//#define DEBUG_STORAGE_ADVISER 1 size_t StorageAdviser::m_discPlanned = 0; size_t StorageAdviser::m_memoryPlanned = 0; @@ -91,7 +91,7 @@ ssize_t maxmb = ssize_t(maximumSize / 1024 + 1); if (memoryFree == -1) memoryStatus = Unknown; - else if (memoryFree < memoryTotal / 3) memoryStatus = Insufficient; + else if (memoryFree < memoryTotal / 3 && memoryFree < 512) memoryStatus = Insufficient; else if (minmb > (memoryFree * 3) / 4) memoryStatus = Insufficient; else if (maxmb > (memoryFree * 3) / 4) memoryStatus = Marginal; else if (minmb > (memoryFree / 3)) memoryStatus = Marginal; diff -r bead35921256 -r 16574eea3229 data/fileio/AudioFileSizeEstimator.cpp --- a/data/fileio/AudioFileSizeEstimator.cpp Tue Jun 30 10:25:32 2015 +0100 +++ b/data/fileio/AudioFileSizeEstimator.cpp Tue Jun 30 10:26:23 2015 +0100 @@ -18,6 +18,8 @@ #include +//#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; } diff -r bead35921256 -r 16574eea3229 data/fileio/CodedAudioFileReader.cpp --- a/data/fileio/CodedAudioFileReader.cpp Tue Jun 30 10:25:32 2015 +0100 +++ b/data/fileio/CodedAudioFileReader.cpp Tue Jun 30 10:26:23 2015 +0100 @@ -467,7 +467,7 @@ if (m_normalised) { for (auto &f: frames) f *= m_gain; } - + return frames; } diff -r bead35921256 -r 16574eea3229 data/fileio/WavFileReader.cpp --- a/data/fileio/WavFileReader.cpp Tue Jun 30 10:25:32 2015 +0100 +++ b/data/fileio/WavFileReader.cpp Tue Jun 30 10:26:23 2015 +0100 @@ -157,7 +157,6 @@ sv_frame_t n = count * m_fileInfo.channels; data.resize(n); - m_buffer = data; m_lastStart = start; m_lastCount = count; @@ -166,6 +165,7 @@ return {}; } + m_buffer = data; return data; } diff -r bead35921256 -r 16574eea3229 data/model/test/TestFFTModel.h --- a/data/model/test/TestFFTModel.h Tue Jun 30 10:25:32 2015 +0100 +++ b/data/model/test/TestFFTModel.h Tue Jun 30 10:26:23 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 diff -r bead35921256 -r 16574eea3229 data/model/test/test.pro --- a/data/model/test/test.pro Tue Jun 30 10:25:32 2015 +0100 +++ b/data/model/test/test.pro Tue Jun 30 10:26:23 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}