* update from personal repo (including some significant fixes)

This commit is contained in:
Chris Cannam
2008-11-26 22:31:55 +00:00
parent 4d875a5ef4
commit 0da1cfd87a
4 changed files with 21 additions and 4 deletions

View File

@@ -104,6 +104,14 @@ RubberBandStretcher::Impl::ChannelData::construct(const std::set<size_t> &window
for (size_t i = 0; i < initialWindowSize * oversample; ++i) {
dblbuf[i] = 0.0;
}
for (size_t i = 0; i < maxSize; ++i) {
accumulator[i] = 0.f;
windowAccumulator[i] = 0.f;
}
// Avoid dividing opening sample (which will be discarded anyway) by zero
windowAccumulator[0] = 1.f;
}
void

View File

@@ -934,9 +934,18 @@ RubberBandStretcher::Impl::calculateStretch()
{
Profiler profiler("RubberBandStretcher::Impl::calculateStretch");
size_t inputDuration = m_inputDuration;
if (!m_realtime && m_expectedInputDuration > 0) {
if (m_expectedInputDuration != inputDuration) {
std::cerr << "RubberBandStretcher: WARNING: Actual study() duration differs from duration set by setExpectedInputDuration (" << m_inputDuration << " vs " << m_expectedInputDuration << ", diff = " << (m_expectedInputDuration - m_inputDuration) << "), using the latter for calculation" << std::endl;
inputDuration = m_expectedInputDuration;
}
}
std::vector<int> increments = m_stretchCalculator->calculate
(getEffectiveRatio(),
m_inputDuration,
inputDuration,
m_phaseResetDf,
m_stretchDf);

View File

@@ -735,7 +735,7 @@ RubberBandStretcher::Impl::modifyChunk(size_t channel,
bool inherit = false;
if (laminar) {
if (distance >= mi) {
if (distance >= mi || i == count) {
inherit = false;
} else if (bandlimited && (i == bandhigh || i == bandlow)) {
inherit = false;

View File

@@ -110,7 +110,7 @@ float *allocFloat(float *ptr, int count)
void *allocated;
#ifndef _WIN32
#ifndef __APPLE__
if (!posix_memalign(&allocated, 16, count * sizeof(float)))
if (posix_memalign(&allocated, 16, count * sizeof(float)))
#endif
#endif
allocated = malloc(count * sizeof(float));
@@ -134,7 +134,7 @@ double *allocDouble(double *ptr, int count)
void *allocated;
#ifndef _WIN32
#ifndef __APPLE__
if (!posix_memalign(&allocated, 16, count * sizeof(double)))
if (posix_memalign(&allocated, 16, count * sizeof(double)))
#endif
#endif
allocated = malloc(count * sizeof(double));