Mercurial > hg > sonic-visualiser
changeset 18:c1aee08c60b1
* avoid using n2 in processBlock
author | Chris Cannam |
---|---|
date | Thu, 14 Sep 2006 09:24:57 +0000 |
parents | 67d54627efd3 |
children | f17798a555df |
files | audioio/PhaseVocoderTimeStretcher.cpp audioio/PhaseVocoderTimeStretcher.h |
diffstat | 2 files changed, 5 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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;
--- 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;