aboutsummaryrefslogtreecommitdiffstats
path: root/src/gba/gba.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gba/gba.h')
-rw-r--r--src/gba/gba.h12
1 files changed, 10 insertions, 2 deletions
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 {
510} SoundChannel; 510} SoundChannel;
511 511
512inline u16 512inline u16
513sound_volume(SoundChannel channels, u8 volume) { 513sound_volume(SoundChannel channels, u8 volume, u8 pan) {
514 volume = volume & 0x7; 514 volume = volume & 0x7;
515 channels = channels & 0xF; 515 channels = channels & 0xF;
516 return volume | (volume << 0x4) | (channels << 0x8) | (channels << 0xC); 516 u16 right = volume | (channels << 0x8);
517 u16 left = (volume << 0x4) | (channels << 0xC);
518 if (pan == 1) {
519 return left;
520 }
521 if (pan == 2) {
522 return right;
523 }
524 return left | right;
517} 525}
518 526
519// Sound Direct Sound master bits. 527// Sound Direct Sound master bits.