From 9d4dd09b86a68fff9e46f4f1be28cd86e336c5dd Mon Sep 17 00:00:00 2001 From: dannye <33dannye@gmail.com> Date: Wed, 4 Sep 2019 00:17:10 -0500 Subject: [PATCH] Add legacy audio macros --- macros/legacy.asm | 80 ++++++++++++++++++++++++++++++++++++++++ macros/scripts/audio.asm | 12 +++++- 2 files changed, 90 insertions(+), 2 deletions(-) diff --git a/macros/legacy.asm b/macros/legacy.asm index ff20c5235..22a2fa191 100644 --- a/macros/legacy.asm +++ b/macros/legacy.asm @@ -7,7 +7,87 @@ callba EQUS "farcall" callab EQUS "callfar" ; 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" +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 diff --git a/macros/scripts/audio.asm b/macros/scripts/audio.asm index 6df7a0543..4d1e86f4e 100644 --- a/macros/scripts/audio.asm +++ b/macros/scripts/audio.asm @@ -134,7 +134,11 @@ ENDM vibrato: MACRO db vibrato_cmd 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 enum unknownmusic0xe2_cmd ; $e2 @@ -158,7 +162,11 @@ ENDM enum volume_cmd ; $e5 volume: MACRO 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 enum pitch_offset_cmd ; $e6