# HG changeset patch # User Chris Cannam # Date 1158225897 0 # Node ID c1aee08c60b13c26f25fcf118dad424f592c2ede # Parent 67d54627efd3c2532d88f64c3252c160f7957b92 * avoid using n2 in processBlock diff -r 67d54627efd3 -r c1aee08c60b1 audioio/PhaseVocoderTimeStretcher.cpp --- a/audioio/PhaseVocoderTimeStretcher.cpp Wed Sep 13 18:58:17 2006 +0000 +++ b/audioio/PhaseVocoderTimeStretcher.cpp Thu Sep 14 09:24:57 2006 +0000 @@ -232,7 +232,7 @@ bool thisChannelPercussive = processBlock(c, m_dbuf, m_mashbuf[c], c == 0 ? m_modulationbuf : 0, - m_prevPercussive); + m_prevPercussive ? m_n1 : m_n2); if (thisChannelPercussive && c == 0) { isPercussive = true; @@ -322,7 +322,7 @@ PhaseVocoderTimeStretcher::processBlock(size_t c, float *buf, float *out, float *modulation, - bool lastPercussive) + size_t lastStep) { size_t i; bool isPercussive = false; @@ -375,9 +375,6 @@ m_prevPercussiveCount[c] = count; } - size_t n2 = m_n2; - if (lastPercussive) n2 = m_n1; - for (i = 0; i < m_wlen; ++i) { float mag; @@ -399,7 +396,8 @@ float phaseIncrement = (omega + phaseError) / m_n1; - float adjustedPhase = m_prevAdjustedPhase[c][i] + n2 * phaseIncrement; + float adjustedPhase = m_prevAdjustedPhase[c][i] + + lastStep * phaseIncrement; if (isPercussive) adjustedPhase = phase; diff -r 67d54627efd3 -r c1aee08c60b1 audioio/PhaseVocoderTimeStretcher.h --- a/audioio/PhaseVocoderTimeStretcher.h Wed Sep 13 18:58:17 2006 +0000 +++ b/audioio/PhaseVocoderTimeStretcher.h Thu Sep 14 09:24:57 2006 +0000 @@ -125,7 +125,7 @@ bool processBlock(size_t channel, float *in, float *out, float *modulation, - bool lastPercussive); + size_t lastStep); size_t m_channels; float m_ratio;