SameBoy | Accurate GB/GBC emulator |
| download: https://git.y1.nz/archives/sameboy.tar.gz | |
| README | Files | Log | Refs | LICENSE |
commit c7c2d08dc54776e92a416d78f12ff1392b0bc198 parent fcf31be7357ba15acc21417817d09e7c8d737173 Author: Lior Halphon <LIJI32@gmail.com> Date: Fri, 15 Dec 2023 20:38:19 +0200 More accurate audio mixing in AGB mode, fixes #555 Diffstat:
| M | Core/apu.c | 16 | ++++------------ |
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/Core/apu.c b/Core/apu.c @@ -89,19 +89,11 @@ static void update_sample(GB_gameboy_t *gb, GB_channel_t index, int8_t value, un GB_sample_t output; uint8_t bias = agb_bias_for_channel(gb, index); - if (gb->io_registers[GB_IO_NR51] & (1 << index)) { - output.right = (0xF - value * 2 + bias) * right_volume; - } - else { - output.right = 0xF * right_volume; - } + bool right = gb->io_registers[GB_IO_NR51] & (1 << index); + bool left = gb->io_registers[GB_IO_NR51] & (0x10 << index); - if (gb->io_registers[GB_IO_NR51] & (0x10 << index)) { - output.left = (0xF - value * 2 + bias) * left_volume; - } - else { - output.left = 0xF * left_volume; - } + output.right = (0xF - (right? value : 7) * 2 + bias) * right_volume; + output.left = (0xF - (left? value : 7) * 2 + bias) * left_volume; if (unlikely(gb->apu_output.channel_muted[index])) { output.left = output.right = 0;
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.