Skip to content

Commit a751a79

Browse files
author
Jeff Martin
committed
cleaned up debug code
1 parent 9f06bfd commit a751a79

1 file changed

Lines changed: 6 additions & 13 deletions

File tree

src/pv/pvStretch.cpp

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,7 @@ void PV_PlayBufStretch_next(PV_PlayBufStretch *unit, int inNumSamples) {
122122
const size_t stftBufFftSize = static_cast<size_t>(bufData[0]);
123123
const size_t stftBufHopSize = static_cast<size_t>(bufData[1] * stftBufFftSize); // in frames, not fraction
124124
const int stftBufWinType = static_cast<int>(bufData[2]); // -1, 0, or 1. This information is probably extraneous.
125-
//std::cout << "FFT size: " << stftBufFftSize << " Hop size: " << stftBufHopSize << " Win type: " << stftBufWinType << " STFT frames " << stftFrames << "\n";
126-
125+
127126
if (stftBufFftSize != buf->samples) {
128127
OUT0(0) = -1.f;
129128
std::cout << "WARNING: The FFT size of the STFT buffer (" << stftBufFftSize <<
@@ -150,8 +149,7 @@ void PV_PlayBufStretch_next(PV_PlayBufStretch *unit, int inNumSamples) {
150149
float startPos = sc_clip<float>(IN0(2), 0.0, 1.0);
151150
const float rate = IN0(3);
152151
const float loop = IN0(4);
153-
// std::cout << "Rate: " << rate << " Loop: " << loop << "\n";
154-
152+
155153
if (startPos != unit->m_startPos) {
156154
unit->m_startPos = startPos;
157155
unit->m_firstFrame = true;
@@ -162,7 +160,6 @@ void PV_PlayBufStretch_next(PV_PlayBufStretch *unit, int inNumSamples) {
162160

163161
// First we need to figure out where we are, and if that means we need to loop or quit.
164162
float newPos = unit->m_pos + rate;
165-
float debugNewPos = newPos;
166163
if (newPos > stftFrames - 1) {
167164
if (loop && rate > 0) {
168165
unit->m_firstFrame = true;
@@ -218,7 +215,7 @@ void PV_PlayBufStretch_next(PV_PlayBufStretch *unit, int inNumSamples) {
218215
size_t phaseLock = sc_clip(static_cast<size_t>(IN0(5)), 0, 2);
219216
SCPolarBuf *p = ToPolarApx(buf);
220217
size_t roundedPos = static_cast<size_t>(std::round(newPos));
221-
//std::cout << "New pos: " << intPos << "\n";
218+
222219
// If we're right smack on a specific FFT frame, we don't
223220
// need to do any magnitude or frequency interpolation, so
224221
// we only need the current and previous FFT frames from the buffer.
@@ -234,7 +231,6 @@ void PV_PlayBufStretch_next(PV_PlayBufStretch *unit, int inNumSamples) {
234231
// Render the output FFT frame
235232
switch (phaseLock) {
236233
case 1:
237-
// std::cout <<"P stretch\n";
238234
Stretch2Puckette(
239235
unit->m_frameNext,
240236
unit->m_framePrev1,
@@ -245,7 +241,6 @@ void PV_PlayBufStretch_next(PV_PlayBufStretch *unit, int inNumSamples) {
245241
);
246242
break;
247243
case 2:
248-
// std::cout <<"LD stretch\n";
249244
Stretch2LarocheDolson(
250245
unit->m_frameNext,
251246
unit->m_framePrev1,
@@ -289,7 +284,6 @@ void PV_PlayBufStretch_next(PV_PlayBufStretch *unit, int inNumSamples) {
289284
// Render the output FFT frame
290285
switch (phaseLock) {
291286
case 1:
292-
// std::cout <<"P stretch\n";
293287
Stretch3Puckette(
294288
unit->m_frameNext,
295289
unit->m_framePrev1,
@@ -302,7 +296,6 @@ void PV_PlayBufStretch_next(PV_PlayBufStretch *unit, int inNumSamples) {
302296
);
303297
break;
304298
case 2:
305-
// std::cout <<"LD stretch\n";
306299
Stretch3LarocheDolson(
307300
unit->m_frameNext,
308301
unit->m_framePrev1,
@@ -422,6 +415,9 @@ void Stretch2Puckette(
422415
std::complex<float> prevBinKPlus1 = std::polar<float>(outFramePrev->bin[xxk+1].mag, outFramePrev->bin[xxk+1].phase);
423416
prevPhase = std::arg(prevBinK - prevBinKMinus1 - prevBinKPlus1);
424417
}
418+
419+
// Compute the new phase
420+
outFrame->bin[xxk].phase = prevPhase + hopSize * instantaneousFreq;
425421
}
426422
}
427423

@@ -818,9 +814,6 @@ void copyPolarBuf(const SCPolarBuf *sourceBuf, SCPolarBuf *destBuf, size_t numbi
818814
Peak::Peak(size_t peak) : peak(peak) {}
819815
Peak::Peak(size_t peak, size_t leftValley, size_t rightValley) : peak(peak), leftValley(leftValley), rightValley(rightValley) {}
820816

821-
#define SHIFT(arr, idx, val) \
822-
for (size_t xxi = )
823-
824817
PeakFinder::PeakFinder(size_t fftSize, size_t radius) {
825818
m_maxSize = fftSize/2-1;
826819
m_radius = radius;

0 commit comments

Comments
 (0)