From 84d445cffe3804187610dccb1db52e5fff0203cd Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Wed, 12 Jan 2022 02:55:11 -0800 Subject: [PATCH] Cog Audio: Fix converter so that seeking on startup playback position resume works properly --- Audio/Chain/ConverterNode.m | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Audio/Chain/ConverterNode.m b/Audio/Chain/ConverterNode.m index 8e8a62072..4c6bb5e3f 100644 --- a/Audio/Chain/ConverterNode.m +++ b/Audio/Chain/ConverterNode.m @@ -403,7 +403,15 @@ static void extrapolate(float *buffer, size_t channels, size_t frameSize, size_t while ([self shouldContinue] == YES) //Need to watch EOS somehow.... { int amountConverted = [self convert:writeBuf amount:CHUNK_SIZE]; - if (!amountConverted) break; + if (!amountConverted) + { + if (emittingSilence) + { + memset(writeBuf, 0, sizeof(writeBuf)); + amountConverted = CHUNK_SIZE; + } + else break; + } [self writeData:writeBuf amount:amountConverted]; } }