Wire up setExpectedInputDuration
This commit is contained in:
@@ -216,7 +216,7 @@ public:
|
|||||||
setExpectedInputDuration(size_t samples)
|
setExpectedInputDuration(size_t samples)
|
||||||
{
|
{
|
||||||
if (m_r2) m_r2->setExpectedInputDuration(samples);
|
if (m_r2) m_r2->setExpectedInputDuration(samples);
|
||||||
//!!! perhaps also for R3
|
else m_r3->setExpectedInputDuration(samples);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ R3Stretcher::R3Stretcher(Parameters parameters,
|
|||||||
m_unityCount(0),
|
m_unityCount(0),
|
||||||
m_startSkip(0),
|
m_startSkip(0),
|
||||||
m_studyInputDuration(0),
|
m_studyInputDuration(0),
|
||||||
|
m_suppliedInputDuration(0),
|
||||||
m_totalTargetDuration(0),
|
m_totalTargetDuration(0),
|
||||||
m_consumedInputDuration(0),
|
m_consumedInputDuration(0),
|
||||||
m_lastKeyFrameSurpassed(0),
|
m_lastKeyFrameSurpassed(0),
|
||||||
@@ -449,6 +450,7 @@ R3Stretcher::reset()
|
|||||||
m_prevOuthop = int(round(m_inhop * getEffectiveRatio()));
|
m_prevOuthop = int(round(m_inhop * getEffectiveRatio()));
|
||||||
|
|
||||||
m_studyInputDuration = 0;
|
m_studyInputDuration = 0;
|
||||||
|
m_suppliedInputDuration = 0;
|
||||||
m_totalTargetDuration = 0;
|
m_totalTargetDuration = 0;
|
||||||
m_consumedInputDuration = 0;
|
m_consumedInputDuration = 0;
|
||||||
m_lastKeyFrameSurpassed = 0;
|
m_lastKeyFrameSurpassed = 0;
|
||||||
@@ -479,6 +481,12 @@ R3Stretcher::study(const float *const *, size_t samples, bool)
|
|||||||
m_studyInputDuration += samples;
|
m_studyInputDuration += samples;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
R3Stretcher::setExpectedInputDuration(size_t samples)
|
||||||
|
{
|
||||||
|
m_suppliedInputDuration = samples;
|
||||||
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
R3Stretcher::getSamplesRequired() const
|
R3Stretcher::getSamplesRequired() const
|
||||||
{
|
{
|
||||||
@@ -518,12 +526,19 @@ R3Stretcher::process(const float *const *input, size_t samples, bool final)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isRealTime()) {
|
if (!isRealTime()) {
|
||||||
|
|
||||||
if (m_mode == ProcessMode::Studying) {
|
if (m_mode == ProcessMode::Studying) {
|
||||||
m_totalTargetDuration =
|
m_totalTargetDuration =
|
||||||
size_t(round(m_studyInputDuration * m_timeRatio));
|
size_t(round(m_studyInputDuration * m_timeRatio));
|
||||||
m_log.log(1, "study duration and target duration",
|
m_log.log(1, "study duration and target duration",
|
||||||
m_studyInputDuration, m_totalTargetDuration);
|
m_studyInputDuration, m_totalTargetDuration);
|
||||||
|
} else if (m_mode == ProcessMode::JustCreated) {
|
||||||
|
if (m_suppliedInputDuration != 0) {
|
||||||
|
m_totalTargetDuration =
|
||||||
|
size_t(round(m_suppliedInputDuration * m_timeRatio));
|
||||||
|
m_log.log(1, "supplied duration and target duration",
|
||||||
|
m_suppliedInputDuration, m_totalTargetDuration);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update this on every process round, checking whether we've
|
// Update this on every process round, checking whether we've
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ public:
|
|||||||
|
|
||||||
size_t getChannelCount() const;
|
size_t getChannelCount() const;
|
||||||
|
|
||||||
|
void setExpectedInputDuration(size_t samples);
|
||||||
void setMaxProcessSize(size_t samples);
|
void setMaxProcessSize(size_t samples);
|
||||||
|
|
||||||
void setDebugLevel(int level) {
|
void setDebugLevel(int level) {
|
||||||
@@ -303,6 +304,7 @@ protected:
|
|||||||
int m_startSkip;
|
int m_startSkip;
|
||||||
|
|
||||||
size_t m_studyInputDuration;
|
size_t m_studyInputDuration;
|
||||||
|
size_t m_suppliedInputDuration;
|
||||||
size_t m_totalTargetDuration;
|
size_t m_totalTargetDuration;
|
||||||
size_t m_consumedInputDuration;
|
size_t m_consumedInputDuration;
|
||||||
size_t m_lastKeyFrameSurpassed;
|
size_t m_lastKeyFrameSurpassed;
|
||||||
|
|||||||
Reference in New Issue
Block a user