ChocolateBird/scripts/loaders/snes/music_ff5.gd

59 lines
1.8 KiB
GDScript3
Raw Permalink Normal View History

2023-08-23 17:26:16 +09:30
extends 'res://scripts/loaders/snes/music.gd'
# In real OOP these would be static or static const, but GDScript doesn't allow that
func _init() -> void:
# Durations are in pulses, 48 = 1 quarter note (crotchet)
self.NOTE_DURATIONS = PoolByteArray([192, 144, 96, 64, 72, 48, 32, 36, 24, 16, 12, 8, 6, 4, 3]) # See ROM 0x041D7E to 0x041D8C
self.REFERENCE_NOTE = 71
self.NOTE_TIE = 12
self.NOTE_REST = 13
2023-08-23 17:26:16 +09:30
self.EVENT_MAP = {
0xD2: EventType.VOLUME,
0xD3: EventType.VOLUME_SLIDE,
0xD4: EventType.PAN,
0xD5: EventType.PAN_SLIDE,
0xD6: EventType.PITCH_SLIDE,
0xD7: EventType.VIBRATO_ON,
0xD8: EventType.VIBRATO_OFF,
0xD9: EventType.TREMOLO_ON,
0xDA: EventType.TREMOLO_OFF,
0xDB: EventType.PAN_LFO_ON,
0xDC: EventType.PAN_LFO_OFF,
0xDD: EventType.NOISE_FREQ,
0xDE: EventType.NOISE_ON,
0xDF: EventType.NOISE_OFF,
0xE0: EventType.PITCHMOD_ON,
0xE1: EventType.PITCHMOD_OFF,
0xE2: EventType.ECHO_ON,
0xE3: EventType.ECHO_OFF,
0xE4: EventType.OCTAVE,
0xE5: EventType.OCTAVE_UP,
0xE6: EventType.OCTAVE_DOWN,
0xE7: EventType.TRANSPOSE_ABS,
0xE8: EventType.TRANSPOSE_REL,
0xE9: EventType.TUNING,
0xEA: EventType.PROGCHANGE,
0xEB: EventType.ADSR_ATTACK_RATE,
0xEC: EventType.ADSR_DECAY_RATE,
0xED: EventType.ADSR_SUSTAIN_LEVEL,
0xEE: EventType.ADSR_SUSTAIN_RATE,
2023-08-23 17:26:16 +09:30
0xEF: EventType.ADSR_DEFAULT,
0xF0: EventType.LOOP_START,
0xF1: EventType.LOOP_END,
0xF2: EventType.END,
0xF3: EventType.TEMPO,
0xF4: EventType.TEMPO_SLIDE,
0xF5: EventType.ECHO_VOLUME,
0xF6: EventType.ECHO_VOLUME_SLIDE,
0xF7: EventType.ECHO_FEEDBACK_FIR,
0xF8: EventType.MASTER_VOLUME,
0xF9: EventType.LOOP_BREAK,
0xFA: EventType.GOTO,
0xFB: EventType.CPU_CONTROLLED_JUMP,
0xFC: EventType.END,
0xFD: EventType.END,
0xFE: EventType.END,
0xFF: EventType.END,
}