Add legacy audio macros

This commit is contained in:
dannye 2019-09-04 00:17:10 -05:00
parent 5fd3e591df
commit 9d4dd09b86
2 changed files with 90 additions and 2 deletions

View File

@ -7,7 +7,87 @@ callba EQUS "farcall"
callab EQUS "callfar" callab EQUS "callfar"
; macros/scripts/audio.asm ; macros/scripts/audio.asm
__ EQU 0
CC EQU 13
musicheader: MACRO
channel_count \1
channel \2, \3
ENDM
sound: MACRO
note \1, \2
db \3
dw \4
ENDM
noise: MACRO
note \1, \2
db \3
db \4
ENDM
notetype: MACRO
IF _NARG >= 2
note_type \1, \2 >> 4, \2 & $0f
ELSE
note_type \1
ENDC
ENDM
pitchoffset: MACRO
transpose \1, \2 - 1
ENDM
dutycycle EQUS "duty_cycle"
intensity: MACRO
volume_envelope \1 >> 4, \1 & $0f
ENDM
soundinput: MACRO
pitch_sweep \1 >> 4, \1 & $0f
ENDM
unknownmusic0xde EQUS "sound_duty" unknownmusic0xde EQUS "sound_duty"
sound_duty: MACRO
db $de
IF _NARG == 4
db \1 | (\2 << 2) | (\3 << 4) | (\4 << 6)
ELSE
db \1
ENDC
ENDM
togglesfx EQUS "toggle_sfx"
slidepitchto: MACRO
pitch_slide \1, (8 - \2), \3
ENDM
togglenoise EQUS "toggle_noise"
panning: MACRO
force_stereo_panning ((\1 >> 4) & 1), (\1 & 1)
ENDM
tone EQUS "pitch_offset"
restartchannel EQUS "restart_channel"
newsong EQUS "new_song"
sfxpriorityon EQUS "sfx_priority_on"
sfxpriorityoff EQUS "sfx_priority_off"
stereopanning: MACRO
stereo_panning ((\1 >> 4) & 1), (\1 & 1)
ENDM
sfxtogglenoise EQUS "sfx_toggle_noise"
setcondition EQUS "set_condition"
jumpif EQUS "sound_jump_if"
jumpchannel EQUS "sound_jump"
loopchannel EQUS "sound_loop"
callchannel EQUS "sound_call"
endchannel EQUS "sound_ret"
; macros/scripts/events.asm ; macros/scripts/events.asm

View File

@ -134,7 +134,11 @@ ENDM
vibrato: MACRO vibrato: MACRO
db vibrato_cmd db vibrato_cmd
db \1 ; delay db \1 ; delay
dn \2, \3 ; extent, rate IF _NARG > 2
dn \2, \3 ; extent, rate
ELSE
db \2 ; LEGACY: Support for 1-arg extent
ENDC
ENDM ENDM
enum unknownmusic0xe2_cmd ; $e2 enum unknownmusic0xe2_cmd ; $e2
@ -158,7 +162,11 @@ ENDM
enum volume_cmd ; $e5 enum volume_cmd ; $e5
volume: MACRO volume: MACRO
db volume_cmd db volume_cmd
dn \1, \2 ; left volume, right volume IF _NARG > 1
dn \1, \2 ; left volume, right volume
ELSE
db \1 ; LEGACY: Support for 1-arg volume
ENDC
ENDM ENDM
enum pitch_offset_cmd ; $e6 enum pitch_offset_cmd ; $e6