Provide a separate window source buffer to simplify single/multi window logic

This commit is contained in:
Chris Cannam
2022-08-04 10:02:09 +01:00
parent 2fa0e1162e
commit d1386b0a0c
2 changed files with 27 additions and 25 deletions

View File

@@ -132,7 +132,7 @@ protected:
FixedVector<process_t> accumulator;
int accumulatorFill;
ChannelScaleData(int _fftSize, int _timeDomainLength) :
ChannelScaleData(int _fftSize, int _longestFftSize) :
fftSize(_fftSize),
bufSize(fftSize/2 + 1),
timeDomain(fftSize, 0.f),
@@ -143,7 +143,7 @@ protected:
advancedPhase(bufSize, 0.f),
prevMag(bufSize, 0.f),
pendingKick(bufSize, 0.f),
accumulator(_timeDomainLength, 0.f),
accumulator(_longestFftSize, 0.f),
accumulatorFill(0)
{ }
@@ -202,7 +202,7 @@ protected:
std::unique_ptr<FormantData> formant;
ChannelData(BinSegmenter::Parameters segmenterParameters,
BinClassifier::Parameters classifierParameters,
int timeDomainLength,
int longestFftSize,
int inRingBufferSize,
int outRingBufferSize) :
scales(),
@@ -215,7 +215,7 @@ protected:
BinClassifier::Classification::Residual),
segmenter(new BinSegmenter(segmenterParameters)),
segmentation(), prevSegmentation(), nextSegmentation(),
mixdown(timeDomainLength, 0.f),
mixdown(longestFftSize, 0.f),
resampled(outRingBufferSize, 0.f),
inbuf(new RingBuffer<float>(inRingBufferSize)),
outbuf(new RingBuffer<float>(outRingBufferSize)),
@@ -297,7 +297,7 @@ protected:
std::map<int, std::shared_ptr<ScaleData>> m_scaleData;
Guide m_guide;
Guide::Configuration m_guideConfiguration;
int m_timeDomainFrameLength;
FixedVector<process_t> m_windowSourceBuffer;
ChannelAssembly m_channelAssembly;
std::unique_ptr<StretchCalculator> m_calculator;
std::unique_ptr<Resampler> m_resampler;
@@ -376,6 +376,15 @@ protected:
return m_parameters.options &
RubberBandStretcher::OptionWindowShort;
}
int getWindowSourceBufferLength() const {
if (m_guideConfiguration.longestFftSize >
m_guideConfiguration.classificationFftSize) {
return m_guideConfiguration.longestFftSize;
} else {
return (m_guideConfiguration.classificationFftSize * 3) / 2;
}
}
};
}