changeset 403:3012af787e4a

* Fix progress reporting on audio file resample * Remove some debug output
author Chris Cannam
date Thu, 24 Apr 2008 14:25:28 +0000
parents 7e1b7fcb6c00
children 4884fba80e00
files data/fileio/CodedAudioFileReader.cpp data/fileio/MatrixFile.cpp data/fileio/ResamplingWavFileReader.cpp transform/Transform.cpp
diffstat 4 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/data/fileio/CodedAudioFileReader.cpp	Thu Apr 10 12:43:26 2008 +0000
+++ b/data/fileio/CodedAudioFileReader.cpp	Thu Apr 24 14:25:28 2008 +0000
@@ -79,7 +79,7 @@
 void
 CodedAudioFileReader::endSerialised()
 {
-    std::cerr << "CodedAudioFileReader::endSerialised" << std::endl;
+//    std::cerr << "CodedAudioFileReader::endSerialised" << std::endl;
 
     delete m_serialiser;
     m_serialiser = 0;
--- a/data/fileio/MatrixFile.cpp	Thu Apr 10 12:43:26 2008 +0000
+++ b/data/fileio/MatrixFile.cpp	Thu Apr 24 14:25:28 2008 +0000
@@ -32,8 +32,8 @@
 #include <QFileInfo>
 #include <QDir>
 
-#define DEBUG_MATRIX_FILE 1
-#define DEBUG_MATRIX_FILE_READ_SET 1
+//#define DEBUG_MATRIX_FILE 1
+//#define DEBUG_MATRIX_FILE_READ_SET 1
 
 #ifdef DEBUG_MATRIX_FILE_READ_SET
 #ifndef DEBUG_MATRIX_FILE
--- a/data/fileio/ResamplingWavFileReader.cpp	Thu Apr 10 12:43:26 2008 +0000
+++ b/data/fileio/ResamplingWavFileReader.cpp	Thu Apr 24 14:25:28 2008 +0000
@@ -82,6 +82,8 @@
         if (isDecodeCacheInitialised()) finishDecodeCache();
         endSerialised();
 
+        if (m_reporter) m_reporter->setProgress(100);
+
         delete m_original;
         m_original = 0;
 
@@ -150,7 +152,9 @@
 
     m_processed += frames.size();
 
-    int progress = lrint((float(m_processed) * 100) /
+    float ratio = float(m_sampleRate) / float(m_fileRate);
+
+    int progress = lrint((float(m_processed) * ratio * 100) /
                          float(m_original->getFrameCount()));
 
     if (progress > 99) progress = 99;
--- a/transform/Transform.cpp	Thu Apr 10 12:43:26 2008 +0000
+++ b/transform/Transform.cpp	Thu Apr 24 14:25:28 2008 +0000
@@ -246,8 +246,8 @@
 void
 Transform::setParameter(QString name, float value)
 {
-    std::cerr << "Transform::setParameter(" << name.toStdString()
-              << ") -> " << value << std::endl;
+//    std::cerr << "Transform::setParameter(" << name.toStdString()
+//              << ") -> " << value << std::endl;
     m_parameters[name] = value;
 }