From 178afb10dbdb17bb848a1f7778f2e56b85a83551 Mon Sep 17 00:00:00 2001 From: Yury Popov Date: Mon, 7 Nov 2022 15:17:01 +0300 Subject: [PATCH] Flush sonic stream on rate reset --- src/libespeak-ng/wavegen.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libespeak-ng/wavegen.c b/src/libespeak-ng/wavegen.c index e1695a0e..cc9d9dd4 100644 --- a/src/libespeak-ng/wavegen.c +++ b/src/libespeak-ng/wavegen.c @@ -1369,6 +1369,12 @@ static int WavegenFill2() #if HAVE_SONIC_H case WCMD_SONIC_SPEED: sonicSpeed = (double)q[1] / 1024; + if (sonicSpeedupStream && (sonicSpeed <= 1.0)) { + sonicFlushStream(sonicSpeedupStream); + int length = (out_end - out_ptr); + length = sonicReadShortFromStream(sonicSpeedupStream, (short*)out_ptr, length/2); + out_ptr += length * 2; + } break; #endif }