From 4abb5f35393545d0c67675119fbd9db00222f315 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Sat, 5 Jul 2025 16:37:48 +0300 Subject: [PATCH] =?UTF-8?q?Fix=20AGB=20mixing=20=E2=80=93=20the=20bias=20s?= =?UTF-8?q?hould=20only=20be=20applied=20if=20the=20channel=20is=20connect?= =?UTF-8?q?ed=20to=20a=20terminal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Core/apu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Core/apu.c b/Core/apu.c index 30ba2af..7b977ff 100644 --- a/Core/apu.c +++ b/Core/apu.c @@ -164,7 +164,7 @@ static void update_sample(GB_gameboy_t *gb, GB_channel_t index, int8_t value, un if (index == GB_WAVE) { /* For some reason, channel 3 is inverted on the AGB, and has a different "silence" value */ value ^= 0xF; - silence = 7; + silence = 7 * 2; } uint8_t bias = agb_bias_for_channel(gb, index); @@ -173,8 +173,8 @@ static void update_sample(GB_gameboy_t *gb, GB_channel_t index, int8_t value, un bool right = gb->io_registers[GB_IO_NR51] & (1 << index); GB_sample_t output = { - .left = (0xF - (left? value : silence) * 2 + bias) * left_volume, - .right = (0xF - (right? value : silence) * 2 + bias) * right_volume + .left = (0xF - (left? value * 2 + bias : silence)) * left_volume, + .right = (0xF - (right? value * 2 + bias : silence)) * right_volume }; if (unlikely(gb->apu_output.channel_muted[index])) {