summaryrefslogtreecommitdiff
path: root/asm/macros
diff options
context:
space:
mode:
authorKurausukun <lord.uber1@gmail.com>2020-09-17 03:12:19 -0400
committerKurausukun <lord.uber1@gmail.com>2020-09-17 03:12:19 -0400
commitb9644e9583788c7b72d721487ad44a9616491f43 (patch)
tree576318423337f0b82efabf884e5ed2f7b736221f /asm/macros
parent62b79018dc7b1ae8d6b98acee04e2f8c16470f4f (diff)
Update Audio Macros
Information: Our current audio macros preclude the definition of root key and pan (applicable when used in drumsets, aka "keysplit_all") for GB channels. However, this functionality does exist in m4a--Pokemon Emerald just happens not to use it. However, for the sake of people working with custom music, I believe these values should be modifiable by users. Additionally, given the recent events that have occurred with this repo, I would like to make something fully clear: I have indeed looked at the GBA SDK before, which contains notes on how these sounds are defined; therefore, I cannot blame you if you reject this PR on the grounds that the information is "tainted." However, this information is readily available and matches the same macros used for directsound--it's hardly information that one would need the source to know.
Diffstat (limited to 'asm/macros')
-rw-r--r--asm/macros/music_voice.inc75
1 files changed, 51 insertions, 24 deletions
diff --git a/asm/macros/music_voice.inc b/asm/macros/music_voice.inc
index b7a9e7f8d..b7aff4766 100644
--- a/asm/macros/music_voice.inc
+++ b/asm/macros/music_voice.inc
@@ -28,16 +28,22 @@
.byte \release
.endm
- .macro voice_square_1 sweep, duty_cycle, attack, decay, sustain, release
- _voice_square_1 1, \sweep, \duty_cycle, \attack, \decay, \sustain, \release
+ .macro voice_square_1 base_midi_key, pan, sweep, duty_cycle, attack, decay, sustain, release
+ _voice_square_1 1, \base_midi_key, \pan, \sweep, \duty_cycle, \attack, \decay, \sustain, \release
.endm
- .macro voice_square_1_alt sweep, duty_cycle, attack, decay, sustain, release
- _voice_square_1 9, \sweep, \duty_cycle, \attack, \decay, \sustain, \release
+ .macro voice_square_1_alt base_midi_key, pan, sweep, duty_cycle, attack, decay, sustain, release
+ _voice_square_1 9, \base_midi_key, \pan, \sweep, \duty_cycle, \attack, \decay, \sustain, \release
.endm
- .macro _voice_square_1 type, sweep, duty_cycle, attack, decay, sustain, release
- .byte \type, 60, 0
+ .macro _voice_square_1 type, base_midi_key, pan, sweep, duty_cycle, attack, decay, sustain, release
+ .byte \type
+ .byte \base_midi_key
+ .if \pan != 0
+ .byte (0x80 | \pan)
+ .else
+ .byte 0
+ .endif
.byte \sweep
.byte (\duty_cycle & 0x3)
.byte 0, 0, 0
@@ -47,16 +53,23 @@
.byte (\release & 0x7)
.endm
- .macro voice_square_2 duty_cycle, attack, decay, sustain, release
- _voice_square_2 2, \duty_cycle, \attack, \decay, \sustain, \release
+ .macro voice_square_2 base_midi_key, pan, duty_cycle, attack, decay, sustain, release
+ _voice_square_2 2, \base_midi_key, \pan, \duty_cycle, \attack, \decay, \sustain, \release
.endm
- .macro voice_square_2_alt duty_cycle, attack, decay, sustain, release
- _voice_square_2 10, \duty_cycle, \attack, \decay, \sustain, \release
+ .macro voice_square_2_alt base_midi_key, pan, duty_cycle, attack, decay, sustain, release
+ _voice_square_2 10, \base_midi_key, \pan, \duty_cycle, \attack, \decay, \sustain, \release
.endm
- .macro _voice_square_2 type, duty_cycle, attack, decay, sustain, release
- .byte \type, 60, 0, 0
+ .macro _voice_square_2 type, base_midi_key, pan, duty_cycle, attack, decay, sustain, release
+ .byte \type
+ .byte \base_midi_key
+ .if \pan != 0
+ .byte (0x80 | \pan)
+ .else
+ .byte 0
+ .endif
+ .byte 0
.byte (\duty_cycle & 0x3)
.byte 0, 0, 0
.byte (\attack & 0x7)
@@ -65,16 +78,23 @@
.byte (\release & 0x7)
.endm
- .macro voice_programmable_wave wave_samples_pointer, attack, decay, sustain, release
- _voice_programmable_wave 3, \wave_samples_pointer, \attack, \decay, \sustain, \release
+ .macro voice_programmable_wave base_midi_key, pan, wave_samples_pointer, attack, decay, sustain, release
+ _voice_programmable_wave 3, \base_midi_key, \pan, \wave_samples_pointer, \attack, \decay, \sustain, \release
.endm
- .macro voice_programmable_wave_alt wave_samples_pointer, attack, decay, sustain, release
- _voice_programmable_wave 11, \wave_samples_pointer, \attack, \decay, \sustain, \release
+ .macro voice_programmable_wave_alt base_midi_key, pan, wave_samples_pointer, attack, decay, sustain, release
+ _voice_programmable_wave 11, \base_midi_key, \pan, \wave_samples_pointer, \attack, \decay, \sustain, \release
.endm
- .macro _voice_programmable_wave type, wave_samples_pointer, attack, decay, sustain, release
- .byte \type, 60, 0, 0
+ .macro _voice_programmable_wave type, base_midi_key, pan, wave_samples_pointer, attack, decay, sustain, release
+ .byte \type
+ .byte \base_midi_key
+ .if \pan != 0
+ .byte (0x80 | \pan)
+ .else
+ .byte 0
+ .endif
+ .byte 0
.4byte \wave_samples_pointer
.byte (\attack & 0x7)
.byte (\decay & 0x7)
@@ -82,16 +102,23 @@
.byte (\release & 0x7)
.endm
- .macro voice_noise period, attack, decay, sustain, release
- _voice_noise 4, \period, \attack, \decay, \sustain, \release
+ .macro voice_noise base_midi_key, pan, period, attack, decay, sustain, release
+ _voice_noise 4, \base_midi_key, \pan, \period, \attack, \decay, \sustain, \release
.endm
- .macro voice_noise_alt period, attack, decay, sustain, release
- _voice_noise 12, \period, \attack, \decay, \sustain, \release
+ .macro voice_noise_alt base_midi_key, pan, period, attack, decay, sustain, release
+ _voice_noise 12, \base_midi_key, \pan, \period, \attack, \decay, \sustain, \release
.endm
- .macro _voice_noise type, period, attack, decay, sustain, release
- .byte \type, 60, 0, 0
+ .macro _voice_noise type, base_midi_key, pan, period, attack, decay, sustain, release
+ .byte \type
+ .byte \base_midi_key
+ .if \pan != 0
+ .byte (0x80 | \pan)
+ .else
+ .byte 0
+ .endif
+ .byte 0
.byte (\period & 0x1)
.byte 0, 0, 0
.byte (\attack & 0x7)