Implement setMaxProcessSize in R3
This commit is contained in:
@@ -206,7 +206,8 @@ public:
|
||||
void
|
||||
setMaxProcessSize(size_t samples)
|
||||
{
|
||||
if (m_r2) m_r2->setMaxProcessSize(samples); //!!! definitely need for r3d
|
||||
if (m_r2) m_r2->setMaxProcessSize(samples);
|
||||
else m_r3->setMaxProcessSize(samples);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -452,6 +452,23 @@ R3Stretcher::getSamplesRequired() const
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
R3Stretcher::setMaxProcessSize(size_t n)
|
||||
{
|
||||
size_t oldSize = m_channelData[0]->inbuf->getSize();
|
||||
size_t newSize = m_guideConfiguration.longestFftSize + n;
|
||||
|
||||
if (newSize > oldSize) {
|
||||
m_log.log(1, "setMaxProcessSize: resizing from and to", oldSize, newSize);
|
||||
for (int c = 0; c < m_parameters.channels; ++c) {
|
||||
m_channelData[c]->inbuf = std::unique_ptr<RingBuffer<float>>
|
||||
(m_channelData[c]->inbuf->resized(newSize));
|
||||
}
|
||||
} else {
|
||||
m_log.log(1, "setMaxProcessSize: nothing to be done, newSize <= oldSize", newSize, oldSize);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
R3Stretcher::process(const float *const *input, size_t samples, bool final)
|
||||
{
|
||||
@@ -505,8 +522,7 @@ R3Stretcher::process(const float *const *input, size_t samples, bool final)
|
||||
|
||||
size_t ws = m_channelData[0]->inbuf->getWriteSpace();
|
||||
if (samples > ws) {
|
||||
//!!! check this
|
||||
m_log.log(0, "R3Stretcher::process: WARNING: Forced to increase input buffer size. Either setMaxProcessSize was not properly called or process is being called repeatedly without retrieve.");
|
||||
m_log.log(0, "R3Stretcher::process: WARNING: Forced to increase input buffer size. Either setMaxProcessSize was not properly called or process is being called repeatedly without retrieve. Write space and samples", ws, samples);
|
||||
size_t newSize = m_channelData[0]->inbuf->getSize() - ws + samples;
|
||||
for (int c = 0; c < m_parameters.channels; ++c) {
|
||||
auto newBuf = m_channelData[c]->inbuf->resized(newSize);
|
||||
|
||||
@@ -86,6 +86,8 @@ public:
|
||||
|
||||
size_t getLatency() const;
|
||||
size_t getChannelCount() const;
|
||||
|
||||
void setMaxProcessSize(size_t samples);
|
||||
|
||||
void setDebugLevel(int level) {
|
||||
m_log.setDebugLevel(level);
|
||||
|
||||
Reference in New Issue
Block a user