From f0ebc747d1b0d8753a1bc0f74b34a3012dd16753 Mon Sep 17 00:00:00 2001 From: Bad Diode Date: Tue, 30 May 2023 21:52:30 +0200 Subject: Properly handle audio/link sync settings --- src/gba/gba.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/gba') diff --git a/src/gba/gba.h b/src/gba/gba.h index 2b28295..74b6942 100644 --- a/src/gba/gba.h +++ b/src/gba/gba.h @@ -510,10 +510,18 @@ typedef enum { } SoundChannel; inline u16 -sound_volume(SoundChannel channels, u8 volume) { +sound_volume(SoundChannel channels, u8 volume, u8 pan) { volume = volume & 0x7; channels = channels & 0xF; - return volume | (volume << 0x4) | (channels << 0x8) | (channels << 0xC); + u16 right = volume | (channels << 0x8); + u16 left = (volume << 0x4) | (channels << 0xC); + if (pan == 1) { + return left; + } + if (pan == 2) { + return right; + } + return left | right; } // Sound Direct Sound master bits. -- cgit v1.2.1