|
From: Tapio V. <aa...@us...> - 2010-09-14 18:19:20
|
Module: performous
Branch: master
Commit: 8d64557571abcc1bd8efdf90839e7200c5603dd2
Author: Tapio Vierros <tap...@gm...>
Date: Tue Sep 14 21:18:41 2010 +0300
Fixed Analyzer::input so that we can sing again.
---
game/libda/sample.hpp | 2 +-
game/pitch.hh | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/game/libda/sample.hpp b/game/libda/sample.hpp
index 5d53b6e..7c055a4 100644
--- a/game/libda/sample.hpp
+++ b/game/libda/sample.hpp
@@ -55,7 +55,7 @@ namespace da {
ValueType& operator*() { return *m_pos; }
step_iterator operator+(std::ptrdiff_t rhs) { return step_iterator(m_pos + m_step * rhs, m_step); }
step_iterator& operator++() { m_pos += m_step; return *this; }
- step_iterator operator++(int) { step_iterator ret = *this; ++*this; return ret; }
+ step_iterator operator++(int) { step_iterator ret = *this; ++*this; return ret; }
bool operator!=(step_iterator const& rhs) const { return m_pos != rhs.m_pos; }
std::ptrdiff_t operator-(step_iterator const& rhs) const { return (m_pos - rhs.m_pos) / m_step; }
// TODO: more operators
diff --git a/game/pitch.hh b/game/pitch.hh
index 2f27bf3..7cc617f 100644
--- a/game/pitch.hh
+++ b/game/pitch.hh
@@ -55,13 +55,14 @@ class Analyzer {
// Peak level calculation
float p = s * s;
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;
}
m_bufWrite = w;
- if (overflow) m_bufRead = wNext; // Reset read pointer on overflow
+ if (overflow) m_bufRead = (wNext + 1) % BUF_N; // Reset read pointer on overflow
}
/** Call this to process all data input so far. **/
void process();
|