comparison 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
comparison
equal deleted inserted replaced
402:7e1b7fcb6c00 403:3012af787e4a
80 } 80 }
81 81
82 if (isDecodeCacheInitialised()) finishDecodeCache(); 82 if (isDecodeCacheInitialised()) finishDecodeCache();
83 endSerialised(); 83 endSerialised();
84 84
85 if (m_reporter) m_reporter->setProgress(100);
86
85 delete m_original; 87 delete m_original;
86 m_original = 0; 88 m_original = 0;
87 89
88 } else { 90 } else {
89 91
148 { 150 {
149 addSamplesToDecodeCache(frames); 151 addSamplesToDecodeCache(frames);
150 152
151 m_processed += frames.size(); 153 m_processed += frames.size();
152 154
153 int progress = lrint((float(m_processed) * 100) / 155 float ratio = float(m_sampleRate) / float(m_fileRate);
156
157 int progress = lrint((float(m_processed) * ratio * 100) /
154 float(m_original->getFrameCount())); 158 float(m_original->getFrameCount()));
155 159
156 if (progress > 99) progress = 99; 160 if (progress > 99) progress = 99;
157 m_completion = progress; 161 m_completion = progress;
158 162