summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDragorn421 <Dragorn421@users.noreply.github.com>2025-02-23 12:43:15 +0100
committerGitHub <noreply@github.com>2025-02-23 06:43:15 -0500
commit70fde8ac3b591a993a2ca0a4361a528fdd07d158 (patch)
treedd851c5f2da3af41e05d97ece06d441a33569641
parent5ddb3e68b6f7a08d7c670402168d52969933dc5f (diff)
Macroify MML opcodes (#2485)
* add defines for sequence opcodes * name aseq_cmd_id defines from the corresponding macro names * ASEQ_CMD_ID_ -> ASEQ_OPC_ * remove previous opcode defines * ASEQ_OPC_LAYER_STEP3_ -> ASEQ_OPC_LAYER_ * sync with MM and fixups * format * ASEQ_OPC_ -> ASEQ_OP_ * ASEQ_OP_CTRLFLOW_ -> ASEQ_OP_ * tab-align * ASEQ_OP_SEQUENCE_ -> ASEQ_OP_SEQ_ * ASEQ_OP_CHANNEL_ -> ASEQ_OP_CHAN_ * define MML_VERSION in the Makefile for seqplayer.c
-rw-r--r--Makefile2
-rw-r--r--assets/audio/sequences/seq_0.prg.seq34
-rw-r--r--assets/audio/sequences/seq_1.prg.seq6
-rw-r--r--include/audio/aseq.h508
-rw-r--r--src/audio/lib/seqplayer.c480
5 files changed, 604 insertions, 426 deletions
diff --git a/Makefile b/Makefile
index 31ab7fc8a..35623679d 100644
--- a/Makefile
+++ b/Makefile
@@ -538,6 +538,8 @@ endif
$(BUILD_DIR)/src/boot/build.o: CPP_DEFINES += -DBUILD_CREATOR="\"$(BUILD_CREATOR)\"" -DBUILD_DATE="\"$(BUILD_DATE)\"" -DBUILD_TIME="\"$(BUILD_TIME)\""
+$(BUILD_DIR)/src/audio/lib/seqplayer.o: CPP_DEFINES += -DMML_VERSION=MML_VERSION_OOT
+
ifeq ($(COMPILER),ido)
$(BUILD_DIR)/src/boot/driverominit.o: OPTFLAGS := -O2
diff --git a/assets/audio/sequences/seq_0.prg.seq b/assets/audio/sequences/seq_0.prg.seq
index 602ed791c..252711429 100644
--- a/assets/audio/sequences/seq_0.prg.seq
+++ b/assets/audio/sequences/seq_0.prg.seq
@@ -1302,7 +1302,7 @@ CHAN_08EC:
/* 0x08EE [0xC7 0x02 0x09 0x04 ] */ stseq 2, LAYER_0903 + STSEQ_NOTEDV_DELAY_HI
/* 0x08F2 [0xC7 0x02 0x08 0xFD ] */ stseq 2, CHAN_08FC + STSEQ_LDI_IMM
/* 0x08F6 [0xB8 0x0C ] */ rand 12
-/* 0x08F8 [0xC7 0x5C 0x09 0x03 ] */ stseq (NOTEDV_OPCODE | PITCH_DF3), LAYER_0903 + STSEQ_NOTEDV_OPCODE_PITCH
+/* 0x08F8 [0xC7 0x5C 0x09 0x03 ] */ stseq (ASEQ_OP_LAYER_NOTEDV | PITCH_DF3), LAYER_0903 + STSEQ_NOTEDV_OPCODE_PITCH
CHAN_08FC:
/* 0x08FC [0xCC 0x01 ] */ ldi 1
/* 0x08FE [0xFC 0x00 0x48 ] */ call CHAN_0048
@@ -4978,7 +4978,7 @@ CHAN_2274:
/* 0x2284 [0x56 ] */ subio IO_PORT_6
/* 0x2285 [0xC9 0x07 ] */ and 7
CHAN_2287:
-/* 0x2287 [0xC7 0x60 0x22 0x98 ] */ stseq (NOTEDV_OPCODE | PITCH_F3), LAYER_2298 + STSEQ_NOTEDV_OPCODE_PITCH
+/* 0x2287 [0xC7 0x60 0x22 0x98 ] */ stseq (ASEQ_OP_LAYER_NOTEDV | PITCH_F3), LAYER_2298 + STSEQ_NOTEDV_OPCODE_PITCH
/* 0x228B [0x66 ] */ ldio IO_PORT_6
/* 0x228C [0xC8 0xFC ] */ sub 252
/* 0x228E [0xC9 0x04 ] */ and 4
@@ -6529,7 +6529,7 @@ LAYER_2C4E:
.channel CHAN_2C54
/* 0x2C54 [0x89 0x2C 0x62 ] */ ldlayer 1, LAYER_2C62
-/* 0x2C57 [0xCC 0x58 ] */ ldi (NOTEDV_OPCODE | PITCH_A2)
+/* 0x2C57 [0xCC 0x58 ] */ ldi (ASEQ_OP_LAYER_NOTEDV | PITCH_A2)
/* 0x2C59 [0xC7 0x00 0x22 0x88 ] */ stseq 0, CHAN_2287 + STSEQ_STSEQ_IMM
/* 0x2C5D [0xFB 0x22 0x67 ] */ jump CHAN_2267
@@ -6649,7 +6649,7 @@ CHAN_2D01:
.channel CHAN_2D13
/* 0x2D13 [0x89 0x2D 0x25 ] */ ldlayer 1, LAYER_2D25
/* 0x2D16 [0x8A 0x2D 0x23 ] */ ldlayer 2, LAYER_2D23
-/* 0x2D19 [0xCC 0x66 ] */ ldi (NOTEDV_OPCODE | PITCH_B3)
+/* 0x2D19 [0xCC 0x66 ] */ ldi (ASEQ_OP_LAYER_NOTEDV | PITCH_B3)
/* 0x2D1B [0xC7 0x00 0x22 0x88 ] */ stseq 0, CHAN_2287 + STSEQ_STSEQ_IMM
/* 0x2D1F [0xFB 0x22 0x67 ] */ jump CHAN_2267
/* 0x2D22 [0xFF ] */ end
@@ -9201,7 +9201,7 @@ CHAN_4162:
/* 0x4164 [0xC7 0x03 0x41 0x7A ] */ stseq 3, LAYER_4179 + STSEQ_NOTEDV_DELAY_HI
/* 0x4168 [0xC7 0x03 0x41 0x73 ] */ stseq 3, CHAN_4172 + STSEQ_LDI_IMM
/* 0x416C [0xB8 0x08 ] */ rand 8
-/* 0x416E [0xC7 0x5B 0x41 0x79 ] */ stseq (NOTEDV_OPCODE | PITCH_C3), LAYER_4179 + STSEQ_NOTEDV_OPCODE_PITCH
+/* 0x416E [0xC7 0x5B 0x41 0x79 ] */ stseq (ASEQ_OP_LAYER_NOTEDV | PITCH_C3), LAYER_4179 + STSEQ_NOTEDV_OPCODE_PITCH
CHAN_4172:
/* 0x4172 [0xCC 0x01 ] */ ldi 1
/* 0x4174 [0xFC 0x00 0x48 ] */ call CHAN_0048
@@ -9763,7 +9763,7 @@ LAYER_4245:
/* 0x44C9 [0x88 0x44 0xD7 ] */ ldlayer 0, LAYER_44D7
/* 0x44CC [0xED 0x14 ] */ gain 20
/* 0x44CE [0xB8 0x04 ] */ rand 4
-/* 0x44D0 [0xC7 0x6B 0x44 0xD7 ] */ stseq (NOTEDV_OPCODE | PITCH_E4), LAYER_44D7 + STSEQ_NOTEDV_OPCODE_PITCH
+/* 0x44D0 [0xC7 0x6B 0x44 0xD7 ] */ stseq (ASEQ_OP_LAYER_NOTEDV | PITCH_E4), LAYER_44D7 + STSEQ_NOTEDV_OPCODE_PITCH
/* 0x44D4 [0xD9 0xE8 ] */ releaserate 232
/* 0x44D6 [0xFF ] */ end
@@ -10353,7 +10353,7 @@ LAYER_47B3:
/* 0x4860 [0x88 0x48 0x70 ] */ ldlayer 0, LAYER_4870
CHAN_4863:
/* 0x4863 [0xB8 0x04 ] */ rand 4
-/* 0x4865 [0xC7 0x60 0x48 0x70 ] */ stseq (NOTEDV_OPCODE | PITCH_F3), LAYER_4870 + STSEQ_NOTEDV_OPCODE_PITCH
+/* 0x4865 [0xC7 0x60 0x48 0x70 ] */ stseq (ASEQ_OP_LAYER_NOTEDV | PITCH_F3), LAYER_4870 + STSEQ_NOTEDV_OPCODE_PITCH
/* 0x4869 [0xCC 0x12 ] */ ldi 18
/* 0x486B [0xFC 0x00 0x48 ] */ call CHAN_0048
/* 0x486E [0xF4 0xF3 ] */ rjump CHAN_4863
@@ -12266,7 +12266,7 @@ LAYER_53FD:
/* 0x5403 [0xC1 0x7E ] */ instr FONTANY_INSTR_SFX
/* 0x5405 [0x64 ] */ ldio IO_PORT_SFX_INDEX_LOBITS
/* 0x5406 [0xC8 0xB0 ] */ sub 176
-/* 0x5408 [0xC7 0x00 0x54 0x17 ] */ stseq (NOTEDVG_OPCODE | PITCH_A0), LAYER_5417 + STSEQ_NOTEDVG_OPCODE_PITCH
+/* 0x5408 [0xC7 0x00 0x54 0x17 ] */ stseq (ASEQ_OP_LAYER_NOTEDVG | PITCH_A0), LAYER_5417 + STSEQ_NOTEDVG_OPCODE_PITCH
/* 0x540C [0xCB 0x54 0x1C ] */ ldseq UNK_541C
/* 0x540F [0xC7 0x00 0x54 0x19 ] */ stseq 0, LAYER_5417 + STSEQ_NOTEDVG_DELAY_LO
/* 0x5413 [0x88 0x54 0x17 ] */ ldlayer 0, LAYER_5417
@@ -12640,7 +12640,7 @@ CHAN_565E:
/* 0x5660 [0xC7 0x28 0x56 0x76 ] */ stseq 40, LAYER_5675 + STSEQ_NOTEDV_DELAY_HI
/* 0x5664 [0xC7 0x28 0x56 0x6F ] */ stseq 40, CHAN_566E + STSEQ_LDI_IMM
/* 0x5668 [0xB8 0x06 ] */ rand 6
-/* 0x566A [0xC7 0x64 0x56 0x75 ] */ stseq (NOTEDV_OPCODE | PITCH_A3), LAYER_5675 + STSEQ_NOTEDV_OPCODE_PITCH
+/* 0x566A [0xC7 0x64 0x56 0x75 ] */ stseq (ASEQ_OP_LAYER_NOTEDV | PITCH_A3), LAYER_5675 + STSEQ_NOTEDV_OPCODE_PITCH
CHAN_566E:
/* 0x566E [0xCC 0x01 ] */ ldi 1
/* 0x5670 [0xFC 0x00 0x48 ] */ call CHAN_0048
@@ -14045,7 +14045,7 @@ CHAN_6116:
/* 0x6118 [0x3F 0x06 ] */ stcio 15, IO_PORT_6
CHAN_611A:
/* 0x611A [0xCB 0x61 0x6D ] */ ldseq UNK_616D
-/* 0x611D [0xC7 0x40 0x61 0x2D ] */ stseq (NOTEDV_OPCODE | PITCH_A0), LAYER_612D + STSEQ_NOTEDV_OPCODE_PITCH
+/* 0x611D [0xC7 0x40 0x61 0x2D ] */ stseq (ASEQ_OP_LAYER_NOTEDV | PITCH_A0), LAYER_612D + STSEQ_NOTEDV_OPCODE_PITCH
/* 0x6121 [0x66 ] */ ldio IO_PORT_6
CHAN_6122:
/* 0x6122 [0xCB 0x61 0x71 ] */ ldseq UNK_6171
@@ -14079,8 +14079,8 @@ CHAN_613E:
/* 0x6145 [0xCC 0x00 ] */ ldi 0
// Reads the byte at (PTR + 0) into TR (the note)
/* 0x6147 [0xB6 ] */ dyntblv
- // Store NOTEDV_OPCODE + TR into the pitch
-/* 0x6148 [0xC7 0x40 0x61 0x2D ] */ stseq (NOTEDV_OPCODE | PITCH_A0), LAYER_612D + STSEQ_NOTEDV_OPCODE_PITCH
+ // Store ASEQ_OP_LAYER_NOTEDV + TR into the pitch
+/* 0x6148 [0xC7 0x40 0x61 0x2D ] */ stseq (ASEQ_OP_LAYER_NOTEDV | PITCH_A0), LAYER_612D + STSEQ_NOTEDV_OPCODE_PITCH
// Load 1 into TR
/* 0x614C [0xCC 0x01 ] */ ldi 1
// Reads the byte at (PTR + 1) into TR (the velocity)
@@ -14355,7 +14355,7 @@ UNK_62CC:
/* 0x62D1 [0x76 ] */ stio IO_PORT_6
/* 0x62D2 [0xC9 0x01 ] */ and 1
/* 0x62D4 [0xCB 0x62 0xE8 ] */ ldseq UNK_62E8
-/* 0x62D7 [0xC7 0x40 0x64 0xBF ] */ stseq (NOTEDV_OPCODE | PITCH_A0), LAYER_64BF + STSEQ_NOTEDV_OPCODE_PITCH
+/* 0x62D7 [0xC7 0x40 0x64 0xBF ] */ stseq (ASEQ_OP_LAYER_NOTEDV | PITCH_A0), LAYER_64BF + STSEQ_NOTEDV_OPCODE_PITCH
/* 0x62DB [0xB8 0x02 ] */ rand 2
/* 0x62DD [0xCB 0x62 0xEA ] */ ldseq UNK_62EA
/* 0x62E0 [0xC7 0x00 0x64 0xC1 ] */ stseq 0, LAYER_64BF + STSEQ_NOTEDV_VELOCITY_2
@@ -14482,7 +14482,7 @@ UNK_6374:
/* 0x6379 [0x76 ] */ stio IO_PORT_6
/* 0x637A [0xC9 0x01 ] */ and 1
/* 0x637C [0xCB 0x63 0x96 ] */ ldseq UNK_6396
-/* 0x637F [0xC7 0x40 0x63 0x90 ] */ stseq (NOTEDV_OPCODE | PITCH_A0), LAYER_6390 + STSEQ_NOTEDV_OPCODE_PITCH
+/* 0x637F [0xC7 0x40 0x63 0x90 ] */ stseq (ASEQ_OP_LAYER_NOTEDV | PITCH_A0), LAYER_6390 + STSEQ_NOTEDV_OPCODE_PITCH
/* 0x6383 [0xB8 0x02 ] */ rand 2
/* 0x6385 [0xCB 0x63 0x98 ] */ ldseq UNK_6398
/* 0x6388 [0xC7 0x00 0x63 0x92 ] */ stseq 0, LAYER_6390 + STSEQ_NOTEDV_VELOCITY_2
@@ -14688,7 +14688,7 @@ UNK_6499:
/* 0x64A8 [0x76 ] */ stio IO_PORT_6
/* 0x64A9 [0xC9 0x01 ] */ and 1
/* 0x64AB [0xCB 0x64 0xC5 ] */ ldseq UNK_64C5
-/* 0x64AE [0xC7 0x40 0x64 0xBF ] */ stseq (NOTEDV_OPCODE | PITCH_A0), LAYER_64BF + STSEQ_NOTEDV_OPCODE_PITCH
+/* 0x64AE [0xC7 0x40 0x64 0xBF ] */ stseq (ASEQ_OP_LAYER_NOTEDV | PITCH_A0), LAYER_64BF + STSEQ_NOTEDV_OPCODE_PITCH
/* 0x64B2 [0xB8 0x02 ] */ rand 2
/* 0x64B4 [0xCB 0x64 0xC7 ] */ ldseq UNK_64C7
/* 0x64B7 [0xC7 0x00 0x64 0xC1 ] */ stseq 0, LAYER_64BF + STSEQ_NOTEDV_VELOCITY_2
@@ -14785,7 +14785,7 @@ UNK_6511:
.channel CHAN_6520
/* 0x6520 [0x64 ] */ ldio IO_PORT_SFX_INDEX_LOBITS
/* 0x6521 [0xC8 0x50 ] */ sub 80
-/* 0x6523 [0xC7 0x19 0x65 0x36 ] */ stseq (NOTEDVG_OPCODE | PITCH_BF2), LAYER_6536 + STSEQ_NOTEDVG_OPCODE_PITCH
+/* 0x6523 [0xC7 0x19 0x65 0x36 ] */ stseq (ASEQ_OP_LAYER_NOTEDVG | PITCH_BF2), LAYER_6536 + STSEQ_NOTEDVG_OPCODE_PITCH
/* 0x6527 [0xCB 0x65 0x3B ] */ ldseq UNK_653B
/* 0x652A [0xC7 0x00 0x65 0x38 ] */ stseq 0, LAYER_6536 + STSEQ_NOTEDVG_DELAY_LO
/* 0x652E [0x88 0x65 0x34 ] */ ldlayer 0, LAYER_6534
@@ -14806,7 +14806,7 @@ UNK_653B:
.channel CHAN_6562
/* 0x6562 [0x64 ] */ ldio IO_PORT_SFX_INDEX_LOBITS
/* 0x6563 [0xC8 0x77 ] */ sub 119
-/* 0x6565 [0xC7 0x00 0x65 0x76 ] */ stseq (NOTEDVG_OPCODE | PITCH_A0), LAYER_6576 + STSEQ_NOTEDVG_OPCODE_PITCH
+/* 0x6565 [0xC7 0x00 0x65 0x76 ] */ stseq (ASEQ_OP_LAYER_NOTEDVG | PITCH_A0), LAYER_6576 + STSEQ_NOTEDVG_OPCODE_PITCH
/* 0x6569 [0xCB 0x65 0x7B ] */ ldseq UNK_657B
/* 0x656C [0xC7 0x00 0x65 0x78 ] */ stseq 0, LAYER_6576 + STSEQ_NOTEDVG_DELAY_LO
/* 0x6570 [0x88 0x65 0x74 ] */ ldlayer 0, LAYER_6574
diff --git a/assets/audio/sequences/seq_1.prg.seq b/assets/audio/sequences/seq_1.prg.seq
index 0babce806..02994cf73 100644
--- a/assets/audio/sequences/seq_1.prg.seq
+++ b/assets/audio/sequences/seq_1.prg.seq
@@ -454,7 +454,7 @@ CHAN_0308:
/* 0x0319 [0xC7 0x60 0x10 0x00 ] */ stseq 96, ENVELOPE_0FFA + STSEQ_ENVELOPE_POINT(3)
CHAN_031D:
/* 0x031D [0xB8 0x18 ] */ rand 24
-/* 0x031F [0xC7 0x62 0x03 0x6F ] */ stseq (NOTEDV_OPCODE | PITCH_G3), LAYER_036F + STSEQ_NOTEDV_OPCODE_PITCH
+/* 0x031F [0xC7 0x62 0x03 0x6F ] */ stseq (ASEQ_OP_LAYER_NOTEDV | PITCH_G3), LAYER_036F + STSEQ_NOTEDV_OPCODE_PITCH
/* 0x0323 [0xCC 0x40 ] */ ldi 64
/* 0x0325 [0x53 ] */ subio IO_PORT_3
/* 0x0326 [0xC7 0x00 0x03 0x2B ] */ stseq 0, STSEQ_HERE + STSEQ_RAND
@@ -482,7 +482,7 @@ CHAN_0335:
/* 0x034B [0xC8 0xFF ] */ sub 255
/* 0x034D [0xC7 0x64 0x03 0x87 ] */ stseq 100, LAYER_0385 + STSEQ_NOTEDV_VELOCITY_2
/* 0x0351 [0xC7 0x64 0x03 0x8A ] */ stseq 100, LAYER_0388 + STSEQ_NOTEDV_VELOCITY_2
-/* 0x0355 [0xC7 0x67 0x03 0x85 ] */ stseq (NOTEDV_OPCODE | PITCH_C4), LAYER_0385 + STSEQ_NOTEDV_OPCODE_PITCH
+/* 0x0355 [0xC7 0x67 0x03 0x85 ] */ stseq (ASEQ_OP_LAYER_NOTEDV | PITCH_C4), LAYER_0385 + STSEQ_NOTEDV_OPCODE_PITCH
/* 0x0359 [0xFF ] */ end
UNK_035A:
@@ -1664,7 +1664,7 @@ CHAN_0E72:
/* 0x0E84 [0xB8 0x02 ] */ rand 2
/* 0x0E86 [0x73 ] */ stio IO_PORT_3
CHAN_0E87:
-/* 0x0E87 [0xC7 0x67 0x0E 0xCF ] */ stseq (NOTEDV_OPCODE | PITCH_C4), LAYER_0ECF + STSEQ_NOTEDV_OPCODE_PITCH
+/* 0x0E87 [0xC7 0x67 0x0E 0xCF ] */ stseq (ASEQ_OP_LAYER_NOTEDV | PITCH_C4), LAYER_0ECF + STSEQ_NOTEDV_OPCODE_PITCH
/* 0x0E8B [0xB8 0x1E ] */ rand 30
/* 0x0E8D [0xC7 0x31 0x0E 0xCC ] */ stseq 49, LAYER_0ECB + STSEQ_NOTEPAN
/* 0x0E91 [0x76 ] */ stio IO_PORT_6
diff --git a/include/audio/aseq.h b/include/audio/aseq.h
index 689c42664..ce14abfa2 100644
--- a/include/audio/aseq.h
+++ b/include/audio/aseq.h
@@ -52,7 +52,18 @@
#ifndef ASEQ_H
#define ASEQ_H
-#include "versions.h"
+/**
+ * MML Version
+ */
+
+#ifndef MML_VERSION
+ #error "MML version not defined, define MML_VERSION in the cpp invocation"
+#endif
+
+#define MML_VERSION_OOT 0
+#define MML_VERSION_MM 1
+
+
/**
* IO Ports
@@ -220,21 +231,190 @@
#define FONTANY_INSTR_ASM_NOISE 136
-
-#ifdef _LANGUAGE_ASEQ
-
/**
- * MML Version
- */
-
-#ifndef MML_VERSION
- #error "MML version not defined, define MML_VERSION in the cpp invocation"
+ * Command Opcode IDs
+ */
+
+// control flow commands
+#define ASEQ_OP_CONTROL_FLOW_FIRST 0xF2
+#define ASEQ_OP_RBLTZ 0xF2
+#define ASEQ_OP_RBEQZ 0xF3
+#define ASEQ_OP_RJUMP 0xF4
+#define ASEQ_OP_BGEZ 0xF5
+#define ASEQ_OP_BREAK 0xF6
+#define ASEQ_OP_LOOPEND 0xF7
+#define ASEQ_OP_LOOP 0xF8
+#define ASEQ_OP_BLTZ 0xF9
+#define ASEQ_OP_BEQZ 0xFA
+#define ASEQ_OP_JUMP 0xFB
+#define ASEQ_OP_CALL 0xFC
+#define ASEQ_OP_DELAY 0xFD
+#define ASEQ_OP_DELAY1 0xFE
+#define ASEQ_OP_END 0xFF
+
+// sequence commands
+#define ASEQ_OP_SEQ_TESTCHAN 0x00 // low nibble used as argument
+#define ASEQ_OP_SEQ_STOPCHAN 0x40 // low nibble used as argument
+#define ASEQ_OP_SEQ_SUBIO 0x50 // low nibble used as argument
+#define ASEQ_OP_SEQ_LDRES 0x60 // low nibble used as argument
+#define ASEQ_OP_SEQ_STIO 0x70 // low nibble used as argument
+#define ASEQ_OP_SEQ_LDIO 0x80 // low nibble used as argument
+#define ASEQ_OP_SEQ_LDCHAN 0x90 // low nibble used as argument
+#define ASEQ_OP_SEQ_RLDCHAN 0xA0 // low nibble used as argument
+#define ASEQ_OP_SEQ_LDSEQ 0xB0 // low nibble used as argument
+#if (MML_VERSION == MML_VERSION_MM)
+#define ASEQ_OP_SEQ_C2 0xC2
+#define ASEQ_OP_SEQ_C3 0xC3
+#endif
+#define ASEQ_OP_SEQ_RUNSEQ 0xC4
+#define ASEQ_OP_SEQ_SCRIPTCTR 0xC5
+#define ASEQ_OP_SEQ_STOP 0xC6
+#define ASEQ_OP_SEQ_STSEQ 0xC7
+#define ASEQ_OP_SEQ_SUB 0xC8
+#define ASEQ_OP_SEQ_AND 0xC9
+#define ASEQ_OP_SEQ_LDI 0xCC
+#define ASEQ_OP_SEQ_DYNCALL 0xCD
+#define ASEQ_OP_SEQ_RAND 0xCE
+#define ASEQ_OP_SEQ_NOTEALLOC 0xD0
+#define ASEQ_OP_SEQ_LDSHORTGATEARR 0xD1
+#define ASEQ_OP_SEQ_LDSHORTVELARR 0xD2
+#define ASEQ_OP_SEQ_MUTEBHV 0xD3
+#define ASEQ_OP_SEQ_MUTE 0xD4
+#define ASEQ_OP_SEQ_MUTESCALE 0xD5
+#define ASEQ_OP_SEQ_FREECHAN 0xD6
+#define ASEQ_OP_SEQ_INITCHAN 0xD7
+#define ASEQ_OP_SEQ_VOLSCALE 0xD9
+#define ASEQ_OP_SEQ_VOLMODE 0xDA
+#define ASEQ_OP_SEQ_VOL 0xDB
+#define ASEQ_OP_SEQ_TEMPOCHG 0xDC
+#define ASEQ_OP_SEQ_TEMPO 0xDD
+#define ASEQ_OP_SEQ_RTRANSPOSE 0xDE
+#define ASEQ_OP_SEQ_TRANSPOSE 0xDF
+#define ASEQ_OP_SEQ_EF 0xEF
+#define ASEQ_OP_SEQ_FREENOTELIST 0xF0
+#define ASEQ_OP_SEQ_ALLOCNOTELIST 0xF1
+
+// channel commands
+#define ASEQ_OP_CHAN_CDELAY 0x00 // low nibble used as argument
+#define ASEQ_OP_CHAN_LDSAMPLE 0x10 // low nibble used as argument
+#define ASEQ_OP_CHAN_LDCHAN 0x20 // low nibble used as argument
+#define ASEQ_OP_CHAN_STCIO 0x30 // low nibble used as argument
+#define ASEQ_OP_CHAN_LDCIO 0x40 // low nibble used as argument
+#define ASEQ_OP_CHAN_SUBIO 0x50 // low nibble used as argument
+#define ASEQ_OP_CHAN_LDIO 0x60 // low nibble used as argument
+#define ASEQ_OP_CHAN_STIO 0x70 // lower 3 bits used as argument
+#define ASEQ_OP_CHAN_RLDLAYER 0x78 // lower 3 bits used as argument
+#define ASEQ_OP_CHAN_TESTLAYER 0x80 // lower 3 bits used as argument
+#define ASEQ_OP_CHAN_LDLAYER 0x88 // lower 3 bits used as argument
+#define ASEQ_OP_CHAN_DELLAYER 0x90 // lower 3 bits used as argument
+#define ASEQ_OP_CHAN_DYNLDLAYER 0x98 // lower 3 bits used as argument
+#if (MML_VERSION == MML_VERSION_MM)
+#define ASEQ_OP_CHAN_A0 0xA0
+#define ASEQ_OP_CHAN_A1 0xA1
+#define ASEQ_OP_CHAN_A2 0xA2
+#define ASEQ_OP_CHAN_A3 0xA3
+#define ASEQ_OP_CHAN_A4 0xA4
+#define ASEQ_OP_CHAN_A5 0xA5
+#define ASEQ_OP_CHAN_A6 0xA6
+#define ASEQ_OP_CHAN_A7 0xA7
+#define ASEQ_OP_CHAN_RANDPTR 0xA8
+#endif
+#define ASEQ_OP_CHAN_LDFILTER 0xB0
+#define ASEQ_OP_CHAN_FREEFILTER 0xB1
+#define ASEQ_OP_CHAN_LDSEQTOPTR 0xB2
+#define ASEQ_OP_CHAN_FILTER 0xB3
+#define ASEQ_OP_CHAN_PTRTODYNTBL 0xB4
+#define ASEQ_OP_CHAN_DYNTBLTOPTR 0xB5
+#define ASEQ_OP_CHAN_DYNTBLV 0xB6
+#define ASEQ_OP_CHAN_RANDTOPTR 0xB7
+#define ASEQ_OP_CHAN_RAND 0xB8
+#define ASEQ_OP_CHAN_RANDVEL 0xB9
+#define ASEQ_OP_CHAN_RANDGATE 0xBA
+#define ASEQ_OP_CHAN_COMBFILTER 0xBB
+#define ASEQ_OP_CHAN_PTRADD 0xBC
+#if (MML_VERSION == MML_VERSION_OOT)
+#define ASEQ_OP_CHAN_RANDPTR 0xBD
+#endif
+#if (MML_VERSION == MML_VERSION_MM)
+#define ASEQ_OP_CHAN_SAMPLESTART 0xBD
+#define ASEQ_OP_CHAN_UNK_BE 0xBE
+#endif
+#define ASEQ_OP_CHAN_INSTR 0xC1
+#define ASEQ_OP_CHAN_DYNTBL 0xC2
+#define ASEQ_OP_CHAN_SHORT 0xC3
+#define ASEQ_OP_CHAN_NOSHORT 0xC4
+#define ASEQ_OP_CHAN_DYNTBLLOOKUP 0xC5
+#define ASEQ_OP_CHAN_FONT 0xC6
+#define ASEQ_OP_CHAN_STSEQ 0xC7
+#define ASEQ_OP_CHAN_SUB 0xC8
+#define ASEQ_OP_CHAN_AND 0xC9
+#define ASEQ_OP_CHAN_MUTEBHV 0xCA
+#define ASEQ_OP_CHAN_LDSEQ 0xCB
+#define ASEQ_OP_CHAN_LDI 0xCC
+#define ASEQ_OP_CHAN_STOPCHAN 0xCD
+#define ASEQ_OP_CHAN_LDPTR 0xCE
+#define ASEQ_OP_CHAN_STPTRTOSEQ 0xCF
+#define ASEQ_OP_CHAN_EFFECTS 0xD0
+#define ASEQ_OP_CHAN_NOTEALLOC 0xD1
+#define ASEQ_OP_CHAN_SUSTAIN 0xD2
+#define ASEQ_OP_CHAN_BEND 0xD3
+#define ASEQ_OP_CHAN_REVERB 0xD4
+#define ASEQ_OP_CHAN_VIBFREQ 0xD7
+#define ASEQ_OP_CHAN_VIBDEPTH 0xD8
+#define ASEQ_OP_CHAN_RELEASERATE 0xD9
+#define ASEQ_OP_CHAN_ENV 0xDA
+#define ASEQ_OP_CHAN_TRANSPOSE 0xDB
+#define ASEQ_OP_CHAN_PANWEIGHT 0xDC
+#define ASEQ_OP_CHAN_PAN 0xDD
+#define ASEQ_OP_CHAN_FREQSCALE 0xDE
+#define ASEQ_OP_CHAN_VOL 0xDF
+#define ASEQ_OP_CHAN_VOLEXP 0xE0
+#define ASEQ_OP_CHAN_VIBFREQGRAD 0xE1
+#define ASEQ_OP_CHAN_VIBDEPTHGRAD 0xE2
+#define ASEQ_OP_CHAN_VIBDELAY 0xE3
+#define ASEQ_OP_CHAN_DYNCALL 0xE4
+#define ASEQ_OP_CHAN_REVERBIDX 0xE5
+#define ASEQ_OP_CHAN_SAMPLEBOOK 0xE6
+#define ASEQ_OP_CHAN_LDPARAMS 0xE7
+#define ASEQ_OP_CHAN_PARAMS 0xE8
+#define ASEQ_OP_CHAN_NOTEPRI 0xE9
+#define ASEQ_OP_CHAN_STOP 0xEA
+#define ASEQ_OP_CHAN_FONTINSTR 0xEB
+#define ASEQ_OP_CHAN_VIBRESET 0xEC
+#define ASEQ_OP_CHAN_GAIN 0xED
+#define ASEQ_OP_CHAN_BENDFINE 0xEE
+#define ASEQ_OP_CHAN_FREENOTELIST 0xF0
+#define ASEQ_OP_CHAN_ALLOCNOTELIST 0xF1
+
+// layer commands
+#define ASEQ_OP_LAYER_NOTEDVG 0x00
+#define ASEQ_OP_LAYER_NOTEDV 0x40
+#define ASEQ_OP_LAYER_NOTEVG 0x80
+#define ASEQ_OP_LAYER_LDELAY 0xC0
+#define ASEQ_OP_LAYER_SHORTVEL 0xC1
+#define ASEQ_OP_LAYER_TRANSPOSE 0xC2
+#define ASEQ_OP_LAYER_SHORTDELAY 0xC3
+#define ASEQ_OP_LAYER_LEGATO 0xC4
+#define ASEQ_OP_LAYER_NOLEGATO 0xC5
+#define ASEQ_OP_LAYER_INSTR 0xC6
+#define ASEQ_OP_LAYER_PORTAMENTO 0xC7
+#define ASEQ_OP_LAYER_NOPORTAMENTO 0xC8
+#define ASEQ_OP_LAYER_SHORTGATE 0xC9
+#define ASEQ_OP_LAYER_NOTEPAN 0xCA
+#define ASEQ_OP_LAYER_ENV 0xCB
+#define ASEQ_OP_LAYER_NODRUMPAN 0xCC
+#define ASEQ_OP_LAYER_STEREO 0xCD
+#define ASEQ_OP_LAYER_BENDFINE 0xCE
+#define ASEQ_OP_LAYER_RELEASERATE 0xCF
+#define ASEQ_OP_LAYER_LDSHORTVEL 0xD0 // low nibble used as an argument
+#define ASEQ_OP_LAYER_LDSHORTGATE 0xE0 // low nibble used as an argument
+#if (MML_VERSION == MML_VERSION_MM)
+#define ASEQ_OP_LAYER_F0 0xF0
+#define ASEQ_OP_LAYER_F1 0xF1
#endif
-
-#define MML_VERSION_OOT 0
-#define MML_VERSION_MM 1
+#ifdef _LANGUAGE_ASEQ
/**
* IDENT
@@ -391,7 +571,7 @@ _RESET_SECTION
/* `ldseq` changes structure based on current section. */
.purgem ldseq
.macro ldseq ioPortNum, seqId, label
- _wr_cmd_id ldseq, 0xB0,,,,,,,, \ioPortNum, 4
+ _wr_cmd_id ldseq, ASEQ_OP_SEQ_LDSEQ,,,,,,,, \ioPortNum, 4
_wr_u8 \seqId
_wr_lbl \label
.endm
@@ -409,7 +589,7 @@ _RESET_SECTION
/* `ldseq` changes structure based on current section. */
.purgem ldseq
.macro ldseq label
- _wr_cmd_id ldseq, ,0xCB,,,,,,, 0, 0
+ _wr_cmd_id ldseq, ,ASEQ_OP_CHAN_LDSEQ,,,,,,, 0, 0
_wr_lbl \label
.endm
@@ -419,14 +599,14 @@ _RESET_SECTION
_check_arg_bitwidth_u \lowpassCutoff, 4
_check_arg_bitwidth_u \highpassCutoff, 4
- _wr_cmd_id filter, ,0xB3,,,,,,, 0, 0
+ _wr_cmd_id filter, ,ASEQ_OP_CHAN_FILTER,,,,,,, 0, 0
_wr_u8 (\lowpassCutoff << 4) | (\highpassCutoff)
.endm
/* `env` changes structure based on current section. */
.purgem env
.macro env label
- _wr_cmd_id env, ,0xDA,,,,,,, 0, 0
+ _wr_cmd_id env, ,ASEQ_OP_CHAN_ENV,,,,,,, 0, 0
_wr_lbl \label
.endm
@@ -443,7 +623,7 @@ _RESET_SECTION
/* `env` changes structure based on current section. */
.purgem env
.macro env label, arg
- _wr_cmd_id env, ,,0xCB,,,,,, 0, 0
+ _wr_cmd_id env, ,,ASEQ_OP_LAYER_ENV,,,,,, 0, 0
_wr_lbl \label
_wr_u8 \arg
.endm
@@ -734,7 +914,7 @@ $reladdr\@:
* closed, so are its layers.
*/
.macro end
- _wr_cmd_id end, 0xFF,0xFF,0xFF,,,,,, 0, 0
+ _wr_cmd_id end, ASEQ_OP_END,ASEQ_OP_END,ASEQ_OP_END,,,,,, 0, 0
.endm
/**
@@ -743,7 +923,7 @@ $reladdr\@:
* Delays for one tick.
*/
.macro delay1
- _wr_cmd_id delay1, 0xFE,0xFE,,,,,,, 0, 0
+ _wr_cmd_id delay1, ASEQ_OP_DELAY1,ASEQ_OP_DELAY1,,,,,,, 0, 0
.endm
/**
@@ -752,7 +932,7 @@ $reladdr\@:
* Delays for `delay` ticks.
*/
.macro delay delay
- _wr_cmd_id delay, 0xFD,0xFD,,,,,,, 0, 0
+ _wr_cmd_id delay, ASEQ_OP_DELAY,ASEQ_OP_DELAY,,,,,,, 0, 0
_var \delay
.endm
@@ -763,7 +943,7 @@ $reladdr\@:
* subroutine encounters an `end` instruction.
*/
.macro call label
- _wr_cmd_id call, 0xFC,0xFC,0xFC,,,,,, 0, 0
+ _wr_cmd_id call, ASEQ_OP_CALL,ASEQ_OP_CALL,ASEQ_OP_CALL,,,,,, 0, 0
_wr_lbl \label
.endm
@@ -773,7 +953,7 @@ $reladdr\@:
* Branches to `label` unconditionally.
*/
.macro jump label
- _wr_cmd_id jump, 0xFB,0xFB,0xFB,,,,,, 0, 0
+ _wr_cmd_id jump, ASEQ_OP_JUMP,ASEQ_OP_JUMP,ASEQ_OP_JUMP,,,,,, 0, 0
_wr_lbl \label
.endm
@@ -783,7 +963,7 @@ $reladdr\@:
* Branches to `label` if TR == 0.
*/
.macro beqz label
- _wr_cmd_id beqz, 0xFA,0xFA,0xFA,,,,,, 0, 0
+ _wr_cmd_id beqz, ASEQ_OP_BEQZ,ASEQ_OP_BEQZ,ASEQ_OP_BEQZ,,,,,, 0, 0
_wr_lbl \label
.endm
@@ -793,7 +973,7 @@ $reladdr\@:
* Branches to `label` if TR < 0.
*/
.macro bltz label
- _wr_cmd_id beqz, 0xF9,0xF9,0xF9,,,,,, 0, 0
+ _wr_cmd_id beqz, ASEQ_OP_BLTZ,ASEQ_OP_BLTZ,ASEQ_OP_BLTZ,,,,,, 0, 0
_wr_lbl \label
.endm
@@ -807,7 +987,7 @@ $reladdr\@:
* becomes full.
*/
.macro loop num
- _wr_cmd_id loop, 0xF8,0xF8,0xF8,,,,,, 0, 0
+ _wr_cmd_id loop, ASEQ_OP_LOOP,ASEQ_OP_LOOP,ASEQ_OP_LOOP,,,,,, 0, 0
_wr_u8 \num
.endm
@@ -821,7 +1001,7 @@ $reladdr\@:
* stack is popped.
*/
.macro loopend
- _wr_cmd_id loopend, 0xF7,0xF7,0xF7,,,,,, 0, 0
+ _wr_cmd_id loopend, ASEQ_OP_LOOPEND,ASEQ_OP_LOOPEND,ASEQ_OP_LOOPEND,,,,,, 0, 0
.endm
/**
@@ -834,7 +1014,7 @@ $reladdr\@:
* the call stack would be popped twice.
*/
.macro break
- _wr_cmd_id break, 0xF6,0xF6,0xF6,,,,,, 0, 0
+ _wr_cmd_id break, ASEQ_OP_BREAK,ASEQ_OP_BREAK,ASEQ_OP_BREAK,,,,,, 0, 0
.endm
/**
@@ -843,7 +1023,7 @@ $reladdr\@:
* Branches to `label` if TR >= 0.
*/
.macro bgez label
- _wr_cmd_id bgez, 0xF5,0xF5,0xF5,,,,,, 0, 0
+ _wr_cmd_id bgez, ASEQ_OP_BGEZ,ASEQ_OP_BGEZ,ASEQ_OP_BGEZ,,,,,, 0, 0
_wr_lbl \label
.endm
@@ -857,7 +1037,7 @@ $reladdr\@:
* signed 8-bit (+/-128) range are reachable.
*/
.macro rjump label
- _wr_cmd_id rjump, 0xF4,0xF4,0xF4,,,,,, 0, 0
+ _wr_cmd_id rjump, ASEQ_OP_RJUMP,ASEQ_OP_RJUMP,ASEQ_OP_RJUMP,,,,,, 0, 0
_wr_8_rel \label
.endm
@@ -871,7 +1051,7 @@ $reladdr\@:
* signed 8-bit (+/-128) range are reachable.
*/
.macro rbeqz label
- _wr_cmd_id rbeqz, 0xF3,0xF3,0xF3,,,,,, 0, 0
+ _wr_cmd_id rbeqz, ASEQ_OP_RBEQZ,ASEQ_OP_RBEQZ,ASEQ_OP_RBEQZ,,,,,, 0, 0
_wr_8_rel \label
.endm
@@ -885,7 +1065,7 @@ $reladdr\@:
* signed 8-bit (+/-128) range are reachable.
*/
.macro rbltz label
- _wr_cmd_id rbltz, 0xF2,0xF2,0xF2,,,,,, 0, 0
+ _wr_cmd_id rbltz, ASEQ_OP_RBLTZ,ASEQ_OP_RBLTZ,ASEQ_OP_RBLTZ,,,,,, 0, 0
_wr_8_rel \label
.endm
@@ -895,7 +1075,7 @@ $reladdr\@:
* Clears the channel note pool and reallocates it with space for `num` notes.
*/
.macro allocnotelist num
- _wr_cmd_id allocnotelist, 0xF1,0xF1,,,,,,, 0, 0
+ _wr_cmd_id allocnotelist, ASEQ_OP_SEQ_ALLOCNOTELIST,ASEQ_OP_CHAN_ALLOCNOTELIST,,,,,,, 0, 0
_wr_u8 \num
.endm
@@ -905,7 +1085,7 @@ $reladdr\@:
* Clears the channel note pool.
*/
.macro freenotelist
- _wr_cmd_id freenotelist, 0xF0,0xF0,,,,,,, 0, 0
+ _wr_cmd_id freenotelist, ASEQ_OP_SEQ_FREENOTELIST,ASEQ_OP_CHAN_FREENOTELIST,,,,,,, 0, 0
.endm
/**
@@ -914,7 +1094,7 @@ $reladdr\@:
* Has no function.
*/
.macro unk_EF arg1, arg2
- _wr_cmd_id unk_EF, 0xEF,,,,,,,, 0, 0
+ _wr_cmd_id unk_EF, ASEQ_OP_SEQ_EF,,,,,,,, 0, 0
_wr_s16 \arg1
_w_u8 \arg2
.endm
@@ -925,7 +1105,7 @@ $reladdr\@:
* Fine-tunes the pitch bend amount for the channel or layer.
*/
.macro bendfine amt
- _wr_cmd_id bendfine, ,0xEE,0xCE,,,,,, 0, 0
+ _wr_cmd_id bendfine, ,ASEQ_OP_CHAN_BENDFINE,ASEQ_OP_LAYER_BENDFINE,,,,,, 0, 0
_wr_s8 \amt
.endm
@@ -935,7 +1115,7 @@ $reladdr\@:
* Sets the channel gain (multiplicative volume scale factor) to the provided qu4.4 fixed-point value.
*/
.macro gain value
- _wr_cmd_id gain, ,0xED,,,,,,, 0, 0
+ _wr_cmd_id gain, ,ASEQ_OP_CHAN_GAIN,,,,,,, 0, 0
_wr_u8 \value
.endm
@@ -945,7 +1125,7 @@ $reladdr\@:
* Resets channel vibrato, filter, gain, sustain, etc. state.
*/
.macro vibreset
- _wr_cmd_id vibreset, ,0xEC,,,,,,, 0, 0
+ _wr_cmd_id vibreset, ,ASEQ_OP_CHAN_VIBRESET,,,,,,, 0, 0
.endm
/**
@@ -954,7 +1134,7 @@ $reladdr\@:
* Updates the soundfont and instrument for the channel simultaneously.
*/
.macro fontinstr fontId, instId
- _wr_cmd_id fontinstr, ,0xEB,,,,,,, 0, 0
+ _wr_cmd_id fontinstr, ,ASEQ_OP_CHAN_FONTINSTR,,,,,,, 0, 0
_wr_u8 \fontId
_wr_u8 \instId
.endm
@@ -967,7 +1147,7 @@ $reladdr\@:
.macro notepri priority1, priority2
_check_arg_bitwidth_u \priority1, 4
_check_arg_bitwidth_u \priority2, 4
- _wr_cmd_id notepri, ,0xE9,,,,,,, 0, 0
+ _wr_cmd_id notepri, ,ASEQ_OP_CHAN_NOTEPRI,,,,,,, 0, 0
_wr_u8 (\priority1 << 4) | \priority2
.endm
@@ -978,7 +1158,7 @@ $reladdr\@:
* Sets various channel parameters.
*/
.macro params muteBhv, noteAllocPolicy, channelPriority, transposition, pan, panWeight, reverb, reverbIndex
- _wr_cmd_id params, ,0xE8,,,,,,, 0, 0
+ _wr_cmd_id params, ,ASEQ_OP_CHAN_PARAMS,,,,,,, 0, 0
_wr_u8 \muteBhv
_wr_u8 \noteAllocPolicy
_wr_u8 \channelPriority
@@ -996,7 +1176,7 @@ $reladdr\@:
* is ordered in the same way as the arguments in `params`.
*/
.macro ldparams label
- _wr_cmd_id ldparams, ,0xE7,,,,,,, 0, 0
+ _wr_cmd_id ldparams, ,ASEQ_OP_CHAN_LDPARAMS,,,,,,, 0, 0
_wr_lbl \label
.endm
@@ -1006,7 +1186,7 @@ $reladdr\@:
* Sets the sample book mode.
*/
.macro samplebook value
- _wr_cmd_id samplebook, ,0xE6,,,,,,, 0, 0
+ _wr_cmd_id samplebook, ,ASEQ_OP_CHAN_SAMPLEBOOK,,,,,,, 0, 0
_wr_u8 \value
.endm
@@ -1016,7 +1196,7 @@ $reladdr\@:
* Sets the channel reverb.
*/
.macro reverbidx arg
- _wr_cmd_id reverbidx, ,0xE5,,,,,,, 0, 0
+ _wr_cmd_id reverbidx, ,ASEQ_OP_CHAN_REVERBIDX,,,,,,, 0, 0
_wr_u8 \arg
.endm
@@ -1026,7 +1206,7 @@ $reladdr\@:
* Sets the channel vibrato delay.
*/
.macro vibdelay arg
- _wr_cmd_id vibdelay, ,0xE3,,,,,,, 0, 0
+ _wr_cmd_id vibdelay, ,ASEQ_OP_CHAN_VIBDELAY,,,,,,, 0, 0
_wr_u8 \arg
.endm
@@ -1036,7 +1216,7 @@ $reladdr\@:
* Sets the vibrato extent.
*/
.macro vibdepthgrad arg0, arg1, arg2
- _wr_cmd_id vibdepthgrad, ,0xE2,,,,,,, 0, 0
+ _wr_cmd_id vibdepthgrad, ,ASEQ_OP_CHAN_VIBDEPTHGRAD,,,,,,, 0, 0
_wr_u8 \arg0
_wr_u8 \arg1
_wr_u8 \arg2
@@ -1048,7 +1228,7 @@ $reladdr\@:
* Sets the vibrato rate.
*/
.macro vibfreqgrad arg0, arg1, arg2
- _wr_cmd_id vibfreqgrad, ,0xE1,,,,,,, 0, 0
+ _wr_cmd_id vibfreqgrad, ,ASEQ_OP_CHAN_VIBFREQGRAD,,,,,,, 0, 0
_wr_u8 \arg0
_wr_u8 \arg1
_wr_u8 \arg2
@@ -1060,7 +1240,7 @@ $reladdr\@:
* Changes the expression amount for the channel.
*/
.macro volexp amt
- _wr_cmd_id volexp, ,0xE0,,,,,,, 0, 0
+ _wr_cmd_id volexp, ,ASEQ_OP_CHAN_VOLEXP,,,,,,, 0, 0
_wr_u8 \amt
.endm
@@ -1071,7 +1251,7 @@ $reladdr\@:
* provided number of semitones.
*/
.macro transpose semitones
- _wr_cmd_id transpose, 0xDF,0xDB,0xC2,,,,,, 0, 0
+ _wr_cmd_id transpose, ASEQ_OP_SEQ_TRANSPOSE,ASEQ_OP_CHAN_TRANSPOSE,ASEQ_OP_LAYER_TRANSPOSE,,,,,, 0, 0
_wr_s8 \semitones
.endm
@@ -1081,7 +1261,7 @@ $reladdr\@:
* Adjusts the transposition amount. This is only available at the top sequence level.
*/
.macro rtranspose semitones
- _wr_cmd_id rtranspose, 0xDE,,,,,,,, 0, 0
+ _wr_cmd_id rtranspose, ASEQ_OP_SEQ_RTRANSPOSE,,,,,,,, 0, 0
_wr_s8 \semitones
.endm
@@ -1091,7 +1271,7 @@ $reladdr\@:
* Sets the freqScale for the current channel.
*/
.macro freqscale arg
- _wr_cmd_id freqscale, ,0xDE,,,,,,, 0, 0
+ _wr_cmd_id freqscale, ,ASEQ_OP_CHAN_FREQSCALE,,,,,,, 0, 0
_wr_s16 \arg
.endm
@@ -1101,7 +1281,7 @@ $reladdr\@:
* Changes the tempo of the sequence.
*/
.macro tempo bpm
- _wr_cmd_id tempo, 0xDD,,,,,,,, 0, 0
+ _wr_cmd_id tempo, ASEQ_OP_SEQ_TEMPO,,,,,,,, 0, 0
_wr_u8 \bpm
.endm
@@ -1111,7 +1291,7 @@ $reladdr\@:
* Sets the tempoChange for the sequence.
*/
.macro tempochg arg
- _wr_cmd_id tempochg, 0xDC,,,,,,,, 0, 0
+ _wr_cmd_id tempochg, ASEQ_OP_SEQ_TEMPOCHG,,,,,,,, 0, 0
_wr_s8 \arg
.endm
@@ -1123,7 +1303,7 @@ $reladdr\@:
.macro pan pan
/* pan can only take values in 0..127 */
_check_arg_bitwidth_u \pan, 7
- _wr_cmd_id pan, ,0xDD,,,,,,, 0, 0
+ _wr_cmd_id pan, ,ASEQ_OP_CHAN_PAN,,,,,,, 0, 0
_wr_u8 \pan
.endm
@@ -1139,7 +1319,7 @@ $reladdr\@:
.macro panweight weight
/* weight can only take values in 0..127 */
_check_arg_bitwidth_u \weight, 7
- _wr_cmd_id panweight, ,0xDC,,,,,,, 0, 0
+ _wr_cmd_id panweight, ,ASEQ_OP_CHAN_PANWEIGHT,,,,,,, 0, 0
_wr_u8 \weight
.endm
@@ -1149,7 +1329,7 @@ $reladdr\@:
* Sets the volume amount for this sequence or channel.
*/
.macro vol amt
- _wr_cmd_id vol, 0xDB,0xDF,,,,,,, 0, 0
+ _wr_cmd_id vol, ASEQ_OP_SEQ_VOL,ASEQ_OP_CHAN_VOL,,,,,,, 0, 0
_wr_u8 \amt
.endm
@@ -1159,7 +1339,7 @@ $reladdr\@:
* TODO DESCRIPTION
*/
.macro volmode mode, fadeTimer
- _wr_cmd_id volmode, 0xDA,,,,,,,, 0, 0
+ _wr_cmd_id volmode, ASEQ_OP_SEQ_VOLMODE,,,,,,,, 0, 0
_wr_u8 \mode
_wr_u16 \fadeTimer
.endm
@@ -1170,7 +1350,7 @@ $reladdr\@:
* Sets the fadeVolumeScale for the sequence.
*/
.macro volscale arg
- _wr_cmd_id volscale, 0xD9,,,,,,,, 0, 0
+ _wr_cmd_id volscale, ASEQ_OP_SEQ_VOLSCALE,,,,,,,, 0, 0
_wr_u8 \arg
.endm
@@ -1180,7 +1360,7 @@ $reladdr\@:
* Sets the envelope release rate for this channel or layer.
*/
.macro releaserate release
- _wr_cmd_id releaserate, ,0xD9,0xCF,,,,,, 0, 0
+ _wr_cmd_id releaserate, ,ASEQ_OP_CHAN_RELEASERATE,ASEQ_OP_LAYER_RELEASERATE,,,,,, 0, 0
_wr_u8 \release
.endm
@@ -1190,7 +1370,7 @@ $reladdr\@:
* Sets the vibrato depth for the channel.
*/
.macro vibdepth arg
- _wr_cmd_id vibdepth, ,0xD8,,,,,,, 0, 0
+ _wr_cmd_id vibdepth, ,ASEQ_OP_CHAN_VIBDEPTH,,,,,,, 0, 0
_wr_u8 \arg
.endm
@@ -1200,7 +1380,7 @@ $reladdr\@:
* Sets the vibrato rate for the channel.
*/
.macro vibfreq arg
- _wr_cmd_id vibfreq, ,0xD7,,,,,,, 0, 0
+ _wr_cmd_id vibfreq, ,ASEQ_OP_CHAN_VIBFREQ,,,,,,, 0, 0
_wr_u8 \arg
.endm
@@ -1213,7 +1393,7 @@ $reladdr\@:
* initchan 0b101 initializes channels 0 and 2.
*/
.macro initchan bitmask
- _wr_cmd_id initchan, 0xD7,,,,,,,, 0, 0
+ _wr_cmd_id initchan, ASEQ_OP_SEQ_INITCHAN,,,,,,,, 0, 0
_wr_u16 \bitmask
.endm
@@ -1223,7 +1403,7 @@ $reladdr\@:
* Frees the channels marked in the provided bitmask.
*/
.macro freechan bitmask
- _wr_cmd_id freechan, 0xD6,,,,,,,, 0, 0
+ _wr_cmd_id freechan, ASEQ_OP_SEQ_FREECHAN,,,,,,,, 0, 0
_wr_u16 \bitmask
.endm
@@ -1233,7 +1413,7 @@ $reladdr\@:
* Sets the muteVolumeScale for the sequence.
*/
.macro mutescale arg
- _wr_cmd_id mutescale, 0xD5,,,,,,,, 0, 0
+ _wr_cmd_id mutescale, ASEQ_OP_SEQ_MUTESCALE,,,,,,,, 0, 0
_wr_s8 \arg
.endm
@@ -1243,7 +1423,7 @@ $reladdr\@:
* Mutes the sequence player.
*/
.macro mute
- _wr_cmd_id mute, 0xD4,,,,,,,, 0, 0
+ _wr_cmd_id mute, ASEQ_OP_SEQ_MUTE,,,,,,,, 0, 0
.endm
/**
@@ -1252,7 +1432,7 @@ $reladdr\@:
* Sets the reverb amount for this channel.
*/
.macro reverb amt
- _wr_cmd_id reverb, ,0xD4,,,,,,, 0, 0
+ _wr_cmd_id reverb, ,ASEQ_OP_CHAN_REVERB,,,,,,, 0, 0
_wr_u8 \amt
.endm
@@ -1262,7 +1442,7 @@ $reladdr\@:
* Sets mute behavior for this sequence or channel.
*/
.macro mutebhv flags
- _wr_cmd_id mutebhv, 0xD3,0xCA,,,,,,, 0, 0
+ _wr_cmd_id mutebhv, ASEQ_OP_SEQ_MUTEBHV,ASEQ_OP_CHAN_MUTEBHV,,,,,,, 0, 0
_wr_u8 \flags
.endm
@@ -1272,7 +1452,7 @@ $reladdr\@:
* Sets the pitch bend amount for this channel.
*/
.macro bend amt
- _wr_cmd_id bend, ,0xD3,,,,,,, 0, 0
+ _wr_cmd_id bend, ,ASEQ_OP_CHAN_BEND,,,,,,, 0, 0
_wr_s8 \amt
.endm
@@ -1282,7 +1462,7 @@ $reladdr\@:
* Sets the location of SHORTVELTBL.
*/
.macro ldshortvelarr label
- _wr_cmd_id ldshortvelarr, 0xD2,,,,,,,, 0, 0
+ _wr_cmd_id ldshortvelarr, ASEQ_OP_SEQ_LDSHORTVELARR,,,,,,,, 0, 0
_wr_lbl \label
.endm
@@ -1292,7 +1472,7 @@ $reladdr\@:
* Sets the adsr sustain value for this channel.
*/
.macro sustain value
- _wr_cmd_id sustain, ,0xD2,,,,,,, 0, 0
+ _wr_cmd_id sustain, ,ASEQ_OP_CHAN_SUSTAIN,,,,,,, 0, 0
_wr_u8 \value
.endm
@@ -1302,7 +1482,7 @@ $reladdr\@:
* Sets the location of SHORTGATETBL.
*/
.macro ldshortgatearr label
- _wr_cmd_id ldshortgatearr, 0xD1,,,,,,,, 0, 0
+ _wr_cmd_id ldshortgatearr, ASEQ_OP_SEQ_LDSHORTGATEARR,,,,,,,, 0, 0
_wr_lbl \label
.endm
@@ -1312,7 +1492,7 @@ $reladdr\@:
* Sets the noteAllocPolicy for either the sequence or the current channel.
*/
.macro notealloc arg
- _wr_cmd_id notealloc, 0xD0,0xD1,,,,,,, 0, 0
+ _wr_cmd_id notealloc, ASEQ_OP_SEQ_NOTEALLOC,ASEQ_OP_CHAN_NOTEALLOC,,,,,,, 0, 0
_wr_u8 \arg
.endm
@@ -1329,7 +1509,7 @@ $reladdr\@:
_check_arg_bitwidth_u \strongRvrbR, 1
_check_arg_bitwidth_u \strongRvrbL, 1
- _wr_cmd_id effects, ,0xD0,,,,,,, 0, 0
+ _wr_cmd_id effects, ,ASEQ_OP_CHAN_EFFECTS,,,,,,, 0, 0
_wr_u8 (\headset << 7) | (\type << 4) | (\strongR << 3) | (\strongL << 2) | (\strongRvrbR << 1) | (\strongRvrbL << 0)
.endm
@@ -1339,7 +1519,7 @@ $reladdr\@:
* Stores TP -> label
*/
.macro stptrtoseq label
- _wr_cmd_id stptrtoseq, ,0xCF,,,,,,, 0, 0
+ _wr_cmd_id stptrtoseq, ,ASEQ_OP_CHAN_STPTRTOSEQ,,,,,,, 0, 0
_wr_lbl \label
.endm
@@ -1349,7 +1529,7 @@ $reladdr\@:
* Loads label -> TP
*/
.macro ldptr label
- _wr_cmd_id ldptr, ,0xCE,,,,,,, 0, 0
+ _wr_cmd_id ldptr, ,ASEQ_OP_CHAN_LDPTR,,,,,,, 0, 0
_wr_lbl \label
.endm
@@ -1359,7 +1539,7 @@ $reladdr\@:
* Loads imm -> TP
*/
.macro ldptri imm
- _wr_cmd_id ldptr, ,0xCE,,,,,,, 0, 0
+ _wr_cmd_id ldptr, ,ASEQ_OP_CHAN_LDPTR,,,,,,, 0, 0
_wr_u16 \imm
.endm
@@ -1369,7 +1549,7 @@ $reladdr\@:
* Stores a random number in the range [0, max) into TR. If max is 0 the range is [0, 255]
*/
.macro rand max
- _wr_cmd_id rand, 0xCE,0xB8,,,,,,, 0, 0
+ _wr_cmd_id rand, ASEQ_OP_SEQ_RAND,ASEQ_OP_CHAN_RAND,,,,,,, 0, 0
_wr_u8 \max
.endm
@@ -1384,9 +1564,9 @@ $reladdr\@:
*/
.macro dyncall table=-1
.if \table == -1
- _wr_cmd_id dyncall, ,0xE4,,,,,,, 0, 0
+ _wr_cmd_id dyncall, ,ASEQ_OP_CHAN_DYNCALL,,,,,,, 0, 0
.else
- _wr_cmd_id dyncall, 0xCD,,,,,,,, 0, 0
+ _wr_cmd_id dyncall, ASEQ_OP_SEQ_DYNCALL,,,,,,,, 0, 0
_wr_lbl \table
.endif
.endm
@@ -1397,7 +1577,7 @@ $reladdr\@:
* Loads the immediate value `imm` into TR.
*/
.macro ldi imm
- _wr_cmd_id ldi, 0xCC,0xCC,,,,,,, 0, 0
+ _wr_cmd_id ldi, ASEQ_OP_SEQ_LDI,ASEQ_OP_CHAN_LDI,,,,,,, 0, 0
_wr_u8 \imm
.endm
@@ -1407,7 +1587,7 @@ $reladdr\@:
* Computes TR = TR & imm
*/
.macro and imm
- _wr_cmd_id and, 0xC9,0xC9,,,,,,, 0, 0
+ _wr_cmd_id and, ASEQ_OP_SEQ_AND,ASEQ_OP_CHAN_AND,,,,,,, 0, 0
_wr_u8 \imm
.endm
@@ -1417,7 +1597,7 @@ $reladdr\@:
* Computes TR = TR - imm
*/
.macro sub imm
- _wr_cmd_id sub, 0xC8,0xC8,,,,,,, 0, 0
+ _wr_cmd_id sub, ASEQ_OP_SEQ_SUB,ASEQ_OP_CHAN_SUB,,,,,,, 0, 0
_wr_u8 \imm
.endm
@@ -1427,7 +1607,7 @@ $reladdr\@:
* Stores the u8 value `TR + imm` to the location specified by `label`.
*/
.macro stseq imm, label
- _wr_cmd_id stseq, 0xC7,0xC7,,,,,,, 0, 0
+ _wr_cmd_id stseq, ASEQ_OP_SEQ_STSEQ,ASEQ_OP_CHAN_STSEQ,,,,,,, 0, 0
_wr_u8 \imm
_wr_lbl \label
.endm
@@ -1438,7 +1618,7 @@ $reladdr\@:
* Immediately stops the sequence or channel.
*/
.macro stop
- _wr_cmd_id stop, 0xC6,0xEA,,,,,,, 0, 0
+ _wr_cmd_id stop, ASEQ_OP_SEQ_STOP,ASEQ_OP_CHAN_STOP,,,,,,, 0, 0
.endm
/**
@@ -1447,7 +1627,7 @@ $reladdr\@:
* Set the current soundfont for this channel to `fontId`.
*/
.macro font fontId
- _wr_cmd_id font, ,0xC6,,,,,,, 0, 0
+ _wr_cmd_id font, ,ASEQ_OP_CHAN_FONT,,,,,,, 0, 0
_wr_u8 \fontId
.endm
@@ -1460,7 +1640,7 @@ $reladdr\@:
* never used, so changing it with this instruction has no useful effects.
*/
.macro scriptctr arg
- _wr_cmd_id scriptctr, 0xC5,,,,,,,, 0, 0
+ _wr_cmd_id scriptctr, ASEQ_OP_SEQ_SCRIPTCTR,,,,,,,, 0, 0
_wr_u16 \arg
.endm
@@ -1471,7 +1651,7 @@ $reladdr\@:
* unless TR is -1, in which case nothing happens.
*/
.macro dyntbllookup
- _wr_cmd_id dyntbllookup, ,0xC5,,,,,,, 0, 0
+ _wr_cmd_id dyntbllookup, ,ASEQ_OP_CHAN_DYNTBLLOOKUP,,,,,,, 0, 0
.endm
/**
@@ -1480,7 +1660,7 @@ $reladdr\@:
* Plays the sequence seqId on seqPlayer.
*/
.macro runseq seqPlayer, seqId
- _wr_cmd_id runseq, 0xC4,,,,,,,, 0, 0
+ _wr_cmd_id runseq, ASEQ_OP_SEQ_RUNSEQ,,,,,,,, 0, 0
_wr_u8 \seqPlayer
_wr_u8 \seqId
.endm
@@ -1493,7 +1673,7 @@ $reladdr\@:
* TODO DESCRIPTION
*/
.macro mutechan arg0
- _wr_cmd_id mutechan, 0xC3,,,,,,,, 0, 0
+ _wr_cmd_id mutechan, ASEQ_OP_SEQ_C3,,,,,,,, 0, 0
_wr_s16 \arg0
.endm
@@ -1505,7 +1685,7 @@ $reladdr\@:
* Disable short notes encoding.
*/
.macro noshort
- _wr_cmd_id noshort, ,0xC4,,,,,,, 0, 0
+ _wr_cmd_id noshort, ,ASEQ_OP_CHAN_NOSHORT,,,,,,, 0, 0
.endm
/**
@@ -1514,7 +1694,7 @@ $reladdr\@:
* Enable short notes encoding.
*/
.macro short
- _wr_cmd_id short, ,0xC3,,,,,,, 0, 0
+ _wr_cmd_id short, ,ASEQ_OP_CHAN_SHORT,,,,,,, 0, 0
.endm
/**
@@ -1523,7 +1703,7 @@ $reladdr\@:
* Loads label -> DYNTBL
*/
.macro dyntbl label
- _wr_cmd_id dyntbl, ,0xC2,,,,,,, 0, 0
+ _wr_cmd_id dyntbl, ,ASEQ_OP_CHAN_DYNTBL,,,,,,, 0, 0
_wr_lbl \label
.endm
@@ -1533,7 +1713,7 @@ $reladdr\@:
* Set instrument `instNum` from the current soundfont as the active instrument for this channel or layer.
*/
.macro instr instNum
- _wr_cmd_id instr, ,0xC1,0xC6,,,,,, 0, 0
+ _wr_cmd_id instr, ,ASEQ_OP_CHAN_INSTR,ASEQ_OP_LAYER_INSTR,,,,,, 0, 0
_wr_u8 \instNum
.endm
@@ -1545,7 +1725,7 @@ $reladdr\@:
* TODO DESCRIPTION
*/
.macro unk_BE arg0
- _wr_cmd_id unk_BE, ,0xBE,,,,,,, 0, 0
+ _wr_cmd_id unk_BE, ,ASEQ_OP_CHAN_UNK_BE,,,,,,, 0, 0
_wr_u8 \arg0
.endm
@@ -1559,13 +1739,9 @@ $reladdr\@:
* If range is 0, it is treated as 65536.
*/
.macro randptr range, offset
- #if (MML_VERSION == MML_VERSION_OOT)
- _wr_cmd_id randptr, ,0xBD,,,,,,, 0, 0
- #else
- _wr_cmd_id randptr, ,0xA8,,,,,,, 0, 0
- #endif
- _wr_u16 \range
- _wr_u16 \offset
+ _wr_cmd_id randptr, ,ASEQ_OP_CHAN_RANDPTR,,,,,,, 0, 0
+ _wr_u16 \range
+ _wr_u16 \offset
.endm
#if (MML_VERSION == MML_VERSION_MM)
@@ -1576,7 +1752,7 @@ $reladdr\@:
* TODO DESCRIPTION
*/
.macro samplestart arg
- _wr_cmd_id samplestart, ,0xBD,,,,,,, 0, 0
+ _wr_cmd_id samplestart, ,ASEQ_OP_CHAN_SAMPLESTART,,,,,,, 0, 0
_wr_u8 \arg
.endm
@@ -1586,7 +1762,7 @@ $reladdr\@:
* TODO DESCRIPTION
*/
.macro unk_A7 arg
- _wr_cmd_id unk_A7, ,0xA7,,,,,,, 0, 0
+ _wr_cmd_id unk_A7, ,ASEQ_OP_CHAN_A7,,,,,,, 0, 0
_wr_u8 \arg
.endm
@@ -1596,7 +1772,7 @@ $reladdr\@:
* TODO DESCRIPTION
*/
.macro unk_A6 arg0, arg1
- _wr_cmd_id unk_A6, ,0xA6,,,,,,, 0, 0
+ _wr_cmd_id unk_A6, ,ASEQ_OP_CHAN_A6,,,,,,, 0, 0
_wr_u8 \arg0
_wr_s16 \arg1
.endm
@@ -1607,7 +1783,7 @@ $reladdr\@:
* TODO DESCRIPTION
*/
.macro unk_A5
- _wr_cmd_id unk_A5, ,0xA5,,,,,,, 0, 0
+ _wr_cmd_id unk_A5, ,ASEQ_OP_CHAN_A5,,,,,,, 0, 0
.endm
/**
@@ -1616,7 +1792,7 @@ $reladdr\@:
* TODO DESCRIPTION
*/
.macro unk_A4 arg
- _wr_cmd_id unk_A4, ,0xA4,,,,,,, 0, 0
+ _wr_cmd_id unk_A4, ,ASEQ_OP_CHAN_A4,,,,,,, 0, 0
_wr_u8 \arg
.endm
@@ -1626,7 +1802,7 @@ $reladdr\@:
* TODO DESCRIPTION
*/
.macro unk_A3
- _wr_cmd_id unk_A3, ,0xA3,,,,,,, 0, 0
+ _wr_cmd_id unk_A3, ,ASEQ_OP_CHAN_A3,,,,,,, 0, 0
.endm
/**
@@ -1635,7 +1811,7 @@ $reladdr\@:
* TODO DESCRIPTION
*/
.macro unk_A2 arg
- _wr_cmd_id unk_A2, ,0xA2,,,,,,, 0, 0
+ _wr_cmd_id unk_A2, ,ASEQ_OP_CHAN_A2,,,,,,, 0, 0
_wr_s16 \arg
.endm
@@ -1645,7 +1821,7 @@ $reladdr\@:
* TODO DESCRIPTION
*/
.macro unk_A1
- _wr_cmd_id unk_A1, ,0xA1,,,,,,, 0, 0
+ _wr_cmd_id unk_A1, ,ASEQ_OP_CHAN_A1,,,,,,, 0, 0
.endm
/**
@@ -1654,7 +1830,7 @@ $reladdr\@:
* TODO DESCRIPTION
*/
.macro unk_A0 arg
- _wr_cmd_id unk_A0, ,0xA0,,,,,,, 0, 0
+ _wr_cmd_id unk_A0, ,ASEQ_OP_CHAN_A0,,,,,,, 0, 0
_wr_s16 \arg
.endm
@@ -1666,7 +1842,7 @@ $reladdr\@:
* Computes TP += value
*/
.macro ptradd value
- _wr_cmd_id ptradd, ,0xBC,,,,,,, 0, 0
+ _wr_cmd_id ptradd, ,ASEQ_OP_CHAN_PTRADD,,,,,,, 0, 0
_wr_lbl \value
.endm
@@ -1678,7 +1854,7 @@ $reladdr\@:
* Computes TP += value
*/
.macro ptraddi value
- _wr_cmd_id ptradd, ,0xBC,,,,,,, 0, 0
+ _wr_cmd_id ptradd, ,ASEQ_OP_CHAN_PTRADD,,,,,,, 0, 0
_wr_u16 \value
.endm
@@ -1689,7 +1865,7 @@ $reladdr\@:
* TODO args? arg0=16,arg1=val<<8 maps well to midi chorus
*/
.macro combfilter arg0, arg1
- _wr_cmd_id combfilter, ,0xBB,,,,,,, 0, 0
+ _wr_cmd_id combfilter, ,ASEQ_OP_CHAN_COMBFILTER,,,,,,, 0, 0
_wr_u8 \arg0
_wr_u16 \arg1
.endm
@@ -1702,7 +1878,7 @@ $reladdr\@:
* NOTE: This feature is bugged. If this is non-zero it will actually use the range set by randvel.
*/
.macro randgate range
- _wr_cmd_id randgate, ,0xBA,,,,,,, 0, 0
+ _wr_cmd_id randgate, ,ASEQ_OP_CHAN_RANDGATE,,,,,,, 0, 0
_wr_u8 \range
.endm
@@ -1712,7 +1888,7 @@ $reladdr\@:
* Sets the range for random note velocity fluctuations.
*/
.macro randvel range
- _wr_cmd_id randvel, ,0xB9,,,,,,, 0, 0
+ _wr_cmd_id randvel, ,ASEQ_OP_CHAN_RANDVEL,,,,,,, 0, 0
_wr_u8 \range
.endm
@@ -1722,7 +1898,7 @@ $reladdr\@:
* Stores a random number in the range [0, max) into TP. If max is 0 the range is [0, 65535]
*/
.macro randtoptr max
- _wr_cmd_id randtoptr, ,0xB7,,,,,,, 0, 0
+ _wr_cmd_id randtoptr, ,ASEQ_OP_CHAN_RANDTOPTR,,,,,,, 0, 0
_wr_u16 \max
.endm
@@ -1732,7 +1908,7 @@ $reladdr\@:
* Loads DYNTBL8[TR] -> TR
*/
.macro dyntblv
- _wr_cmd_id dyntblv, ,0xB6,,,,,,, 0, 0
+ _wr_cmd_id dyntblv, ,ASEQ_OP_CHAN_DYNTBLV,,,,,,, 0, 0
.endm
/**
@@ -1741,7 +1917,7 @@ $reladdr\@:
* Loads DYNTBL16[TR] -> TP
*/
.macro dyntbltoptr
- _wr_cmd_id dyntbltoptr, ,0xB5,,,,,,, 0, 0
+ _wr_cmd_id dyntbltoptr, ,ASEQ_OP_CHAN_DYNTBLTOPTR,,,,,,, 0, 0
.endm
/**
@@ -1750,7 +1926,7 @@ $reladdr\@:
* Transfers TP -> DYNTBL
*/
.macro ptrtodyntbl
- _wr_cmd_id ptrtodyntbl, ,0xB4,,,,,,, 0, 0
+ _wr_cmd_id ptrtodyntbl, ,ASEQ_OP_CHAN_PTRTODYNTBL,,,,,,, 0, 0
.endm
/**
@@ -1761,7 +1937,7 @@ $reladdr\@:
* Note that TR acts as an index into an array of u16 starting at label.
*/
.macro ldseqtoptr label
- _wr_cmd_id ldseqtoptr, ,0xB2,,,,,,, 0, 0
+ _wr_cmd_id ldseqtoptr, ,ASEQ_OP_CHAN_LDSEQTOPTR,,,,,,, 0, 0
_wr_lbl \label
.endm
@@ -1771,7 +1947,7 @@ $reladdr\@:
* Invalidates the current active filter buffer.
*/
.macro freefilter
- _wr_cmd_id freefilter, ,0xB1,,,,,,, 0, 0
+ _wr_cmd_id freefilter, ,ASEQ_OP_CHAN_FREEFILTER,,,,,,, 0, 0
.endm
/**
@@ -1780,7 +1956,7 @@ $reladdr\@:
* Sets the active filter buffer to the location specified by `filter`.
*/
.macro ldfilter filter
- _wr_cmd_id ldfilter, ,0xB0,,,,,,, 0, 0
+ _wr_cmd_id ldfilter, ,ASEQ_OP_CHAN_LDFILTER,,,,,,, 0, 0
_wr_lbl \filter
.endm
@@ -1791,7 +1967,7 @@ $reladdr\@:
* Delays by `delay` ticks.
*/
.macro cdelay delay
- _wr_cmd_id cdelay, ,0x00,,,,,,, \delay, 4
+ _wr_cmd_id cdelay, ,ASEQ_OP_CHAN_CDELAY,,,,,,, \delay, 4
.endm
/**
@@ -1805,9 +1981,9 @@ $reladdr\@:
*/
.macro ldsample type, portNum
.if \type == LDSAMPLE_INST
- _wr_cmd_id ldsample, ,0x10,,,,,,, \portNum, 3
+ _wr_cmd_id ldsample, ,ASEQ_OP_CHAN_LDSAMPLE,,,,,,, \portNum, 3
.elif \type == LDSAMPLE_SFX
- _wr_cmd_id ldsample, ,0x18,,,,,,, \portNum, 3
+ _wr_cmd_id ldsample, ,ASEQ_OP_CHAN_LDSAMPLE | 8,,,,,,, \portNum, 3
.else
.error "ldsample: invalid type"
.endif
@@ -1821,7 +1997,7 @@ $reladdr\@:
* Stores the contents of TR into CIO[channelNum][portNum]
*/
.macro stcio channelNum, portNum
- _wr_cmd_id stcio, ,0x30,,,,,,, \channelNum, 4
+ _wr_cmd_id stcio, ,ASEQ_OP_CHAN_STCIO,,,,,,, \channelNum, 4
_wr_u8 \portNum
.endm
@@ -1831,7 +2007,7 @@ $reladdr\@:
* Loads the contents of CIO[channelNum][portNum] into TR.
*/
.macro ldcio channelNum, portNum
- _wr_cmd_id ldcio, ,0x40,,,,,,, \channelNum, 4
+ _wr_cmd_id ldcio, ,ASEQ_OP_CHAN_LDCIO,,,,,,, \channelNum, 4
_wr_u8 \portNum
.endm
@@ -1843,7 +2019,7 @@ $reladdr\@:
* for use in position-independent code.
*/
.macro rldlayer layerNum, label
- _wr_cmd_id rldlayer, ,0x78,,,,,,, \layerNum, 3
+ _wr_cmd_id rldlayer, ,ASEQ_OP_CHAN_RLDLAYER,,,,,,, \layerNum, 3
_wr_16_rel \label
.endm
@@ -1857,7 +2033,7 @@ $reladdr\@:
* - -1 if layer does not exist.
*/
.macro testlayer layerNum
- _wr_cmd_id testlayer, ,0x80,,,,,,, \layerNum, 3
+ _wr_cmd_id testlayer, ,ASEQ_OP_CHAN_TESTLAYER,,,,,,, \layerNum, 3
.endm
/**
@@ -1866,7 +2042,7 @@ $reladdr\@:
* Opens the note layer at `label` for index `layerNum`.
*/
.macro ldlayer layerNum, label
- _wr_cmd_id ldlayer, ,0x88,,,,,,, \layerNum, 3
+ _wr_cmd_id ldlayer, ,ASEQ_OP_CHAN_LDLAYER,,,,,,, \layerNum, 3
_wr_lbl \label
.endm
@@ -1876,7 +2052,7 @@ $reladdr\@:
* Deletes the layer specified by index `layerNum`.
*/
.macro dellayer arg
- _wr_cmd_id dellayer, ,0x90,,,,,,, \arg, 3
+ _wr_cmd_id dellayer, ,ASEQ_OP_CHAN_DELLAYER,,,,,,, \arg, 3
.endm
/**
@@ -1885,7 +2061,7 @@ $reladdr\@:
* Allocates a new layer starting at the pointer read from DYNTBL16[TR]
*/
.macro dynldlayer arg
- _wr_cmd_id dynldlayer, ,0x98,,,,,,, \arg, 3
+ _wr_cmd_id dynldlayer, ,ASEQ_OP_CHAN_DYNLDLAYER,,,,,,, \arg, 3
.endm
/**
@@ -1897,7 +2073,7 @@ $reladdr\@:
* - 1 if disabled
*/
.macro testchan channelNum
- _wr_cmd_id testchan, 0x00,,,,,,,, \channelNum, 4
+ _wr_cmd_id testchan, ASEQ_OP_SEQ_TESTCHAN,,,,,,,, \channelNum, 4
.endm
/**
@@ -1907,9 +2083,9 @@ $reladdr\@:
*/
.macro stopchan channelNum
.if ASEQ_MODE == ASEQ_MODE_SEQUENCE
- _wr_cmd_id stopchan, 0x40,,,,,,,, \channelNum, 4
+ _wr_cmd_id stopchan, ASEQ_OP_SEQ_STOPCHAN,,,,,,,, \channelNum, 4
.else
- _wr_cmd_id stopchan, ,0xCD,,,,,,, 0, 0
+ _wr_cmd_id stopchan, ,ASEQ_OP_CHAN_STOPCHAN,,,,,,, 0, 0
_wr_u8 \channelNum
.endif
.endm
@@ -1924,7 +2100,7 @@ $reladdr\@:
* Computes TR = TR - CIO[CUR_CHANNEL][portNum]
*/
.macro subio portNum
- _wr_cmd_id subio, 0x50,0x50,,,,,,, \portNum, 4
+ _wr_cmd_id subio, ASEQ_OP_SEQ_SUBIO,ASEQ_OP_CHAN_SUBIO,,,,,,, \portNum, 4
.endm
/**
@@ -1941,7 +2117,7 @@ $reladdr\@:
* Load status is made available in SIO[portNum].
*/
.macro ldres portNum, resType, resId
- _wr_cmd_id ldres, 0x60,,,,,,,, \portNum, 4
+ _wr_cmd_id ldres, ASEQ_OP_SEQ_LDRES,,,,,,,, \portNum, 4
_wr_u8 \resType
_wr_u8 \resId
.endm
@@ -1955,9 +2131,9 @@ $reladdr\@:
*/
.macro stio portNum
.if ASEQ_MODE == ASEQ_MODE_CHANNEL
- _wr_cmd_id stio, ,0x70,,,,,,, \portNum, 3
+ _wr_cmd_id stio, ,ASEQ_OP_CHAN_STIO,,,,,,, \portNum, 3
.else
- _wr_cmd_id stio, 0x70,,,,,,,, \portNum, 4
+ _wr_cmd_id stio, ASEQ_OP_SEQ_STIO,,,,,,,, \portNum, 4
.endif
.endm
@@ -1968,7 +2144,7 @@ $reladdr\@:
* depending on current section.
*/
.macro ldio portNum
- _wr_cmd_id ldio, 0x80,0x60,,,,,,, \portNum, 4
+ _wr_cmd_id ldio, ASEQ_OP_SEQ_LDIO,ASEQ_OP_CHAN_LDIO,,,,,,, \portNum, 4
.endm
/**
@@ -1977,7 +2153,7 @@ $reladdr\@:
* Opens the sequence channel for index `channelNum` with data beginning at `label`.
*/
.macro ldchan channelNum, label
- _wr_cmd_id ldchan, 0x90,0x20,,,,,,, \channelNum, 4
+ _wr_cmd_id ldchan, ASEQ_OP_SEQ_LDCHAN,ASEQ_OP_CHAN_LDCHAN,,,,,,, \channelNum, 4
_wr_lbl \label
.endm
@@ -1989,7 +2165,7 @@ $reladdr\@:
* for use in position-independent code.
*/
.macro rldchan channelNum, label
- _wr_cmd_id rldchan, 0xA0,,,,,,,, \channelNum, 4
+ _wr_cmd_id rldchan, ASEQ_OP_SEQ_RLDCHAN,,,,,,,, \channelNum, 4
_wr_16_rel \label
.endm
@@ -1999,7 +2175,7 @@ $reladdr\@:
* Delay for `delay` ticks.
*/
.macro ldelay delay
- _wr_cmd_id ldelay, ,,0xC0,,,,,, 0, 0
+ _wr_cmd_id ldelay, ,,ASEQ_OP_LAYER_LDELAY,,,,,, 0, 0
_var \delay
.endm
@@ -2010,7 +2186,7 @@ $reladdr\@:
* Should never be used when not required for matching purposes.
*/
.macro lldelay delay
- _wr_cmd_id lldelay, ,0xFD,0xC0,,,,,, 0, 0
+ _wr_cmd_id lldelay, ,ASEQ_OP_DELAY,ASEQ_OP_LAYER_LDELAY,,,,,, 0, 0
_var_long \delay
.endm
@@ -2020,7 +2196,7 @@ $reladdr\@:
* Set velocity used by short notes.
*/
.macro shortvel velocity
- _wr_cmd_id shortvel, ,,0xC1,,,,,, 0, 0
+ _wr_cmd_id shortvel, ,,ASEQ_OP_LAYER_SHORTVEL,,,,,, 0, 0
_wr_u8 \velocity
.endm
@@ -2030,7 +2206,7 @@ $reladdr\@:
* Set delay used by short notes.
*/
.macro shortdelay delay
- _wr_cmd_id shortdelay, ,,0xC3,,,,,, 0, 0
+ _wr_cmd_id shortdelay, ,,ASEQ_OP_LAYER_SHORTDELAY,,,,,, 0, 0
_var \delay
.endm
@@ -2040,7 +2216,7 @@ $reladdr\@:
* Enables legato on the current layer.
*/
.macro legato
- _wr_cmd_id legato, ,,0xC4,,,,,, 0, 0
+ _wr_cmd_id legato, ,,ASEQ_OP_LAYER_LEGATO,,,,,, 0, 0
.endm
/**
@@ -2049,7 +2225,7 @@ $reladdr\@:
* Disables legato on the current layer.
*/
.macro nolegato
- _wr_cmd_id nolegato, ,,0xC5,,,,,, 0, 0
+ _wr_cmd_id nolegato, ,,ASEQ_OP_LAYER_NOLEGATO,,,,,, 0, 0
.endm
/**
@@ -2058,7 +2234,7 @@ $reladdr\@:
* The time argument is either a var or a u8 depending on mode
*/
.macro portamento mode, target, time
- _wr_cmd_id portamento, ,,0xC7,,,,,, 0, 0
+ _wr_cmd_id portamento, ,,ASEQ_OP_LAYER_PORTAMENTO,,,,,, 0, 0
_wr_u8 \mode
_wr_u8 \target
.if (\mode & 0x80) != 0
@@ -2074,7 +2250,7 @@ $reladdr\@:
* Disables portamento on the current layer.
*/
.macro noportamento
- _wr_cmd_id noportamento, ,,0xC8,,,,,, 0, 0
+ _wr_cmd_id noportamento, ,,ASEQ_OP_LAYER_NOPORTAMENTO,,,,,, 0, 0
.endm
/**
@@ -2083,7 +2259,7 @@ $reladdr\@:
* Sets gate time for short notes.
*/
.macro shortgate gateTime
- _wr_cmd_id shortgate, ,,0xC9,,,,,, 0, 0
+ _wr_cmd_id shortgate, ,,ASEQ_OP_LAYER_SHORTGATE,,,,,, 0, 0
_wr_u8 \gateTime
.endm
@@ -2095,7 +2271,7 @@ $reladdr\@:
.macro notepan pan
/* pan can only take values in 0..127 */
_check_arg_bitwidth_u \pan, 7
- _wr_cmd_id notepan, ,,0xCA,,,,,, 0, 0
+ _wr_cmd_id notepan, ,,ASEQ_OP_LAYER_NOTEPAN,,,,,, 0, 0
_wr_u8 \pan
.endm
@@ -2106,7 +2282,7 @@ $reladdr\@:
* use pan set in the layer.
*/
.macro nodrumpan
- _wr_cmd_id nodrumpan, ,,0xCC,,,,,, 0, 0
+ _wr_cmd_id nodrumpan, ,,ASEQ_OP_LAYER_NODRUMPAN,,,,,, 0, 0
.endm
/**
@@ -2114,7 +2290,6 @@ $reladdr\@:
*
* TODO DESCRIPTION
*/
-#define STEREO_OPCODE 0xCD
.macro stereo type, strongR, strongL, strongRvrbR, strongRvrbL
_check_arg_bitwidth_u \type, 2
_check_arg_bitwidth_u \strongR, 1
@@ -2122,7 +2297,7 @@ $reladdr\@:
_check_arg_bitwidth_u \strongRvrbR, 1
_check_arg_bitwidth_u \strongRvrbL, 1
- _wr_cmd_id stereo, ,,STEREO_OPCODE,,,,,, 0, 0
+ _wr_cmd_id stereo, ,,ASEQ_OP_LAYER_STEREO,,,,,, 0, 0
_wr_u8 (\type << 4) | (\strongR << 3) | (\strongL << 2) | (\strongRvrbR << 1) | (\strongRvrbL << 0)
.endm
@@ -2132,7 +2307,7 @@ $reladdr\@:
* Sets the velocity used in short notes by reading from SHORTVELTBL[velocity]
*/
.macro ldshortvel velocity
- _wr_cmd_id ldshortvel, ,,0xD0,,,,,, \velocity, 4
+ _wr_cmd_id ldshortvel, ,,ASEQ_OP_LAYER_LDSHORTVEL,,,,,, \velocity, 4
.endm
/**
@@ -2141,7 +2316,7 @@ $reladdr\@:
* Sets the gate time used in short notes by reading from SHORTGATETBL[gateTime]
*/
.macro ldshortgate gateTime
- _wr_cmd_id ldshortgate, ,,0xE0,,,,,, \gateTime, 4
+ _wr_cmd_id ldshortgate, ,,ASEQ_OP_LAYER_LDSHORTGATE,,,,,, \gateTime, 4
.endm
#if (MML_VERSION == MML_VERSION_MM)
@@ -2152,7 +2327,7 @@ $reladdr\@:
* TODO DESCRIPTION
*/
.macro unk_F0 arg
- _wr_cmd_id unk_F0, ,,0xF0,,,,,, 0, 0
+ _wr_cmd_id unk_F0, ,,ASEQ_OP_LAYER_F0,,,,,, 0, 0
_wr_s16 \arg
.endm
@@ -2161,9 +2336,8 @@ $reladdr\@:
*
* TODO DESCRIPTION
*/
- #define SURROUNDEFFECT_OPCODE 0xF1
.macro surroundeffect arg
- _wr_cmd_id surroundeffect, ,,SURROUNDEFFECT_OPCODE,,,,,, 0, 0
+ _wr_cmd_id surroundeffect, ,,ASEQ_OP_LAYER_F1,,,,,, 0, 0
_wr_u8 \arg
.endm
@@ -2182,9 +2356,8 @@ $reladdr\@:
*
* This instruction must only be used when long notes are enabled with the noshort instruction.
*/
-#define NOTEDVG_OPCODE 0x00
.macro notedvg pitch, delay, velocity, gateTime
- _wr_cmd_id notedvg, ,,0x00,,,,,, \pitch, 6
+ _wr_cmd_id notedvg, ,,ASEQ_OP_LAYER_NOTEDVG,,,,,, \pitch, 6
_var \delay
_wr_u8 \velocity
_wr_u8 \gateTime
@@ -2197,16 +2370,15 @@ $reladdr\@:
*
* This instruction must only be used when long notes are enabled with the noshort instruction.
*/
-#define NOTEDV_OPCODE 0x40
.macro notedv pitch, delay, velocity
- _wr_cmd_id notedv, ,,NOTEDV_OPCODE,,,,,, \pitch, 6
+ _wr_cmd_id notedv, ,,ASEQ_OP_LAYER_NOTEDV,,,,,, \pitch, 6
_var \delay
_wr_u8 \velocity
.endm
/* Workaround for bugs in vanilla sequences, force long encoding for delay. This should not typically be used. */
.macro noteldv pitch, delay, velocity
- _wr_cmd_id noteldv, ,,0x40,,,,,, \pitch, 6
+ _wr_cmd_id noteldv, ,,ASEQ_OP_LAYER_NOTEDV,,,,,, \pitch, 6
_var_long \delay
_wr_u8 \velocity
.endm
@@ -2219,7 +2391,7 @@ $reladdr\@:
* This instruction must only be used when long notes are enabled with the noshort instruction.
*/
.macro notevg pitch, velocity, gateTime
- _wr_cmd_id notevg, ,,0x80,,,,,, \pitch, 6
+ _wr_cmd_id notevg, ,,ASEQ_OP_LAYER_NOTEVG,,,,,, \pitch, 6
_wr_u8 \velocity
_wr_u8 \gateTime
.endm
@@ -2233,7 +2405,7 @@ $reladdr\@:
* This instruction must only be used when short notes are enabled with the short instruction.
*/
.macro shortdvg pitch, delay
- _wr_cmd_id shortdvg, ,,0x00,,,,,, \pitch, 6
+ _wr_cmd_id shortdvg, ,,ASEQ_OP_LAYER_NOTEDVG,,,,,, \pitch, 6
_var \delay
.endm
@@ -2246,7 +2418,7 @@ $reladdr\@:
* This instruction must only be used when short notes are enabled with the short instruction.
*/
.macro shortdv pitch
- _wr_cmd_id shortdv, ,,0x40,,,,,, \pitch, 6
+ _wr_cmd_id shortdv, ,,ASEQ_OP_LAYER_NOTEDV,,,,,, \pitch, 6
.endm
/**
@@ -2258,7 +2430,7 @@ $reladdr\@:
* This instruction must only be used when short notes are enabled with the short instruction.
*/
.macro shortvg pitch
- _wr_cmd_id shortvg, ,,0x80,,,,,, \pitch, 6
+ _wr_cmd_id shortvg, ,,ASEQ_OP_LAYER_NOTEVG,,,,,, \pitch, 6
.endm
/**
diff --git a/src/audio/lib/seqplayer.c b/src/audio/lib/seqplayer.c
index a7091b24b..2caaf17e0 100644
--- a/src/audio/lib/seqplayer.c
+++ b/src/audio/lib/seqplayer.c
@@ -14,8 +14,12 @@
* Otherwise, each set of instructions has its own command interpreter
*/
#include "ultra64.h"
+#include "assert.h"
+#include "audio/aseq.h"
#include "global.h"
+static_assert(MML_VERSION == MML_VERSION_OOT, "This file implements the OoT version of the MML");
+
#define PORTAMENTO_IS_SPECIAL(x) ((x).mode & 0x80)
#define PORTAMENTO_MODE(x) ((x).mode & ~0x80)
@@ -70,92 +74,92 @@ u8 AudioSeq_GetInstrument(SequenceChannel* channel, u8 instId, Instrument** inst
(((sizeof(arg0Type) - 1) << 7) | ((sizeof(arg1Type) - 1) << 6) | ((sizeof(arg2Type) - 1) << 5) | 3)
u8 sSeqInstructionArgsTable[] = {
- CMD_ARGS_1(s16), // 0xB0
- CMD_ARGS_0(), // 0xB1
- CMD_ARGS_1(s16), // 0xB2
- CMD_ARGS_1(u8), // 0xB3
- CMD_ARGS_0(), // 0xB4
- CMD_ARGS_0(), // 0xB5
- CMD_ARGS_0(), // 0xB6
- CMD_ARGS_1(s16), // 0xB7
- CMD_ARGS_1(u8), // 0xB8
- CMD_ARGS_1(u8), // 0xB9
- CMD_ARGS_1(u8), // 0xBA
- CMD_ARGS_2(u8, s16), // 0xBB
- CMD_ARGS_1(s16), // 0xBC
- CMD_ARGS_2(s16, s16), // 0xBD
+ CMD_ARGS_1(s16), // ASEQ_OP_CHAN_LDFILTER
+ CMD_ARGS_0(), // ASEQ_OP_CHAN_FREEFILTER
+ CMD_ARGS_1(s16), // ASEQ_OP_CHAN_LDSEQTOPTR
+ CMD_ARGS_1(u8), // ASEQ_OP_CHAN_FILTER
+ CMD_ARGS_0(), // ASEQ_OP_CHAN_PTRTODYNTBL
+ CMD_ARGS_0(), // ASEQ_OP_CHAN_DYNTBLTOPTR
+ CMD_ARGS_0(), // ASEQ_OP_CHAN_DYNTBLV
+ CMD_ARGS_1(s16), // ASEQ_OP_CHAN_RANDTOPTR
+ CMD_ARGS_1(u8), // ASEQ_OP_CHAN_RAND
+ CMD_ARGS_1(u8), // ASEQ_OP_CHAN_RANDVEL
+ CMD_ARGS_1(u8), // ASEQ_OP_CHAN_RANDGATE
+ CMD_ARGS_2(u8, s16), // ASEQ_OP_CHAN_COMBFILTER
+ CMD_ARGS_1(s16), // ASEQ_OP_CHAN_PTRADD
+ CMD_ARGS_2(s16, s16), // ASEQ_OP_CHAN_RANDPTR
CMD_ARGS_0(), // 0xBE
CMD_ARGS_0(), // 0xBF
CMD_ARGS_0(), // 0xC0
- CMD_ARGS_1(u8), // 0xC1
- CMD_ARGS_1(s16), // 0xC2
- CMD_ARGS_0(), // 0xC3
- CMD_ARGS_0(), // 0xC4
- CMD_ARGS_0(), // 0xC5
- CMD_ARGS_1(u8), // 0xC6
- CMD_ARGS_2(u8, s16), // 0xC7
- CMD_ARGS_1(u8), // 0xC8
- CMD_ARGS_1(u8), // 0xC9
- CMD_ARGS_1(u8), // 0xCA
- CMD_ARGS_1(s16), // 0xCB
- CMD_ARGS_1(u8), // 0xCC
- CMD_ARGS_1(u8), // 0xCD
- CMD_ARGS_1(s16), // 0xCE
- CMD_ARGS_1(s16), // 0xCF
- CMD_ARGS_1(u8), // 0xD0
- CMD_ARGS_1(u8), // 0xD1
- CMD_ARGS_1(u8), // 0xD2
- CMD_ARGS_1(u8), // 0xD3
- CMD_ARGS_1(u8), // 0xD4
+ CMD_ARGS_1(u8), // ASEQ_OP_CHAN_INSTR
+ CMD_ARGS_1(s16), // ASEQ_OP_CHAN_DYNTBL
+ CMD_ARGS_0(), // ASEQ_OP_CHAN_SHORT
+ CMD_ARGS_0(), // ASEQ_OP_CHAN_NOSHORT
+ CMD_ARGS_0(), // ASEQ_OP_CHAN_DYNTBLLOOKUP
+ CMD_ARGS_1(u8), // ASEQ_OP_CHAN_FONT
+ CMD_ARGS_2(u8, s16), // ASEQ_OP_CHAN_STSEQ
+ CMD_ARGS_1(u8), // ASEQ_OP_CHAN_SUB
+ CMD_ARGS_1(u8), // ASEQ_OP_CHAN_AND
+ CMD_ARGS_1(u8), // ASEQ_OP_CHAN_MUTEBHV
+ CMD_ARGS_1(s16), // ASEQ_OP_CHAN_LDSEQ
+ CMD_ARGS_1(u8), // ASEQ_OP_CHAN_LDI
+ CMD_ARGS_1(u8), // ASEQ_OP_CHAN_STOPCHAN
+ CMD_ARGS_1(s16), // ASEQ_OP_CHAN_LDPTR
+ CMD_ARGS_1(s16), // ASEQ_OP_CHAN_STPTRTOSEQ
+ CMD_ARGS_1(u8), // ASEQ_OP_CHAN_EFFECTS
+ CMD_ARGS_1(u8), // ASEQ_OP_CHAN_NOTEALLOC
+ CMD_ARGS_1(u8), // ASEQ_OP_CHAN_SUSTAIN
+ CMD_ARGS_1(u8), // ASEQ_OP_CHAN_BEND
+ CMD_ARGS_1(u8), // ASEQ_OP_CHAN_REVERB
CMD_ARGS_1(u8), // 0xD5
CMD_ARGS_1(u8), // 0xD6
- CMD_ARGS_1(u8), // 0xD7
- CMD_ARGS_1(u8), // 0xD8
- CMD_ARGS_1(u8), // 0xD9
- CMD_ARGS_1(s16), // 0xDA
- CMD_ARGS_1(u8), // 0xDB
- CMD_ARGS_1(u8), // 0xDC
- CMD_ARGS_1(u8), // 0xDD
- CMD_ARGS_1(s16), // 0xDE
- CMD_ARGS_1(u8), // 0xDF
- CMD_ARGS_1(u8), // 0xE0
- CMD_ARGS_3(u8, u8, u8), // 0xE1
- CMD_ARGS_3(u8, u8, u8), // 0xE2
- CMD_ARGS_1(u8), // 0xE3
- CMD_ARGS_0(), // 0xE4
- CMD_ARGS_1(u8), // 0xE5
- CMD_ARGS_1(u8), // 0xE6
- CMD_ARGS_1(s16), // 0xE7
- CMD_ARGS_3(u8, u8, u8), // 0xE8
- CMD_ARGS_1(u8), // 0xE9
- CMD_ARGS_0(), // 0xEA
- CMD_ARGS_2(u8, u8), // 0xEB
- CMD_ARGS_0(), // 0xEC
- CMD_ARGS_1(u8), // 0xED
- CMD_ARGS_1(u8), // 0xEE
+ CMD_ARGS_1(u8), // ASEQ_OP_CHAN_VIBFREQ
+ CMD_ARGS_1(u8), // ASEQ_OP_CHAN_VIBDEPTH
+ CMD_ARGS_1(u8), // ASEQ_OP_CHAN_RELEASERATE
+ CMD_ARGS_1(s16), // ASEQ_OP_CHAN_ENV
+ CMD_ARGS_1(u8), // ASEQ_OP_CHAN_TRANSPOSE
+ CMD_ARGS_1(u8), // ASEQ_OP_CHAN_PANWEIGHT
+ CMD_ARGS_1(u8), // ASEQ_OP_CHAN_PAN
+ CMD_ARGS_1(s16), // ASEQ_OP_CHAN_FREQSCALE
+ CMD_ARGS_1(u8), // ASEQ_OP_CHAN_VOL
+ CMD_ARGS_1(u8), // ASEQ_OP_CHAN_VOLEXP
+ CMD_ARGS_3(u8, u8, u8), // ASEQ_OP_CHAN_VIBFREQGRAD
+ CMD_ARGS_3(u8, u8, u8), // ASEQ_OP_CHAN_VIBDEPTHGRAD
+ CMD_ARGS_1(u8), // ASEQ_OP_CHAN_VIBDELAY
+ CMD_ARGS_0(), // ASEQ_OP_CHAN_DYNCALL
+ CMD_ARGS_1(u8), // ASEQ_OP_CHAN_REVERBIDX
+ CMD_ARGS_1(u8), // ASEQ_OP_CHAN_SAMPLEBOOK
+ CMD_ARGS_1(s16), // ASEQ_OP_CHAN_LDPARAMS
+ CMD_ARGS_3(u8, u8, u8), // ASEQ_OP_CHAN_PARAMS
+ CMD_ARGS_1(u8), // ASEQ_OP_CHAN_NOTEPRI
+ CMD_ARGS_0(), // ASEQ_OP_CHAN_STOP
+ CMD_ARGS_2(u8, u8), // ASEQ_OP_CHAN_FONTINSTR
+ CMD_ARGS_0(), // ASEQ_OP_CHAN_VIBRESET
+ CMD_ARGS_1(u8), // ASEQ_OP_CHAN_GAIN
+ CMD_ARGS_1(u8), // ASEQ_OP_CHAN_BENDFINE
CMD_ARGS_2(s16, u8), // 0xEF
- CMD_ARGS_0(), // 0xF0
- CMD_ARGS_1(u8), // 0xF1
- // Control flow instructions (>= 0xF2) can only have 0 or 1 args
- CMD_ARGS_1(u8), // 0xF2
- CMD_ARGS_1(u8), // 0xF3
- CMD_ARGS_1(u8), // 0xF4
- CMD_ARGS_1(s16), // 0xF5
- CMD_ARGS_0(), // 0xF6
- CMD_ARGS_0(), // 0xF7
- CMD_ARGS_1(u8), // 0xF8
- CMD_ARGS_1(s16), // 0xF9
- CMD_ARGS_1(s16), // 0xFA
- CMD_ARGS_1(s16), // 0xFB
- CMD_ARGS_1(s16), // 0xFC
- CMD_ARGS_0(), // 0xFD
- CMD_ARGS_0(), // 0xFE
- CMD_ARGS_0(), // 0xFF
+ CMD_ARGS_0(), // ASEQ_OP_CHAN_FREENOTELIST
+ CMD_ARGS_1(u8), // ASEQ_OP_CHAN_ALLOCNOTELIST
+ // Control flow instructions (>= ASEQ_OP_CONTROL_FLOW_FIRST) can only have 0 or 1 args
+ CMD_ARGS_1(u8), // ASEQ_OP_RBLTZ
+ CMD_ARGS_1(u8), // ASEQ_OP_RBEQZ
+ CMD_ARGS_1(u8), // ASEQ_OP_RJUMP
+ CMD_ARGS_1(s16), // ASEQ_OP_BGEZ
+ CMD_ARGS_0(), // ASEQ_OP_BREAK
+ CMD_ARGS_0(), // ASEQ_OP_LOOPEND
+ CMD_ARGS_1(u8), // ASEQ_OP_LOOP
+ CMD_ARGS_1(s16), // ASEQ_OP_BLTZ
+ CMD_ARGS_1(s16), // ASEQ_OP_BEQZ
+ CMD_ARGS_1(s16), // ASEQ_OP_JUMP
+ CMD_ARGS_1(s16), // ASEQ_OP_CALL
+ CMD_ARGS_0(), // ASEQ_OP_DELAY
+ CMD_ARGS_0(), // ASEQ_OP_DELAY1
+ CMD_ARGS_0(), // ASEQ_OP_END
};
/**
* Read and return the argument from the sequence script for a control flow instruction.
- * Control flow instructions (>= 0xF2) can only have 0 or 1 args.
+ * Control flow instructions (>= ASEQ_OP_CONTROL_FLOW_FIRST) can only have 0 or 1 args.
* @return the argument value for a control flow instruction, or 0 if there is no argument
*/
u16 AudioSeq_GetScriptControlFlowArgument(SeqScriptState* state, u8 cmd) {
@@ -181,30 +185,30 @@ u16 AudioSeq_GetScriptControlFlowArgument(SeqScriptState* state, u8 cmd) {
*/
s32 AudioSeq_HandleScriptFlowControl(SequencePlayer* seqPlayer, SeqScriptState* state, s32 cmd, s32 cmdArg) {
switch (cmd) {
- case 0xFF:
+ case ASEQ_OP_END:
if (state->depth == 0) {
return PROCESS_SCRIPT_END;
}
state->pc = state->stack[--state->depth];
break;
- case 0xFD:
+ case ASEQ_OP_DELAY:
return AudioSeq_ScriptReadCompressedU16(state);
- case 0xFE:
+ case ASEQ_OP_DELAY1:
return 1;
- case 0xFC:
+ case ASEQ_OP_CALL:
state->stack[state->depth++] = state->pc;
state->pc = seqPlayer->seqData + (u16)cmdArg;
break;
- case 0xF8:
+ case ASEQ_OP_LOOP:
state->remLoopIters[state->depth] = cmdArg;
state->stack[state->depth++] = state->pc;
break;
- case 0xF7:
+ case ASEQ_OP_LOOPEND:
state->remLoopIters[state->depth - 1]--;
if (state->remLoopIters[state->depth - 1] != 0) {
state->pc = state->stack[state->depth - 1];
@@ -213,33 +217,33 @@ s32 AudioSeq_HandleScriptFlowControl(SequencePlayer* seqPlayer, SeqScriptState*
}
break;
- case 0xF6:
+ case ASEQ_OP_BREAK:
state->depth--;
break;
- case 0xF5:
- case 0xF9:
- case 0xFA:
- case 0xFB:
- if (cmd == 0xFA && state->value != 0) {
+ case ASEQ_OP_BGEZ:
+ case ASEQ_OP_BLTZ:
+ case ASEQ_OP_BEQZ:
+ case ASEQ_OP_JUMP:
+ if (cmd == ASEQ_OP_BEQZ && state->value != 0) {
break;
}
- if (cmd == 0xF9 && state->value >= 0) {
+ if (cmd == ASEQ_OP_BLTZ && state->value >= 0) {
break;
}
- if (cmd == 0xF5 && state->value < 0) {
+ if (cmd == ASEQ_OP_BGEZ && state->value < 0) {
break;
}
state->pc = seqPlayer->seqData + (u16)cmdArg;
break;
- case 0xF2:
- case 0xF3:
- case 0xF4:
- if (cmd == 0xF3 && state->value != 0) {
+ case ASEQ_OP_RBLTZ:
+ case ASEQ_OP_RBEQZ:
+ case ASEQ_OP_RJUMP:
+ if (cmd == ASEQ_OP_RBEQZ && state->value != 0) {
break;
}
- if (cmd == 0xF2 && state->value >= 0) {
+ if (cmd == ASEQ_OP_RBLTZ && state->value >= 0) {
break;
}
state->pc += (s8)(cmdArg & 0xFF);
@@ -645,7 +649,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) {
}
// Control Flow Commands
- if (cmd >= 0xF2) {
+ if (cmd >= ASEQ_OP_CONTROL_FLOW_FIRST) {
cmdArg16 = AudioSeq_GetScriptControlFlowArgument(state, cmd);
if (AudioSeq_HandleScriptFlowControl(seqPlayer, state, cmd, cmdArg16) == 0) {
@@ -656,29 +660,29 @@ s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) {
}
switch (cmd) {
- case 0xC1: // layer_setshortnotevelocity
- case 0xCA: // layer_setpan
+ case ASEQ_OP_LAYER_SHORTVEL: // layer_setshortnotevelocity
+ case ASEQ_OP_LAYER_NOTEPAN: // layer_setpan
cmdArg8 = *(state->pc++);
- if (cmd == 0xC1) {
+ if (cmd == ASEQ_OP_LAYER_SHORTVEL) {
layer->velocitySquare = SQ(cmdArg8) / SQ(127.0f);
} else {
layer->pan = cmdArg8;
}
break;
- case 0xC9: // layer_setshortnotegatetime
- case 0xC2: // layer_transpose; set transposition in semitones
+ case ASEQ_OP_LAYER_SHORTGATE: // layer_setshortnotegatetime
+ case ASEQ_OP_LAYER_TRANSPOSE: // layer_transpose; set transposition in semitones
cmdArg8 = *(state->pc++);
- if (cmd == 0xC9) {
+ if (cmd == ASEQ_OP_LAYER_SHORTGATE) {
layer->gateTime = cmdArg8;
} else {
layer->transposition = cmdArg8;
}
break;
- case 0xC4: // layer_continuousnoteson
- case 0xC5: // layer_continuousnotesoff
- if (cmd == 0xC4) {
+ case ASEQ_OP_LAYER_LEGATO: // layer_continuousnoteson
+ case ASEQ_OP_LAYER_NOLEGATO: // layer_continuousnotesoff
+ if (cmd == ASEQ_OP_LAYER_LEGATO) {
layer->continuousNotes = true;
} else {
layer->continuousNotes = false;
@@ -687,12 +691,12 @@ s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) {
Audio_SeqLayerNoteDecay(layer);
break;
- case 0xC3: // layer_setshortnotedefaultdelay
+ case ASEQ_OP_LAYER_SHORTDELAY: // layer_setshortnotedefaultdelay
cmdArg16 = AudioSeq_ScriptReadCompressedU16(state);
layer->shortNoteDefaultDelay = cmdArg16;
break;
- case 0xC6: // layer_setinstr
+ case ASEQ_OP_LAYER_INSTR: // layer_setinstr
cmd = AudioSeq_ScriptReadU8(state);
if (cmd >= 0x7E) {
if (cmd == 0x7E) {
@@ -719,7 +723,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) {
}
break;
- case 0xC7: // layer_portamento
+ case ASEQ_OP_LAYER_PORTAMENTO: // layer_portamento
layer->portamento.mode = AudioSeq_ScriptReadU8(state);
cmd = AudioSeq_ScriptReadU8(state);
@@ -743,39 +747,39 @@ s32 AudioSeq_SeqLayerProcessScriptStep2(SequenceLayer* layer) {
layer->portamentoTime = cmdArg16;
break;
- case 0xC8: // layer_disableportamento
+ case ASEQ_OP_LAYER_NOPORTAMENTO: // layer_disableportamento
layer->portamento.mode = PORTAMENTO_MODE_OFF;
break;
- case 0xCB:
+ case ASEQ_OP_LAYER_ENV:
cmdArg16 = AudioSeq_ScriptReadS16(state);
layer->adsr.envelope = (EnvelopePoint*)(seqPlayer->seqData + cmdArg16);
FALLTHROUGH;
- case 0xCF:
+ case ASEQ_OP_LAYER_RELEASERATE:
layer->adsr.decayIndex = AudioSeq_ScriptReadU8(state);
break;
- case 0xCC:
+ case ASEQ_OP_LAYER_NODRUMPAN:
layer->ignoreDrumPan = true;
break;
- case 0xCD:
+ case ASEQ_OP_LAYER_STEREO:
layer->stereo.asByte = AudioSeq_ScriptReadU8(state);
break;
- case 0xCE:
+ case ASEQ_OP_LAYER_BENDFINE:
cmdArg8 = AudioSeq_ScriptReadU8(state);
layer->bend = gBendPitchTwoSemitonesFrequencies[(u8)(cmdArg8 + 0x80)];
break;
default:
switch (cmd & 0xF0) {
- case 0xD0: // layer_setshortnotevelocityfromtable
+ case ASEQ_OP_LAYER_LDSHORTVEL: // layer_setshortnotevelocityfromtable
velocity = seqPlayer->shortNoteVelocityTable[cmd & 0xF];
layer->velocitySquare = SQ(velocity) / SQ(127.0f);
break;
- case 0xE0: // layer_setshortnotegatetimefromtable
+ case ASEQ_OP_LAYER_LDSHORTGATE: // layer_setshortnotegatetimefromtable
layer->gateTime = seqPlayer->shortNoteGateTimeTable[cmd & 0xF];
break;
}
@@ -1000,7 +1004,7 @@ s32 AudioSeq_SeqLayerProcessScriptStep3(SequenceLayer* layer, s32 cmd) {
s32 intDelta;
f32 floatDelta;
- if (cmd == 0xC0) {
+ if (cmd == ASEQ_OP_LAYER_LDELAY) {
layer->delay = AudioSeq_ScriptReadCompressedU16(state);
layer->muted = true;
layer->bit1 = false;
@@ -1011,21 +1015,21 @@ s32 AudioSeq_SeqLayerProcessScriptStep3(SequenceLayer* layer, s32 cmd) {
if (channel->largeNotes == true) {
switch (cmd & 0xC0) {
- case 0x00:
+ case ASEQ_OP_LAYER_NOTEDVG:
delay = AudioSeq_ScriptReadCompressedU16(state);
velocity = *(state->pc++);
layer->gateTime = *(state->pc++);
layer->lastDelay = delay;
break;
- case 0x40:
+ case ASEQ_OP_LAYER_NOTEDV:
delay = AudioSeq_ScriptReadCompressedU16(state);
velocity = *(state->pc++);
layer->gateTime = 0;
layer->lastDelay = delay;
break;
- case 0x80:
+ case ASEQ_OP_LAYER_NOTEVG:
delay = layer->lastDelay;
velocity = *(state->pc++);
layer->gateTime = *(state->pc++);
@@ -1039,16 +1043,16 @@ s32 AudioSeq_SeqLayerProcessScriptStep3(SequenceLayer* layer, s32 cmd) {
cmd -= (cmd & 0xC0);
} else {
switch (cmd & 0xC0) {
- case 0x00:
+ case ASEQ_OP_LAYER_NOTEDVG:
delay = AudioSeq_ScriptReadCompressedU16(state);
layer->lastDelay = delay;
break;
- case 0x40:
+ case ASEQ_OP_LAYER_NOTEDV:
delay = layer->shortNoteDefaultDelay;
break;
- case 0x80:
+ case ASEQ_OP_LAYER_NOTEVG:
delay = layer->lastDelay;
break;
}
@@ -1210,7 +1214,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
}
// Control Flow Commands
- if (cmd >= 0xF2) {
+ if (cmd >= ASEQ_OP_CONTROL_FLOW_FIRST) {
delay = AudioSeq_HandleScriptFlowControl(seqPlayer, scriptState, cmd, cmdArgs[0]);
if (delay != 0) {
@@ -1225,26 +1229,26 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
}
switch (cmd) {
- case 0xEA:
+ case ASEQ_OP_CHAN_STOP:
channel->stopScript = true;
goto exit_loop;
- case 0xF1:
+ case ASEQ_OP_CHAN_ALLOCNOTELIST:
Audio_NotePoolClear(&channel->notePool);
cmd = (u8)cmdArgs[0];
Audio_NotePoolFill(&channel->notePool, cmd);
break;
- case 0xF0:
+ case ASEQ_OP_CHAN_FREENOTELIST:
Audio_NotePoolClear(&channel->notePool);
break;
- case 0xC2:
+ case ASEQ_OP_CHAN_DYNTBL:
cmdArgU16 = (u16)cmdArgs[0];
channel->dynTable = (void*)&seqPlayer->seqData[cmdArgU16];
break;
- case 0xC5:
+ case ASEQ_OP_CHAN_DYNTBLLOOKUP:
if (scriptState->value != -1) {
data = (*channel->dynTable)[scriptState->value];
cmdArgU16 = (u16)((data[0] << 8) + data[1]);
@@ -1253,7 +1257,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
}
break;
- case 0xEB:
+ case ASEQ_OP_CHAN_FONTINSTR:
cmd = (u8)cmdArgs[0];
if (seqPlayer->defaultFont != 0xFF) {
@@ -1268,93 +1272,93 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
cmdArgs[0] = cmdArgs[1];
FALLTHROUGH;
- case 0xC1:
+ case ASEQ_OP_CHAN_INSTR:
cmd = (u8)cmdArgs[0];
AudioSeq_SetInstrument(channel, cmd);
break;
- case 0xC3:
+ case ASEQ_OP_CHAN_SHORT:
channel->largeNotes = false;
break;
- case 0xC4:
+ case ASEQ_OP_CHAN_NOSHORT:
channel->largeNotes = true;
break;
- case 0xDF:
+ case ASEQ_OP_CHAN_VOL:
cmd = (u8)cmdArgs[0];
AudioSeq_SequenceChannelSetVolume(channel, cmd);
channel->changes.s.volume = true;
break;
- case 0xE0:
+ case ASEQ_OP_CHAN_VOLEXP:
cmd = (u8)cmdArgs[0];
channel->volumeScale = (s32)cmd / 128.0f;
channel->changes.s.volume = true;
break;
- case 0xDE:
+ case ASEQ_OP_CHAN_FREQSCALE:
cmdArgU16 = (u16)cmdArgs[0];
channel->freqScale = (s32)cmdArgU16 / 32768.0f;
channel->changes.s.freqScale = true;
break;
- case 0xD3:
+ case ASEQ_OP_CHAN_BEND:
cmd = (u8)cmdArgs[0];
cmd += 0x80;
channel->freqScale = gBendPitchOneOctaveFrequencies[cmd];
channel->changes.s.freqScale = true;
break;
- case 0xEE:
+ case ASEQ_OP_CHAN_BENDFINE:
cmd = (u8)cmdArgs[0];
cmd += 0x80;
channel->freqScale = gBendPitchTwoSemitonesFrequencies[cmd];
channel->changes.s.freqScale = true;
break;
- case 0xDD:
+ case ASEQ_OP_CHAN_PAN:
cmd = (u8)cmdArgs[0];
channel->newPan = cmd;
channel->changes.s.pan = true;
break;
- case 0xDC:
+ case ASEQ_OP_CHAN_PANWEIGHT:
cmd = (u8)cmdArgs[0];
channel->panChannelWeight = cmd;
channel->changes.s.pan = true;
break;
- case 0xDB:
+ case ASEQ_OP_CHAN_TRANSPOSE:
cmdArgS8 = (s8)cmdArgs[0];
channel->transposition = cmdArgS8;
break;
- case 0xDA:
+ case ASEQ_OP_CHAN_ENV:
cmdArgU16 = (u16)cmdArgs[0];
channel->adsr.envelope = (EnvelopePoint*)&seqPlayer->seqData[cmdArgU16];
break;
- case 0xD9:
+ case ASEQ_OP_CHAN_RELEASERATE:
cmd = (u8)cmdArgs[0];
channel->adsr.decayIndex = cmd;
break;
- case 0xD8:
+ case ASEQ_OP_CHAN_VIBDEPTH:
cmd = (u8)cmdArgs[0];
channel->vibratoDepthTarget = cmd * 8;
channel->vibratoDepthStart = 0;
channel->vibratoDepthChangeDelay = 0;
break;
- case 0xD7:
+ case ASEQ_OP_CHAN_VIBFREQ:
cmd = (u8)cmdArgs[0];
channel->vibratoRateChangeDelay = 0;
channel->vibratoRateTarget = cmd * 32;
channel->vibratoRateStart = cmd * 32;
break;
- case 0xE2:
+ case ASEQ_OP_CHAN_VIBDEPTHGRAD:
cmd = (u8)cmdArgs[0];
channel->vibratoDepthStart = cmd * 8;
cmd = (u8)cmdArgs[1];
@@ -1363,7 +1367,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
channel->vibratoDepthChangeDelay = cmd * 16;
break;
- case 0xE1:
+ case ASEQ_OP_CHAN_VIBFREQGRAD:
cmd = (u8)cmdArgs[0];
channel->vibratoRateStart = cmd * 32;
cmd = (u8)cmdArgs[1];
@@ -1372,17 +1376,17 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
channel->vibratoRateChangeDelay = cmd * 16;
break;
- case 0xE3:
+ case ASEQ_OP_CHAN_VIBDELAY:
cmd = (u8)cmdArgs[0];
channel->vibratoDelay = cmd * 16;
break;
- case 0xD4:
+ case ASEQ_OP_CHAN_REVERB:
cmd = (u8)cmdArgs[0];
channel->targetReverbVol = cmd;
break;
- case 0xC6:
+ case ASEQ_OP_CHAN_FONT:
cmd = (u8)cmdArgs[0];
if (seqPlayer->defaultFont != 0xFF) {
@@ -1396,56 +1400,56 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
}
break;
- case 0xC7:
+ case ASEQ_OP_CHAN_STSEQ:
cmd = (u8)cmdArgs[0];
cmdArgU16 = (u16)cmdArgs[1];
seqData = &seqPlayer->seqData[cmdArgU16];
seqData[0] = (u8)scriptState->value + cmd;
break;
- case 0xC8:
- case 0xCC:
- case 0xC9:
+ case ASEQ_OP_CHAN_SUB:
+ case ASEQ_OP_CHAN_LDI:
+ case ASEQ_OP_CHAN_AND:
cmdArgS8 = (s8)cmdArgs[0];
- if (cmd == 0xC8) {
+ if (cmd == ASEQ_OP_CHAN_SUB) {
scriptState->value -= cmdArgS8;
- } else if (cmd == 0xCC) {
+ } else if (cmd == ASEQ_OP_CHAN_LDI) {
scriptState->value = cmdArgS8;
} else {
scriptState->value &= cmdArgS8;
}
break;
- case 0xCD:
+ case ASEQ_OP_CHAN_STOPCHAN:
cmd = (u8)cmdArgs[0];
AudioSeq_SequenceChannelDisable(seqPlayer->channels[cmd]);
break;
- case 0xCA:
+ case ASEQ_OP_CHAN_MUTEBHV:
cmd = (u8)cmdArgs[0];
channel->muteBehavior = cmd;
channel->changes.s.volume = true;
break;
- case 0xCB:
+ case ASEQ_OP_CHAN_LDSEQ:
cmdArgU16 = (u16)cmdArgs[0];
scriptState->value = *(seqPlayer->seqData + (u32)(cmdArgU16 + scriptState->value));
break;
- case 0xCE:
+ case ASEQ_OP_CHAN_LDPTR:
cmdArgU16 = (u16)cmdArgs[0];
channel->unk_22 = cmdArgU16;
break;
- case 0xCF:
+ case ASEQ_OP_CHAN_STPTRTOSEQ:
cmdArgU16 = (u16)cmdArgs[0];
seqData = &seqPlayer->seqData[cmdArgU16];
seqData[0] = (channel->unk_22 >> 8) & 0xFF;
seqData[1] = channel->unk_22 & 0xFF;
break;
- case 0xD0:
+ case ASEQ_OP_CHAN_EFFECTS:
cmd = (u8)cmdArgs[0];
if (cmd & 0x80) {
channel->stereoHeadsetEffects = true;
@@ -1455,22 +1459,22 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
channel->stereo.asByte = cmd & 0x7F;
break;
- case 0xD1:
+ case ASEQ_OP_CHAN_NOTEALLOC:
cmd = (u8)cmdArgs[0];
channel->noteAllocPolicy = cmd;
break;
- case 0xD2:
+ case ASEQ_OP_CHAN_SUSTAIN:
cmd = (u8)cmdArgs[0];
channel->adsr.sustain = cmd;
break;
- case 0xE5:
+ case ASEQ_OP_CHAN_REVERBIDX:
cmd = (u8)cmdArgs[0];
channel->reverbIndex = cmd;
break;
- case 0xE4:
+ case ASEQ_OP_CHAN_DYNCALL:
if (scriptState->value != -1) {
data = (*channel->dynTable)[scriptState->value];
//! @bug: Missing a stack depth check here
@@ -1480,12 +1484,12 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
}
break;
- case 0xE6:
+ case ASEQ_OP_CHAN_SAMPLEBOOK:
cmd = (u8)cmdArgs[0];
channel->bookOffset = cmd;
break;
- case 0xE7:
+ case ASEQ_OP_CHAN_LDPARAMS:
cmdArgU16 = (u16)cmdArgs[0];
data = &seqPlayer->seqData[cmdArgU16];
channel->muteBehavior = *data++;
@@ -1500,7 +1504,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
channel->changes.s.pan = true;
break;
- case 0xE8:
+ case ASEQ_OP_CHAN_PARAMS:
channel->muteBehavior = cmdArgs[0];
channel->noteAllocPolicy = cmdArgs[1];
cmd = (u8)cmdArgs[2];
@@ -1514,7 +1518,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
channel->changes.s.pan = true;
break;
- case 0xEC:
+ case ASEQ_OP_CHAN_VIBRESET:
channel->vibratoDepthTarget = 0;
channel->vibratoDepthStart = 0;
channel->vibratoDepthChangeDelay = 0;
@@ -1532,26 +1536,26 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
channel->freqScale = 1.0f;
break;
- case 0xE9:
+ case ASEQ_OP_CHAN_NOTEPRI:
AudioSeq_SetChannelPriorities(channel, (u8)cmdArgs[0]);
break;
- case 0xED:
+ case ASEQ_OP_CHAN_GAIN:
cmd = (u8)cmdArgs[0];
channel->gain = cmd;
break;
- case 0xB0:
+ case ASEQ_OP_CHAN_LDFILTER:
cmdArgU16 = (u16)cmdArgs[0];
data = seqPlayer->seqData + cmdArgU16;
channel->filter = (s16*)data;
break;
- case 0xB1:
+ case ASEQ_OP_CHAN_FREEFILTER:
channel->filter = NULL;
break;
- case 0xB3:
+ case ASEQ_OP_CHAN_FILTER:
cmd = cmdArgs[0];
if (channel->filter != NULL) {
@@ -1561,34 +1565,34 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
}
break;
- case 0xB2:
+ case ASEQ_OP_CHAN_LDSEQTOPTR:
cmdArgU16 = (u16)cmdArgs[0];
channel->unk_22 = *(u16*)(seqPlayer->seqData + (u32)(cmdArgU16 + scriptState->value * 2));
break;
- case 0xB4:
+ case ASEQ_OP_CHAN_PTRTODYNTBL:
channel->dynTable = (void*)&seqPlayer->seqData[channel->unk_22];
break;
- case 0xB5:
+ case ASEQ_OP_CHAN_DYNTBLTOPTR:
channel->unk_22 = ((u16*)(channel->dynTable))[scriptState->value];
break;
- case 0xB6:
+ case ASEQ_OP_CHAN_DYNTBLV:
scriptState->value = (*channel->dynTable)[0][scriptState->value];
break;
- case 0xB7:
+ case ASEQ_OP_CHAN_RANDTOPTR:
channel->unk_22 =
(cmdArgs[0] == 0) ? gAudioCtx.audioRandom & 0xFFFF : gAudioCtx.audioRandom % cmdArgs[0];
break;
- case 0xB8:
+ case ASEQ_OP_CHAN_RAND:
scriptState->value =
(cmdArgs[0] == 0) ? gAudioCtx.audioRandom & 0xFFFF : gAudioCtx.audioRandom % cmdArgs[0];
break;
- case 0xBD:
+ case ASEQ_OP_CHAN_RANDPTR:
temp2 = AudioThread_NextRandom();
channel->unk_22 = (cmdArgs[0] == 0) ? (temp2 & 0xFFFF) : (temp2 % cmdArgs[0]);
channel->unk_22 += cmdArgs[1];
@@ -1597,20 +1601,20 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
channel->unk_22 = (temp2 << 8) | param;
break;
- case 0xB9:
+ case ASEQ_OP_CHAN_RANDVEL:
channel->velocityRandomVariance = cmdArgs[0];
break;
- case 0xBA:
+ case ASEQ_OP_CHAN_RANDGATE:
channel->gateTimeRandomVariance = cmdArgs[0];
break;
- case 0xBB:
+ case ASEQ_OP_CHAN_COMBFILTER:
channel->combFilterSize = cmdArgs[0];
channel->combFilterGain = cmdArgs[1];
break;
- case 0xBC:
+ case ASEQ_OP_CHAN_PTRADD:
channel->unk_22 += cmdArgs[0];
break;
}
@@ -1620,12 +1624,12 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
if (cmd >= 0x70) {
lowBits = cmd & 0x7;
- if ((cmd & 0xF8) != 0x70 && lowBits >= 4) {
+ if ((cmd & 0xF8) != ASEQ_OP_CHAN_STIO && lowBits >= 4) {
lowBits = 0;
}
switch (cmd & 0xF8) {
- case 0x80:
+ case ASEQ_OP_CHAN_TESTLAYER:
if (channel->layers[lowBits] != NULL) {
scriptState->value = channel->layers[lowBits]->finished;
} else {
@@ -1633,18 +1637,18 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
}
break;
- case 0x88:
+ case ASEQ_OP_CHAN_LDLAYER:
cmdArgU16 = AudioSeq_ScriptReadS16(scriptState);
if (!AudioSeq_SeqChannelSetLayer(channel, lowBits)) {
channel->layers[lowBits]->scriptState.pc = &seqPlayer->seqData[cmdArgU16];
}
break;
- case 0x90:
+ case ASEQ_OP_CHAN_DELLAYER:
AudioSeq_SeqLayerFree(channel, lowBits);
break;
- case 0x98:
+ case ASEQ_OP_CHAN_DYNLDLAYER:
if (scriptState->value != -1 && AudioSeq_SeqChannelSetLayer(channel, lowBits) != -1) {
data = (*channel->dynTable)[scriptState->value];
cmdArgU16 = (data[0] << 8) + data[1];
@@ -1652,11 +1656,11 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
}
break;
- case 0x70:
+ case ASEQ_OP_CHAN_STIO:
channel->seqScriptIO[lowBits] = scriptState->value;
break;
- case 0x78:
+ case ASEQ_OP_CHAN_RLDLAYER:
temp1 = AudioSeq_ScriptReadS16(scriptState);
if (!AudioSeq_SeqChannelSetLayer(channel, lowBits)) {
channel->layers[lowBits]->scriptState.pc = &scriptState->pc[temp1];
@@ -1669,11 +1673,11 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
lowBits = cmd & 0xF;
switch (cmd & 0xF0) {
- case 0x00:
+ case ASEQ_OP_CHAN_CDELAY:
channel->delay = lowBits;
goto exit_loop;
- case 0x10:
+ case ASEQ_OP_CHAN_LDSAMPLE:
if (lowBits < 8) {
channel->seqScriptIO[lowBits] = SEQ_IO_VAL_NONE;
if (AudioLoad_SlowLoadSample(channel->fontId, scriptState->value, &channel->seqScriptIO[lowBits]) ==
@@ -1686,28 +1690,28 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
}
break;
- case 0x60:
+ case ASEQ_OP_CHAN_LDIO:
scriptState->value = channel->seqScriptIO[lowBits];
if (lowBits < 2) {
channel->seqScriptIO[lowBits] = SEQ_IO_VAL_NONE;
}
break;
- case 0x50:
+ case ASEQ_OP_CHAN_SUBIO:
scriptState->value -= channel->seqScriptIO[lowBits];
break;
- case 0x20:
+ case ASEQ_OP_CHAN_LDCHAN:
cmdArgU16 = AudioSeq_ScriptReadS16(scriptState);
AudioSeq_SequenceChannelEnable(seqPlayer, lowBits, &seqPlayer->seqData[cmdArgU16]);
break;
- case 0x30:
+ case ASEQ_OP_CHAN_STCIO:
cmd = AudioSeq_ScriptReadU8(scriptState);
seqPlayer->channels[lowBits]->seqScriptIO[cmd] = scriptState->value;
break;
- case 0x40:
+ case ASEQ_OP_CHAN_LDCIO:
cmd = AudioSeq_ScriptReadU8(scriptState);
scriptState->value = seqPlayer->channels[lowBits]->seqScriptIO[cmd];
break;
@@ -1780,7 +1784,7 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
cmd = AudioSeq_ScriptReadU8(seqScript);
// 0xF2 and above are "flow control" commands, including termination.
- if (cmd >= 0xF2) {
+ if (cmd >= ASEQ_OP_CONTROL_FLOW_FIRST) {
delay = AudioSeq_HandleScriptFlowControl(
seqPlayer, seqScript, cmd, AudioSeq_GetScriptControlFlowArgument(&seqPlayer->scriptState, cmd));
@@ -1797,7 +1801,7 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
if (cmd >= 0xC0) {
switch (cmd) {
- case 0xF1:
+ case ASEQ_OP_SEQ_ALLOCNOTELIST:
Audio_NotePoolClear(&seqPlayer->notePool);
cmd = AudioSeq_ScriptReadU8(seqScript);
Audio_NotePoolFill(&seqPlayer->notePool, cmd);
@@ -1813,18 +1817,18 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
if (dummy) {}
break;
- case 0xF0:
+ case ASEQ_OP_SEQ_FREENOTELIST:
Audio_NotePoolClear(&seqPlayer->notePool);
break;
- case 0xDF:
+ case ASEQ_OP_SEQ_TRANSPOSE:
seqPlayer->transposition = 0;
FALLTHROUGH;
- case 0xDE:
+ case ASEQ_OP_SEQ_RTRANSPOSE:
seqPlayer->transposition += (s8)AudioSeq_ScriptReadU8(seqScript);
break;
- case 0xDD:
+ case ASEQ_OP_SEQ_TEMPO:
seqPlayer->tempo = AudioSeq_ScriptReadU8(seqScript) * SEQTICKS_PER_BEAT;
if (seqPlayer->tempo > gAudioCtx.maxTempo) {
seqPlayer->tempo = (u16)gAudioCtx.maxTempo;
@@ -1835,11 +1839,11 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
}
break;
- case 0xDC:
+ case ASEQ_OP_SEQ_TEMPOCHG:
seqPlayer->tempoChange = (s8)AudioSeq_ScriptReadU8(seqScript) * SEQTICKS_PER_BEAT;
break;
- case 0xDA:
+ case ASEQ_OP_SEQ_VOLMODE:
cmd = AudioSeq_ScriptReadU8(seqScript);
temp = AudioSeq_ScriptReadS16(seqScript);
switch (cmd) {
@@ -1859,7 +1863,7 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
}
break;
- case 0xDB:
+ case ASEQ_OP_SEQ_VOL:
value = AudioSeq_ScriptReadU8(seqScript);
switch (seqPlayer->state) {
case 1:
@@ -1881,47 +1885,47 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
}
break;
- case 0xD9:
+ case ASEQ_OP_SEQ_VOLSCALE:
seqPlayer->fadeVolumeScale = (s8)AudioSeq_ScriptReadU8(seqScript) / 127.0f;
break;
- case 0xD7:
+ case ASEQ_OP_SEQ_INITCHAN:
temp = AudioSeq_ScriptReadS16(seqScript);
AudioSeq_SequencePlayerSetupChannels(seqPlayer, temp);
break;
- case 0xD6:
+ case ASEQ_OP_SEQ_FREECHAN:
AudioSeq_ScriptReadS16(seqScript);
break;
- case 0xD5:
+ case ASEQ_OP_SEQ_MUTESCALE:
seqPlayer->muteVolumeScale = (s8)AudioSeq_ScriptReadU8(seqScript) / 127.0f;
break;
- case 0xD4:
+ case ASEQ_OP_SEQ_MUTE:
seqPlayer->muted = true;
break;
- case 0xD3:
+ case ASEQ_OP_SEQ_MUTEBHV:
seqPlayer->muteBehavior = AudioSeq_ScriptReadU8(seqScript);
break;
- case 0xD1:
- case 0xD2:
+ case ASEQ_OP_SEQ_LDSHORTGATEARR:
+ case ASEQ_OP_SEQ_LDSHORTVELARR:
temp = AudioSeq_ScriptReadS16(seqScript);
data3 = &seqPlayer->seqData[temp];
- if (cmd == 0xD2) {
+ if (cmd == ASEQ_OP_SEQ_LDSHORTVELARR) {
seqPlayer->shortNoteVelocityTable = data3;
} else {
seqPlayer->shortNoteGateTimeTable = data3;
}
break;
- case 0xD0:
+ case ASEQ_OP_SEQ_NOTEALLOC:
seqPlayer->noteAllocPolicy = AudioSeq_ScriptReadU8(seqScript);
break;
- case 0xCE:
+ case ASEQ_OP_SEQ_RAND:
cmd = AudioSeq_ScriptReadU8(seqScript);
if (cmd == 0) {
seqScript->value = (gAudioCtx.audioRandom >> 2) & 0xFF;
@@ -1930,7 +1934,7 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
}
break;
- case 0xCD:
+ case ASEQ_OP_SEQ_DYNCALL:
temp = AudioSeq_ScriptReadS16(seqScript);
if ((seqScript->value != -1) && (seqScript->depth != 3)) {
data = seqPlayer->seqData + (u32)(temp + (seqScript->value << 1));
@@ -1942,39 +1946,39 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
}
break;
- case 0xCC:
+ case ASEQ_OP_SEQ_LDI:
seqScript->value = AudioSeq_ScriptReadU8(seqScript);
break;
- case 0xC9:
+ case ASEQ_OP_SEQ_AND:
seqScript->value &= AudioSeq_ScriptReadU8(seqScript);
break;
- case 0xC8:
+ case ASEQ_OP_SEQ_SUB:
seqScript->value -= AudioSeq_ScriptReadU8(seqScript);
break;
- case 0xC7:
+ case ASEQ_OP_SEQ_STSEQ:
cmd = AudioSeq_ScriptReadU8(seqScript);
temp = AudioSeq_ScriptReadS16(seqScript);
data2 = &seqPlayer->seqData[temp];
*data2 = (u8)seqScript->value + cmd;
break;
- case 0xC6:
+ case ASEQ_OP_SEQ_STOP:
seqPlayer->stopScript = true;
return;
- case 0xC5:
+ case ASEQ_OP_SEQ_SCRIPTCTR:
seqPlayer->scriptCounter = (u16)AudioSeq_ScriptReadS16(seqScript);
break;
- case 0xEF:
+ case ASEQ_OP_SEQ_EF:
AudioSeq_ScriptReadS16(seqScript);
AudioSeq_ScriptReadU8(seqScript);
break;
- case 0xC4:
+ case ASEQ_OP_SEQ_RUNSEQ:
cmd = AudioSeq_ScriptReadU8(seqScript);
if (cmd == 0xFF) {
cmd = seqPlayer->playerIdx;
@@ -1992,47 +1996,47 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
cmdLowBits = cmd & 0x0F;
switch (cmd & 0xF0) {
- case 0x00:
+ case ASEQ_OP_SEQ_TESTCHAN:
seqScript->value = seqPlayer->channels[cmdLowBits]->enabled ^ 1;
break;
- case 0x50:
+ case ASEQ_OP_SEQ_SUBIO:
seqScript->value -= seqPlayer->seqScriptIO[cmdLowBits];
break;
- case 0x70:
+ case ASEQ_OP_SEQ_STIO:
seqPlayer->seqScriptIO[cmdLowBits] = seqScript->value;
break;
- case 0x80:
+ case ASEQ_OP_SEQ_LDIO:
seqScript->value = seqPlayer->seqScriptIO[cmdLowBits];
if (cmdLowBits < 2) {
seqPlayer->seqScriptIO[cmdLowBits] = SEQ_IO_VAL_NONE;
}
break;
- case 0x40:
+ case ASEQ_OP_SEQ_STOPCHAN:
AudioSeq_SequenceChannelDisable(seqPlayer->channels[cmdLowBits]);
break;
- case 0x90:
+ case ASEQ_OP_SEQ_LDCHAN:
temp = AudioSeq_ScriptReadS16(seqScript);
AudioSeq_SequenceChannelEnable(seqPlayer, cmdLowBits, (void*)&seqPlayer->seqData[temp]);
break;
- case 0xA0:
+ case ASEQ_OP_SEQ_RLDCHAN:
tempS = AudioSeq_ScriptReadS16(seqScript);
AudioSeq_SequenceChannelEnable(seqPlayer, cmdLowBits, (void*)&seqScript->pc[tempS]);
break;
- case 0xB0:
+ case ASEQ_OP_SEQ_LDSEQ:
cmd = AudioSeq_ScriptReadU8(seqScript);
temp = AudioSeq_ScriptReadS16(seqScript);
data2 = &seqPlayer->seqData[temp];
AudioLoad_SlowLoadSeq(cmd, data2, &seqPlayer->seqScriptIO[cmdLowBits]);
break;
- case 0x60:
+ case ASEQ_OP_SEQ_LDRES:
cmd = AudioSeq_ScriptReadU8(seqScript);
value = cmd;
temp = AudioSeq_ScriptReadU8(seqScript);