SameBoy | Accurate GB/GBC emulator |
| download: https://git.y1.nz/archives/sameboy.tar.gz | |
| README | Files | Log | Refs | LICENSE |
commit 56b14c67aafa2bedf86f99d10edda037c415dca0 parent ee03b1e4338f9cb665c2378a0c016e21c4af120e Author: Lior Halphon <LIJI32@gmail.com> Date: Sat, 22 Jan 2022 01:11:23 +0200 Fixed AGB audio regression Diffstat:
| M | Cocoa/Document.m | 3 | +-- |
| M | Core/apu.c | 13 | +++++++++---- |
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/Cocoa/Document.m b/Cocoa/Document.m @@ -1128,9 +1128,8 @@ static unsigned *multiplication_table_for_frequency(unsigned frequency) [self.consoleWindow orderFront:nil]; } pending_console_output = nil; -} + } [console_output_lock unlock]; - } - (void) log: (const char *) string withAttributes: (GB_log_attributes) attributes diff --git a/Core/apu.c b/Core/apu.c @@ -72,9 +72,7 @@ static void update_sample(GB_gameboy_t *gb, unsigned index, int8_t value, unsign /* For some reason, channel 3 is inverted on the AGB */ value ^= 0xF; } - - if (value == 0 && gb->apu.samples[index] == 0) return; - + if (gb->model >= GB_MODEL_AGB) { /* On the AGB, because no analog mixing is done, the behavior of NR51 is a bit different. A channel that is not connected to a terminal is idenitcal to a connected channel @@ -111,6 +109,8 @@ static void update_sample(GB_gameboy_t *gb, unsigned index, int8_t value, unsign return; } + if (value == 0 && gb->apu.samples[index] == 0) return; + if (!GB_apu_is_DAC_enabled(gb, index)) { value = gb->apu.samples[index]; } @@ -283,7 +283,12 @@ static void render(GB_gameboy_t *gb) static void update_square_sample(GB_gameboy_t *gb, unsigned index) { - if (gb->apu.square_channels[index].sample_surpressed) return; + if (gb->apu.square_channels[index].sample_surpressed) { + if (gb->model >= GB_MODEL_AGB) { + update_sample(gb, index, gb->apu.samples[index], 0); + } + return; + } uint8_t duty = gb->io_registers[index == GB_SQUARE_1? GB_IO_NR11 :GB_IO_NR21] >> 6; update_sample(gb, index,
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.