|
From: Lasse Kärkkäi. <tr...@us...> - 2010-09-14 22:08:58
|
Module: performous
Branch: master
Commit: 8926b55eb9392b13aae7b5e8761ed33d1c7ab74e
Author: Lasse Karkkainen <tro...@tr...>
Date: Wed Sep 15 00:24:07 2010 +0300
Cleanup to pitch.hh (hopefully I don't break it again).
---
game/pitch.hh | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/game/pitch.hh b/game/pitch.hh
index 7cc617f..52b14ae 100644
--- a/game/pitch.hh
+++ b/game/pitch.hh
@@ -48,7 +48,6 @@ class Analyzer {
template <typename InIt> void input(InIt begin, InIt end) {
size_t r = m_bufRead; // The read position
size_t w = m_bufWrite; // The write position
- size_t wNext; // The next write position
bool overflow = false;
while (begin != end) {
float s = *begin++; // Read input sample
@@ -57,12 +56,11 @@ class Analyzer {
if (p > m_peak) m_peak = p; else m_peak *= 0.999;
m_buf[w] = s;
// Cursor updates
- wNext = (w + 1) % BUF_N;
- if (wNext == r) overflow = true;
- w = wNext;
+ w = (w + 1) % BUF_N;
+ if (w == r) overflow = true;
}
m_bufWrite = w;
- if (overflow) m_bufRead = (wNext + 1) % BUF_N; // Reset read pointer on overflow
+ if (overflow) m_bufRead = w; // Reset read pointer on overflow
}
/** Call this to process all data input so far. **/
void process();
|