all repos — mgba @ 5b3a2e04b1d46152fc6e6307bf9ceaefdd6e8ff4

mGBA Game Boy Advance Emulator

GBA Audio: Redo lavr audio loop
Jeffrey Pfau jeffrey@endrift.com
Tue, 23 Dec 2014 21:57:42 -0800
commit

5b3a2e04b1d46152fc6e6307bf9ceaefdd6e8ff4

parent

e89e7cc18a2f5d1bb79fcb3ca2d0c31b0b0ffca4

1 files changed, 4 insertions(+), 4 deletions(-)

jump to
M src/platform/ffmpeg/ffmpeg-resample.csrc/platform/ffmpeg/ffmpeg-resample.c

@@ -50,15 +50,15 @@ output += totalRead;

} while (nSamples) { unsigned read = GBAAudioCopy(audio, left, right, GBA_AUDIO_SAMPLES); + if (read == 0) { + memset(output, 0, nSamples * sizeof(struct GBAStereoSample)); + break; + } size_t currentRead = avresample_convert(avr, (uint8_t**) &output, nSamples * sizeof(struct GBAStereoSample), nSamples, (uint8_t**) samples, sizeof(left), read); nSamples -= currentRead; output += currentRead; totalRead += currentRead; - if (read < GBA_AUDIO_SAMPLES && nSamples) { - memset(output, 0, nSamples * sizeof(struct GBAStereoSample)); - break; - } } return totalRead; }