From 5ac279e2894d29a9b296eca66bf9b91f61f34bd8 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Thu, 4 Aug 2022 18:01:09 -0700 Subject: [PATCH] [GME Input] Fix decoder output sample count The output has been assigning twice as many samples as it was supposed to ever since commit 8d851e5bdad2a863d5ab558fc5c521ae9c627362, which ended up generating the correct 1024 samples (2048 per GME parameter), but assigned 2048 to the AudioChunk, which resulted in over-reading the audio buffer, and thankfully not crashing, but instead causing an awful sound distortion effect as random memory contents were played as PCM audio. Fixes #320 Signed-off-by: Christopher Snowhill --- Plugins/GME/GameDecoder.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/GME/GameDecoder.m b/Plugins/GME/GameDecoder.m index 7477f6d39..f5974cf6e 100644 --- a/Plugins/GME/GameDecoder.m +++ b/Plugins/GME/GameDecoder.m @@ -198,7 +198,7 @@ gme_err_t readCallback(void *data, void *out, int count) { //(From gme.txt) If track length, then use it. If loop length, play for intro + loop * 2. Otherwise, default to 2.5 minutes // GME will always generate samples. There's no real EOS. - [chunk assignSamples:sampleBuffer frameCount:numSamples]; + [chunk assignSamples:sampleBuffer frameCount:frames]; return chunk; }