When reading codec2 data, pad out to a multiple of 8 bytes with 0s so that when frames are pushed from the buffer, we don't get garbage at the ends of prompts which are not an exact multiple of 8 bytes.

md1702
vk7js 2022-07-05 10:16:36 +10:00 zatwierdzone przez Silvano Seva
rodzic 69b023dd4a
commit befc892068
1 zmienionych plików z 7 dodań i 0 usunięć

Wyświetl plik

@ -154,6 +154,13 @@ static void GetCodec2Data(int offset, int length)
fseek(voice_prompt_file, vpDataOffset+offset, SEEK_SET);
fread((void*)&Codec2Data, length, 1, voice_prompt_file);
// zero buffer from length to the next multiple of 8 to avoid garbage
// being played back, since codec2 frames are pushed in lots of 8 bytes.
if ((length % 8) != 0)
{
int bytesToZero = length % 8;
memset(Codec2Data+length, 0, bytesToZero);
}
}
void vpTerminate(void)