* fix bug in initial state of accumulator; fix compiler warnings
This commit is contained in:
@@ -31,9 +31,9 @@ AudioCurve::~AudioCurve()
|
||||
}
|
||||
|
||||
float
|
||||
AudioCurve::process(const double *R__ mag, size_t increment)
|
||||
AudioCurve::processDouble(const double *R__ mag, size_t increment)
|
||||
{
|
||||
cerr << "WARNING: Using inefficient AudioCurve::process(double)" << endl;
|
||||
cerr << "AudioCurve::processDouble: WARNING: Using inefficient and lossy conversion for AudioCurve::process(float)" << endl;
|
||||
float *tmp = new float[m_windowSize];
|
||||
for (int i = 0; i < int(m_windowSize); ++i) tmp[i] = float(mag[i]);
|
||||
float df = process(tmp, increment);
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
virtual void setWindowSize(size_t newSize) = 0;
|
||||
|
||||
virtual float process(const float *R__ mag, size_t increment) = 0;
|
||||
virtual float process(const double *R__ mag, size_t increment);
|
||||
virtual float processDouble(const double *R__ mag, size_t increment);
|
||||
virtual void reset() = 0;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -281,6 +281,16 @@ RubberBandStretcher::Impl::ChannelData::reset()
|
||||
|
||||
if (resampler) resampler->reset();
|
||||
|
||||
size_t size = inbuf->getSize();
|
||||
|
||||
for (size_t i = 0; i < size; ++i) {
|
||||
accumulator[i] = 0.f;
|
||||
windowAccumulator[i] = 0.f;
|
||||
}
|
||||
|
||||
// Avoid dividing opening sample (which will be discarded anyway) by zero
|
||||
windowAccumulator[0] = 1.f;
|
||||
|
||||
accumulatorFill = 0;
|
||||
prevIncrement = 0;
|
||||
chunkCount = 0;
|
||||
|
||||
@@ -447,8 +447,8 @@ RubberBandStretcher::Impl::calculateIncrements(size_t &phaseIncrementRtn,
|
||||
|
||||
if (m_channels == 1) {
|
||||
|
||||
df = m_phaseResetAudioCurve->process(cd.mag, m_increment);
|
||||
silent = (m_silentAudioCurve->process(cd.mag, m_increment) > 0.f);
|
||||
df = m_phaseResetAudioCurve->processDouble(cd.mag, m_increment);
|
||||
silent = (m_silentAudioCurve->processDouble(cd.mag, m_increment) > 0.f);
|
||||
|
||||
} else {
|
||||
|
||||
@@ -463,8 +463,8 @@ RubberBandStretcher::Impl::calculateIncrements(size_t &phaseIncrementRtn,
|
||||
}
|
||||
}
|
||||
|
||||
df = m_phaseResetAudioCurve->process(tmp, m_increment);
|
||||
silent = (m_silentAudioCurve->process(tmp, m_increment) > 0.f);
|
||||
df = m_phaseResetAudioCurve->processDouble(tmp, m_increment);
|
||||
silent = (m_silentAudioCurve->processDouble(tmp, m_increment) > 0.f);
|
||||
}
|
||||
|
||||
int incr = m_stretchCalculator->calculateSingle
|
||||
|
||||
Reference in New Issue
Block a user