From 15187f5d63ea8a641f259dd10704d14670be9df4 Mon Sep 17 00:00:00 2001 From: Rangi <35663410+Rangi42@users.noreply.github.com> Date: Fri, 27 Dec 2024 12:54:25 -0500 Subject: [PATCH] Identify `CHANNEL_FIELD16` as `CHANNEL_NOTE_DURATION_MODIFIER` (#1162) --- audio/engine.asm | 13 +++--- constants/audio_constants.asm | 2 +- macros/ram.asm | 80 +++++++++++++++++------------------ 3 files changed, 47 insertions(+), 48 deletions(-) diff --git a/audio/engine.asm b/audio/engine.asm index a32ced688a1..73ab53773aa 100644 --- a/audio/engine.asm +++ b/audio/engine.asm @@ -2205,8 +2205,8 @@ SetNoteDuration: ld e, [hl] inc hl ld d, [hl] - ; add ??? to the next result - ld hl, CHANNEL_FIELD16 + ; add duration modifier to the next result + ld hl, CHANNEL_NOTE_DURATION_MODIFIER add hl, bc ld l, [hl] ; multiply Tempo by last result (NoteLength * LOW(delay)) @@ -2214,11 +2214,10 @@ SetNoteDuration: ; copy result to de ld e, l ld d, h - ; store result in ??? - ld hl, CHANNEL_FIELD16 + ; store result in NoteDuration and NoteDurationModifier + ld hl, CHANNEL_NOTE_DURATION_MODIFIER add hl, bc ld [hl], e - ; store result in NoteDuration ld hl, CHANNEL_NOTE_DURATION add hl, bc ld [hl], d @@ -2283,9 +2282,9 @@ Tempo: ld [hl], e inc hl ld [hl], d - ; clear ??? + ; clear duration modifier xor a - ld hl, CHANNEL_FIELD16 + ld hl, CHANNEL_NOTE_DURATION_MODIFIER add hl, bc ld [hl], a ret diff --git a/constants/audio_constants.asm b/constants/audio_constants.asm index f9b016cd0f2..85763a66cc1 100644 --- a/constants/audio_constants.asm +++ b/constants/audio_constants.asm @@ -49,7 +49,7 @@ DEF CHANNEL_PITCH rb DEF CHANNEL_OCTAVE rb DEF CHANNEL_TRANSPOSITION rb DEF CHANNEL_NOTE_DURATION rb -DEF CHANNEL_FIELD16 rb +DEF CHANNEL_NOTE_DURATION_MODIFIER rb rb_skip DEF CHANNEL_LOOP_COUNT rb DEF CHANNEL_TEMPO rw diff --git a/macros/ram.asm b/macros/ram.asm index 2585272f98d..e718df8810e 100644 --- a/macros/ram.asm +++ b/macros/ram.asm @@ -135,47 +135,47 @@ MACRO map_connection_struct ENDM MACRO channel_struct -\1MusicID:: dw -\1MusicBank:: db -\1Flags1:: db ; 0:on/off 1:subroutine 2:looping 3:sfx 4:noise 5:rest -\1Flags2:: db ; 0:vibrato on/off 1:pitch slide 2:duty cycle pattern 4:pitch offset -\1Flags3:: db ; 0:vibrato up/down 1:pitch slide direction -\1MusicAddress:: dw -\1LastMusicAddress:: dw - dw -\1NoteFlags:: db ; 5:rest -\1Condition:: db ; conditional jumps -\1DutyCycle:: db ; bits 6-7 (0:12.5% 1:25% 2:50% 3:75%) -\1VolumeEnvelope:: db ; hi:volume lo:fade -\1Frequency:: dw ; 11 bits -\1Pitch:: db ; 0:rest 1-c:note -\1Octave:: db ; 7-0 (0 is highest) -\1Transposition:: db ; raises existing octaves (to repeat phrases) -\1NoteDuration:: db ; frames remaining for the current note -\1Field16:: ds 1 - ds 1 -\1LoopCount:: db -\1Tempo:: dw -\1Tracks:: db ; hi:left lo:right -\1DutyCyclePattern:: db -\1VibratoDelayCount:: db ; initialized by \1VibratoDelay -\1VibratoDelay:: db ; number of frames a note plays until vibrato starts -\1VibratoExtent:: db -\1VibratoRate:: db ; hi:frames for each alt lo:frames to the next alt -\1PitchSlideTarget:: dw ; frequency endpoint for pitch slide -\1PitchSlideAmount:: db +\1MusicID:: dw +\1MusicBank:: db +\1Flags1:: db ; 0:on/off 1:subroutine 2:looping 3:sfx 4:noise 5:rest +\1Flags2:: db ; 0:vibrato on/off 1:pitch slide 2:duty cycle pattern 4:pitch offset +\1Flags3:: db ; 0:vibrato up/down 1:pitch slide direction +\1MusicAddress:: dw +\1LastMusicAddress:: dw + ds 2 +\1NoteFlags:: db ; 5:rest +\1Condition:: db ; conditional jumps +\1DutyCycle:: db ; bits 6-7 (0:12.5% 1:25% 2:50% 3:75%) +\1VolumeEnvelope:: db ; hi:volume lo:fade +\1Frequency:: dw ; 11 bits +\1Pitch:: db ; 0:rest 1-c:note +\1Octave:: db ; 7-0 (0 is highest) +\1Transposition:: db ; raises existing octaves (to repeat phrases) +\1NoteDuration:: db ; frames remaining for the current note +\1NoteDurationModifier:: db + ds 1 +\1LoopCount:: db +\1Tempo:: dw +\1Tracks:: db ; hi:left lo:right +\1DutyCyclePattern:: db +\1VibratoDelayCount:: db ; initialized by \1VibratoDelay +\1VibratoDelay:: db ; number of frames a note plays until vibrato starts +\1VibratoExtent:: db +\1VibratoRate:: db ; hi:frames for each alt lo:frames to the next alt +\1PitchSlideTarget:: dw ; frequency endpoint for pitch slide +\1PitchSlideAmount:: db \1PitchSlideAmountFraction:: db -\1Field25:: db - ds 1 -\1PitchOffset:: dw -\1Field29:: ds 1 -\1Field2a:: ds 2 -\1Field2c:: ds 1 -\1NoteLength:: db ; frames per 16th note -\1Field2e:: ds 1 -\1Field2f:: ds 1 -\1Field30:: ds 1 - ds 1 +\1Field25:: db + ds 1 +\1PitchOffset:: dw +\1Field29:: ds 1 +\1Field2a:: ds 2 +\1Field2c:: ds 1 +\1NoteLength:: db ; frames per 16th note +\1Field2e:: ds 1 +\1Field2f:: ds 1 +\1Field30:: ds 1 + ds 1 ENDM MACRO battle_tower_struct