Z64 Music Macro Language - waffleoRai/zeqer64 GitHub Wiki
Overview
Common Rules
Variable Length Quantities (VLQs)
Jump Loops
Player State
Sequence players need to be able to communicate with the rest of the game to react to player input and whatnot. This section will go over the sequence player, channel, and layer parameters tracked during sequence play.
Sequence
The full structure definition (SequencePlayer
) for the sequence player can be found in z64audio.h
in the decomp repo for OoT.
The sequence player has 8 signed one-byte storage slots for SequencePlayer.soundScriptIO
storing values for itself and communicating with the outside game. This is shortened to seqIO
in this documentation.
The player also holds one signed one-byte state value (stored as SequencePlayer.scriptState.value
). This is often used when modifying or loading data or checking conditional branches. Following from SEQ64, it is referred to as Q
in the documentation.
I think the main other important thing to keep in mind is that the SequencePlayer
stack size is only 4. Not sure why you would need to, but don't overdo nested calls.
Channel
The channel structure definition (SequenceChannel
) is also found in z64audio.h
. Like a sequence player, a given channel has 8 one-byte IO ports (SequenceChannel.soundScriptIO
, referred to here as ChanIO
) and a Q
script state value (SequenceChannel.scriptState.value
). Channels also have an unsigned two byte P
state value, which generally holds a sequence relative pointer. The code version I have still has this field labeled SequenceChannel.unk_22
.
Note that because each channel has its own IO ports, each channel can be controlled separate from the sequence.
Layer
Layers also have a SeqScriptState
(required for control flow) and thus a Q
value. However, there aren't any layer commands that utilize it as layers are primarily concerned with playing notes. They do not have IO ports, so can't be controlled by the external program in the same way as their channels.