bugfix: flush() didn't properly flush final samples from the pipeline on 2nd time, in case that soundtouch object instance were recycled and used for processing a 2nd audio stream.

This commit is contained in:
oparviai 2016-01-10 10:31:35 +00:00
parent 9287800b65
commit 882f248a0c

View File

@ -359,6 +359,7 @@ void SoundTouch::flush()
// how many samples are still expected to output // how many samples are still expected to output
numStillExpected = (int)((long)(samplesExpectedOut + 0.5) - samplesOutput); numStillExpected = (int)((long)(samplesExpectedOut + 0.5) - samplesOutput);
if (numStillExpected < 0) numStillExpected = 0;
memset(buff, 0, 128 * channels * sizeof(SAMPLETYPE)); memset(buff, 0, 128 * channels * sizeof(SAMPLETYPE));
// "Push" the last active samples out from the processing pipeline by // "Push" the last active samples out from the processing pipeline by
@ -477,6 +478,7 @@ int SoundTouch::getSetting(int settingId) const
void SoundTouch::clear() void SoundTouch::clear()
{ {
samplesExpectedOut = 0; samplesExpectedOut = 0;
samplesOutput = 0;
pRateTransposer->clear(); pRateTransposer->clear();
pTDStretch->clear(); pTDStretch->clear();
} }