Introduce getPreferredStartPad(), deprecate getLatency() and replace with getStartDelay(); document and test both

This commit is contained in:
Chris Cannam
2022-07-05 17:53:36 +01:00
parent 31984af826
commit 72654b04ea
8 changed files with 255 additions and 70 deletions

View File

@@ -367,13 +367,23 @@ R3Stretcher::getFormantScale() const
}
size_t
R3Stretcher::getLatency() const
R3Stretcher::getPreferredStartPad() const
{
if (!isRealTime()) {
return 0;
} else {
return size_t(ceil(m_guideConfiguration.longestFftSize
* 0.5 * m_pitchScale));
return m_guideConfiguration.longestFftSize / 2;
}
}
size_t
R3Stretcher::getStartDelay() const
{
if (!isRealTime()) {
return 0;
} else {
double factor = 0.5 / m_pitchScale;
return size_t(ceil(m_guideConfiguration.longestFftSize * factor));
}
}
@@ -509,12 +519,7 @@ R3Stretcher::process(const float *const *input, size_t samples, bool final)
// NB by the time we skip this later we may have resampled
// as well as stretched
m_startSkip = int(round(pad / m_pitchScale));
if (m_startSkip < 0) {
m_log.log(0, "WARNING: calculated start skip < 0", m_startSkip);
m_startSkip = 0;
} else {
m_log.log(1, "start skip is", m_startSkip);
}
m_log.log(1, "start skip is", m_startSkip);
}
}

View File

@@ -84,7 +84,9 @@ public:
int available() const;
size_t retrieve(float *const *output, size_t samples) const;
size_t getLatency() const;
size_t getPreferredStartPad() const;
size_t getStartDelay() const;
size_t getChannelCount() const;
void setMaxProcessSize(size_t samples);