|
From: Lasse Kärkkäi. <tr...@us...> - 2011-01-25 16:04:57
|
Module: editor
Branch: master
Commit: 60164a8f8b9be7be3cb90a8e53518272dbf1c595
Author: Lasse Karkkainen <tro...@tr...>
Date: Tue Jan 25 17:04:24 2011 +0100
Workaround the audio analysis bug (the real fix would go to ffmpeg.*)
---
pitchvis.cc | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/pitchvis.cc b/pitchvis.cc
index d3b1678..64ecae5 100644
--- a/pitchvis.cc
+++ b/pitchvis.cc
@@ -36,15 +36,16 @@ void PitchVis::run()
}
msleep(1000); // Wait some more
setWidth(mpeg.duration() * rate / step); // Estimation
-
curX = 0;
for (std::vector<float> data(step*2); mpeg.audioQueue(&*data.begin(), &*data.end(), curX * step * 2); ++curX) {
+ msleep(2);
// Mix stereo into mono
for (unsigned i = 0; i < step; ++i) data[i] = 0.5 * (data[2*i] + data[2*i + 1]);
// Process
analyzer.input(&data[0], &data[step]);
analyzer.process();
if (cancelled) return;
+ std::fill(data.begin(), data.end(), 0.0f);
}
}
// Draw, TODO: Draw somewhere else (on demand) without a huge bitmap
|