SameBoy | Accurate GB/GBC emulator |
| download: https://git.y1.nz/archives/sameboy.tar.gz | |
| README | Files | Log | Refs | LICENSE |
commit 97652b7460d413ed97a48eb6e106937a3286e070 parent 59c315a5ddfb26d39a70ac0c37d4a53050d63e68 Author: Lior Halphon <LIJI32@gmail.com> Date: Wed, 29 Dec 2021 16:53:28 +0200 Cocoa audio bugfix Diffstat:
| M | Cocoa/Document.m | 8 | +++++++- |
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/Cocoa/Document.m b/Cocoa/Document.m @@ -399,7 +399,13 @@ static void infraredStateChanged(GB_gameboy_t *gb, bool on) return; } - if (audioBufferPosition >= nFrames && audioBufferPosition < nFrames + 4800) { + if (audioBufferPosition < nFrames) { + // Not enough audio + memset(buffer, 0, (nFrames - audioBufferPosition) * sizeof(*buffer)); + memcpy(buffer, audioBuffer, audioBufferPosition * sizeof(*buffer)); + audioBufferPosition = 0; + } + else if (audioBufferPosition < nFrames + 4800) { memcpy(buffer, audioBuffer, nFrames * sizeof(*buffer)); memmove(audioBuffer, audioBuffer + nFrames, (audioBufferPosition - nFrames) * sizeof(*buffer)); audioBufferPosition = audioBufferPosition - nFrames;
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.