diff data/fileio/ResamplingWavFileReader.cpp @ 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 be49bf95d4a5
children b4a8d8221eaf
line wrap: on
line diff
--- 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;