diff options
| author | engineer124 <47598039+engineer124@users.noreply.github.com> | 2023-03-30 19:53:47 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-30 19:53:47 +1100 |
| commit | 6685a4775e440b247f3db62db4162dccbf0775ea (patch) | |
| tree | 14c20e33d91b6914f272d8301b7c3a0cfb544e01 /include | |
| parent | 045c3537a9bae4fa7fb33985c7834f3c956d42f1 (diff) | |
Audio `sequence.c` OK and documented (#1201)
* import sequence docs
* cleanup
* do not need raw hex
Diffstat (limited to 'include')
| -rw-r--r-- | include/functions.h | 59 | ||||
| -rw-r--r-- | include/seqcmd.h | 521 | ||||
| -rw-r--r-- | include/sequence.h | 17 | ||||
| -rw-r--r-- | include/variables.h | 45 | ||||
| -rw-r--r-- | include/z64.h | 1 | ||||
| -rw-r--r-- | include/z64audio.h | 74 |
6 files changed, 608 insertions, 109 deletions
diff --git a/include/functions.h b/include/functions.h index bac7712b2..793ac829b 100644 --- a/include/functions.h +++ b/include/functions.h @@ -2812,7 +2812,6 @@ void AudioOcarina_TerminaWallGenerateNotes(void); void AudioOcarina_PlayLongScarecrowAfterCredits(void); void Audio_Update(void); -// void func_8019E110(void); void AudioSfx_SetProperties(u8 bankId, u8 entryIndex, u8 channelIndex); void play_sound(u16 sfxId); void func_8019F128(u16 sfxId); @@ -2846,10 +2845,10 @@ void Audio_PlaySfxForRiver(Vec3f* pos, f32 freqScale); // void Audio_PlaySfxForWaterfall(void); // void Audio_StepFreqLerp(void); void func_801A0124(Vec3f* pos, u8 arg1); -void func_801A0184(void); -void func_801A01C4(void); +void Audio_SetBgmVolumeOff(void); +void Audio_SetBgmVolumeOn(void); void func_801A0204(s8 seqId); -void func_801A0238(s32 arg0, s32 arg1); +void Audio_SetMainBgmVolume(u8 targetVolume, u8 volumeFadeTimer); // void Audio_SetGanonsTowerBgmVolumeLevel(void); // void Audio_SetGanonsTowerBgmVolume(void); // void Audio_UpdateRiverSoundVolumes(void); @@ -2879,12 +2878,9 @@ void func_801A1FB4(u8 playerIndex, Vec3f* pos, u16 seqId, f32 maxDist); void func_801A246C(u8 param_1, u8 param_2); void Audio_PlayMorningSceneSequence(u16 seqId, u8 dayMinusOne); void Audio_PlaySceneSequence(u16 seqId, u8 dayMinusOne); -// void func_801A27E8(void); -// void func_801A281C(void); -void func_801A29D4(UNK_TYPE arg0, f32 arg1, UNK_TYPE arg2); -void func_801A2BB8(s32 seqId); -void func_801A2C20(void); -// void func_801A2C44(void); +void Audio_SetSeqTempoAndFreq(u8 seqPlayerIndex, f32 freqTempoScale, u8 duration); +void Audio_PlaySubBgm(u16 seqId); +void Audio_StopSubBgm(void); void Audio_PlaySequenceInCutscene(u16 seqId); void Audio_StopSequenceInCutscene(u16 seqId); s32 Audio_IsSequencePlaying(u8 seqId); @@ -2895,7 +2891,7 @@ void Audio_RestorePrevBgm(void); void Audio_PlayFanfare(u16 seqId); // void func_801A312C(void); void func_801A31EC(u16 seqId, s8 arg1, u8 arg2); -void Audio_PlaySequenceWithSeqPlayerIO(s8 playerIndex, u16 seqId, u8 fadeInDuration, s8 ioPort, u8 ioData); +void Audio_PlaySequenceWithSeqPlayerIO(s8 seqPlayerIndex, u16 seqId, u8 fadeInDuration, s8 ioPort, u8 ioData); void Audio_SetSequenceMode(u8 seqMode); void Audio_UpdateEnemyBgmVolume(f32 dist); u8 func_801A3950(s32 playerIndex, s32 isChannelIOSet); @@ -2925,23 +2921,20 @@ void func_801A41F8(UNK_TYPE arg0); void Audio_SetSfxVolumeExceptSystemAndOcarinaBanks(u8 arg0); void func_801A4428(u8 reverbIndex); void Audio_PreNMI(void); -// void Audio_ResetRequestedSceneSeqId(void); -// void func_801A44D4(void); s32 func_801A46F8(void); void func_801A4748(Vec3f* pos, u16 sfxId); void func_801A479C(Vec3f* arg0, u16 sfxId, s32 arg2); void Audio_SetAmbienceChannelIO(u8 channelIndexRange, u8 ioPort, u8 ioData); void Audio_PlayAmbience(u8 ambienceId); void Audio_Init(void); -void func_801A4D00(void); -// void func_801A4D50(void); -// void func_801A4DA4(void); -// void func_801A4DF4(void); -// void func_801A4E64(void); +void Audio_InitSound(void); +void Audio_ResetForAudioHeapStep3(void); +void Audio_ResetForAudioHeapStep2(void); +void Audio_ResetForAudioHeapStep1(s32 specId); // void func_801A4EB0(void); // void func_801A4EB8(void); -// void func_801A4FD8(void); +void func_801A4FD8(void); void func_801A5080(u16 arg0); u16 func_801A5100(void); void func_801A5118(void); @@ -2955,7 +2948,7 @@ UNK_TYPE func_801A51F0(UNK_TYPE arg0); // void func_801A54D0(void); // void func_801A5680(void); // void func_801A5808(void); -// void func_801A5A10(void); +void AudioVoice_ResetData(void); // void func_801A5A1C(void); void AudioSfx_MuteBanks(u16 muteMask); @@ -2974,20 +2967,18 @@ void AudioSfx_ProcessActiveSfx(void); u8 AudioSfx_IsPlaying(u32 sfxId); void AudioSfx_Reset(void); -void Audio_StartSequence(u8 playerIndex, u8 seqId, u8 seqArgs, u16 fadeTimer); -void Audio_StopSequence(u8 playerIndex, u16 fadeTimer); -// void func_801A7D84(void); -void Audio_QueueSeqCmd(u32 cmd); -void func_801A89D0(void); -u16 Audio_GetActiveSequence(u8 playerIndex); -s32 func_801A8ABC(u32 cmdVal, u32 cmdMask); -void Audio_SetVolumeScale(u8 playerIndex, u8 scaleIndex, u8 targetVol, u8 volFadeTimer); -void func_801A8D5C(void); -// void func_801A8E90(void); -u8 func_801A9768(void); -u8 func_801A982C(void); -// void func_801A99B8(void); -// void func_801A9A74(void); +void AudioSeq_StartSequence(u8 seqPlayerIndex, u8 seqId, u8 seqArgs, u16 fadeInDuration); +void AudioSeq_StopSequence(u8 seqPlayerIndex, u16 fadeOutDuration); +void AudioSeq_QueueSeqCmd(u32 cmd); +void AudioSeq_ProcessSeqCmds(void); +u16 AudioSeq_GetActiveSeqId(u8 seqPlayerIndex); +s32 AudioSeq_IsSeqCmdNotQueued(u32 cmdVal, u32 cmdMask); +void AudioSeq_SetVolumeScale(u8 seqPlayerIndex, u8 scaleIndex, u8 targetVol, u8 volFadeTimer); +void AudioSeq_UpdateActiveSequences(void); +u8 AudioSeq_UpdateAudioHeapReset(void); +u8 AudioSeq_ResetReverb(void); +void AudioSeq_ResetActiveSequences(void); +void AudioSeq_ResetActiveSequencesAndVolume(void); void Regs_InitData(PlayState* play); diff --git a/include/seqcmd.h b/include/seqcmd.h new file mode 100644 index 000000000..a7db69dad --- /dev/null +++ b/include/seqcmd.h @@ -0,0 +1,521 @@ +#ifndef SEQCMD_H +#define SEQCMD_H + +// ==== Primary commands ==== + +#define SEQCMD_OP_MASK 0xF0000000 +#define SEQCMD_ASYNC_ACTIVE 0x8000000 +#define SEQCMD_SEQPLAYER_MASK 0x7000000 +#define SEQCMD_SEQID_MASK 0xFF // Only applies to certain seqcmds + +typedef enum { + /* 0x0 */ SEQCMD_OP_PLAY_SEQUENCE, + /* 0x1 */ SEQCMD_OP_STOP_SEQUENCE, + /* 0x2 */ SEQCMD_OP_QUEUE_SEQUENCE, + /* 0x3 */ SEQCMD_OP_UNQUEUE_SEQUENCE, + /* 0x4 */ SEQCMD_OP_SET_SEQPLAYER_VOLUME, + /* 0x5 */ SEQCMD_OP_SET_SEQPLAYER_FREQ, + /* 0x6 */ SEQCMD_OP_SET_CHANNEL_VOLUME, + /* 0x7 */ SEQCMD_OP_SET_SEQPLAYER_IO, + /* 0x8 */ SEQCMD_OP_SET_CHANNEL_IO, + /* 0x9 */ SEQCMD_OP_SET_CHANNEL_IO_DISABLE_MASK, + /* 0xA */ SEQCMD_OP_SET_CHANNEL_DISABLE_MASK, + /* 0xB */ SEQCMD_OP_TEMPO_CMD, + /* 0xC */ SEQCMD_OP_SETUP_CMD, + /* 0xD */ SEQCMD_OP_SET_CHANNEL_FREQ, + /* 0xE */ SEQCMD_OP_GLOBAL_CMD, + /* 0xF */ SEQCMD_OP_RESET_AUDIO_HEAP +} SeqCmdOp; + +// ==== Secondary commands ==== + +// Subset of `SEQCMD_OP_TEMPO_CMD` +typedef enum { + /* 0x0 */ SEQCMD_SUB_OP_TEMPO_SET, + /* 0x1 */ SEQCMD_SUB_OP_TEMPO_SPEED_UP, + /* 0x2 */ SEQCMD_SUB_OP_TEMPO_SLOW_DOWN, + /* 0x3 */ SEQCMD_SUB_OP_TEMPO_SCALE, + /* 0x4 */ SEQCMD_SUB_OP_TEMPO_RESET +} SeqCmdTempoCmdOp; + +// Subset of `SEQCMD_OP_SETUP_CMD` +typedef enum { + /* 0x0 */ SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME, + /* 0x1 */ SEQCMD_SUB_OP_SETUP_SEQ_UNQUEUE, + /* 0x2 */ SEQCMD_SUB_OP_SETUP_RESTART_SEQ, + /* 0x3 */ SEQCMD_SUB_OP_SETUP_TEMPO_SCALE, + /* 0x4 */ SEQCMD_SUB_OP_SETUP_TEMPO_RESET, + /* 0x5 */ SEQCMD_SUB_OP_SETUP_PLAY_SEQ, + /* 0x6 */ SEQCMD_SUB_OP_SETUP_SET_FADE_TIMER, + /* 0x7 */ SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME_IF_QUEUED, + /* 0x8 */ SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME_WITH_SCALE_INDEX, + /* 0x9 */ SEQCMD_SUB_OP_SETUP_SET_CHANNEL_DISABLE_MASK, + /* 0xA */ SEQCMD_SUB_OP_SETUP_SET_SEQPLAYER_FREQ, + /* 0xE */ SEQCMD_SUB_OP_SETUP_POP_PERSISTENT_CACHE = 0xE, + /* 0xF */ SEQCMD_SUB_OP_SETUP_RESET_SETUP_CMDS +} SeqCmdSetupCmdOp; + +// Subset of `SEQCMD_OP_GLOBAL_CMD` +typedef enum { + /* 0x0 */ SEQCMD_SUB_OP_GLOBAL_SET_SOUND_MODE, + /* 0x1 */ SEQCMD_SUB_OP_GLOBAL_DISABLE_NEW_SEQUENCES, + /* 0x2 */ SEQCMD_SUB_OP_GLOBAL_DISABLE_NEW_SEQUENCES_2 +} SeqCmdSubCmdOp; + +// ==== Audio Sequence Primary Commands ==== + +/** + * Play a sequence on a given seqPlayer + * + * @param seqPlayerIndex the index of the seqPlayer to play the sequence + * @param fadeInDuration effect will depend on seqArg. See below + * @param seqArg no effect: < 0x7F, skip ticks: = 0x7F, play after loading asynchronously: >= 0x80 (see note) + * @param seqId the id of the sequence to play, see `SeqId` + * + * @note seqArg will also be stored in gActiveSeqs.seqId, any check against that seqId must also include seqArg. + * seqArg = 0x7F will interpret the duration as the number of ticks to skip. + * seqArg >= 0x80 load the soundFont asynchronously, will only start playing once loaded. + */ +#define SEQCMD_PLAY_SEQUENCE(seqPlayerIndex, fadeInDuration, seqId) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_PLAY_SEQUENCE << 28) | ((seqPlayerIndex) << 24) | ((u32)(fadeInDuration) << 16) | \ + (u32)(seqId)) + +/** + * Stop a sequence on a given seqPlayer + * + * @param seqPlayerIndex the index of the seqPlayer to stop the sequence + * @param fadeOutDuration duration the sequence will fade out over + * + * @note the 0xFF in the command is not read from at all, but is common in all Stop SeqPlayer Commands + */ +#define SEQCMD_STOP_SEQUENCE(seqPlayerIndex, fadeOutDuration) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_STOP_SEQUENCE << 28) | 0xFF | ((u8)(seqPlayerIndex) << 24) | \ + ((fadeOutDuration) << 16)) + +/** + * Add a sequence to a queue of sequences associated with a given seqPlayer. + * If the sequence is first in queue, play the sequence + * + * @param seqPlayerIndex the index of the seqPlayer to queue the sequence + * @param fadeInDuration if the sequence is played, duration the sequence will fade in over + * @param priority priority in the queue. The highest valued priority will be queued to play first. Also used as `seqArg`. + * @param seqId the id of the sequence to play, see `SeqId` + * + * @note for the next sequence in the queue to play, the current sequence must be unqueued with the unqueue command + * @note for a priority >= 0x7F, similar effects happen as `seqArg` in the play sequence command + */ +#define SEQCMD_QUEUE_SEQUENCE(seqPlayerIndex, fadeInDuration, priority, seqId) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_QUEUE_SEQUENCE << 28) | ((u8)(seqPlayerIndex) << 24) | \ + ((u8)(fadeInDuration) << 16) | ((u8)(priority) << 8) | (u8)(seqId)) + +/** + * Remove a sequence from a queue of sequences associated with a given seqPlayer. + * If the sequence is first in queue, stop the sequence, and play the next one in queue if any + * + * @param seqPlayerIndex the index of the seqPlayer to queue the sequence + * @param fadeInDuration if the sequence is stopped, duration the sequence will fade out over, and duration the next seq will fade in over + * @param seqId the id of the sequence to remove, see `SeqId` + * + * @note for the next sequence in the queue to play, the current sequence must be unqueued with this command + */ +#define SEQCMD_UNQUEUE_SEQUENCE(seqPlayerIndex, fadeOutInDuration, seqId) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_UNQUEUE_SEQUENCE << 28) | ((u32)(seqPlayerIndex) << 24) | \ + ((u8)(fadeOutInDuration) << 16) | (u32)(seqId)) + +/** + * Set the volume of an entire sequence on a given seqPlayer. Fade to the volume over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the volume + * @param volume the target volume for the sequence. Ranged from 0-0xFF, with 0x7F mapping to 1.0f + */ +#define SEQCMD_SET_SEQPLAYER_VOLUME(seqPlayerIndex, duration, volume) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SET_SEQPLAYER_VOLUME << 28) | ((u32)(seqPlayerIndex) << 24) | \ + ((u32)(duration) << 16) | (volume)) + +/** + * Scale the frequency of every channel on a given seqPlayer over a specified duration. + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the frequency + * @param freqScale the scaling factor to shift the pitch. Ranged from 0-0xFFFF, with 1000 mapping to 1.0f + * + * @note 2000 will double the frequency (raise an octave), 500 will halve the frequency (lower an octave). + * Cannot be used with `SEQCMD_SET_CHANNEL_FREQ` as they will overwrite one another. + */ +#define SEQCMD_SET_SEQPLAYER_FREQ(seqPlayerIndex, duration, freqScale) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SET_SEQPLAYER_FREQ << 28) | (u32)((seqPlayerIndex) << 24) | \ + ((u32)((duration) << 16)) | (u16)(freqScale)) + +/** + * Scale the frequency of a specific channel on a given seqPlayer over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param channelIndex the index of the channel to modify + * @param duration duration to transition to the frequency + * @param freqScale the scaling factor to shift the pitch. Ranged from 0-0xFFF, with 1000 mapping to 1.0f + * + * @note a frequency of 2000 will double the frequency (raise an octave), 500 will halve the frequency (lower an + * octave). Cannot be used with `SEQCMD_SET_SEQPLAYER_FREQ` as they will overwrite one another. + */ +#define SEQCMD_SET_CHANNEL_FREQ(seqPlayerIndex, channelIndex, duration, freqScale) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SET_CHANNEL_FREQ << 28) | ((u8)(seqPlayerIndex) << 24) | ((duration) << 16) | \ + ((channelIndex) << 12) | (freqScale)) + +/** + * Set the volume of a specific channel on a given seqPlayer. Fade to the volume over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param channelIndex the index of the channel to modify + * @param duration duration to transition to the volume + * @param volume the target volume for the sequence. Ranged from 0-0xFF, with 0x7F mapping to 1.0f + */ +#define SEQCMD_SET_CHANNEL_VOLUME(seqPlayerIndex, channelIndex, duration, volume) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SET_CHANNEL_VOLUME << 28) | ((u32)(seqPlayerIndex) << 24) | \ + ((u32)(duration) << 16) | ((u32)(channelIndex) << 8) | (volume)) + +/** + * Write a value that can be read as input directly by the sequence itself. This will be set to the global + * ioPort, which can affect the entire sequence. + * + * @param seqPlayerIndex the index of the seqPlayer to write the input to + * @param ioPort the index of the array to store the input-output value + * @param ioData the value s8 that's written to the input-output array + * + * @note Each seqPlayer has 8 global ioPorts indexed 0-7. + * ioPort 0 and 1 are read-only-once, and will reset after being read by the sequence. + * ioPort 2-7 can be read multiple times. + */ +#define SEQCMD_SET_SEQPLAYER_IO(seqPlayerIndex, ioPort, ioData) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SET_SEQPLAYER_IO << 28) | ((u32)(seqPlayerIndex) << 24) | ((u32)(ioPort) << 16) | \ + (u32)(ioData)) + +/** + * Write a value that can be read as input directly by the sequence itself. This will be set to the channel + * ioPort, which will only affect a single channel. + * + * @param seqPlayerIndex the index of the seqPlayer to write the input to + * @param channelIndex the index of the channel to write the input to + * @param ioPort the index of the array to store the input-output value + * @param ioData the value s8 that's written to the input-output array + * + * @note Each channel has 8 channel ioPorts indexed 0-7. + * ioPort 0 and 1 are read-only-once, and will reset after being read by the sequence. + * ioPort 2-7 can be read multiple times. + */ +#define SEQCMD_SET_CHANNEL_IO(seqPlayerIndex, channelIndex, ioPort, ioData) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SET_CHANNEL_IO << 28) | ((u32)(seqPlayerIndex) << 24) | ((u32)(ioPort) << 16) | \ + ((u32)(channelIndex) << 8) | (u32)(ioData)) + +/** + * Disable (or reenable) specific channels from receiving input set by `SEQCMD_SET_CHANNEL_IO` + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param channelMask a 16 bit mask where each bit maps to a channel. Bitflag on to disable + * + * @note using Audio_QueueCmdS8 0x06 will bypass this channelMask + */ +#define SEQCMD_SET_CHANNEL_IO_DISABLE_MASK(seqPlayerIndex, channelMask) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SET_CHANNEL_IO_DISABLE_MASK << 28) | ((u8)(seqPlayerIndex) << 24) | \ + (u16)(channelMask)) + +/** + * Disable (or reenable) specific channels + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param channelMask a 16 bit mask where each bit maps to a channel. Bitflag on to disable + */ +#define SEQCMD_SET_CHANNEL_DISABLE_MASK(seqPlayerIndex, channelMask) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SET_CHANNEL_DISABLE_MASK << 28) | ((u32)(seqPlayerIndex) << 24) | \ + (u32)(channelMask)) + +// ==== Audio Sequence Tempo Commands ==== + +/** + * Set the absolute tempo of a sequence on a given seqPlayer, fading over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the tempo + * @param tempoTarget the target tempo for the sequence + * + * @note the absolute tempo is constrained to a maximum of 300 + */ +#define SEQCMD_SET_TEMPO(seqPlayerIndex, duration, tempoTarget) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_TEMPO_CMD << 28) | (SEQCMD_SUB_OP_TEMPO_SET << 12) | \ + ((u8)(seqPlayerIndex) << 24) | ((u8)(duration) << 16) | (u8)(tempoTarget)) + +/** + * Increase the tempo of a sequence by a relative value on a given seqPlayer over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the tempo + * @param tempoIncrease the change to add to the current tempo + * + * @note the absolute tempo is constrained to a maximum of 300 + */ +#define SEQCMD_SPEED_UP_TEMPO(seqPlayerIndex, duration, tempoIncrease) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_TEMPO_CMD << 28) | (SEQCMD_SUB_OP_TEMPO_SPEED_UP << 12) | \ + ((u8)(seqPlayerIndex) << 24) | ((u8)(duration) << 16) | (u16)(tempoIncrease)) + +/** + * Decrease the tempo of a sequence by a relative value on a given seqPlayer over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the tempo + * @param tempoDecrease the change to subtract to the current tempo + * + * @note the absolute tempo is constrained to a maximum of 300 + */ +#define SEQCMD_SLOW_DOWN_TEMPO(seqPlayerIndex, duration, tempoDecrease) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_TEMPO_CMD << 28) | (SEQCMD_SUB_OP_TEMPO_SLOW_DOWN << 12) | \ + ((u8)(seqPlayerIndex) << 24) | ((u8)(duration) << 16) | (u16)(tempoDecrease)) + +/** + * Scale the tempo of a sequence by a multiplicative value on a given seqPlayer over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the tempo + * @param tempoScale the scaling factor of the tempo, relative to 100 + * + * @note a tempoScale of 200 will go double-time, 50 will go half-time. + * the absolute tempo is constrained to a maximum of 300 + */ +#define SEQCMD_SCALE_TEMPO(seqPlayerIndex, duration, tempoScale) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_TEMPO_CMD << 28) | (SEQCMD_SUB_OP_TEMPO_SCALE << 12) | ((u8)(seqPlayerIndex) << 24) | \ + ((u8)(duration) << 16) | (u16)(tempoScale)) + +/** + * Reset the tempo of a sequence to the original tempo on a given seqPlayer over a specified duration + * + * @param seqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the tempo + */ +#define SEQCMD_RESET_TEMPO(seqPlayerIndex, duration) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_TEMPO_CMD << 28) | (SEQCMD_SUB_OP_TEMPO_RESET << 12) | ((u8)(seqPlayerIndex) << 24) | \ + ((u8)(duration) << 16)) + +/** + * ==== Audio Sequence Setup Commands ==== + * + * The setup commands are designed to wait to be executed. + * Up to 8 commands can be queued per `seqPlayerIndex`. + * These commands will only execute once that `seqPlayerIndex` is finished playing and is no longer enabled. + * They will often target a different player (`targetSeqPlayerIndex`) but not always. + */ + +/** + * Setup a request to restore a volume on target seqPlayer once a setup seqPlayer is finished playing and disabled + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the volume + */ +#define SEQCMD_SETUP_RESTORE_SEQPLAYER_VOLUME(setupSeqPlayerIndex, targetSeqPlayerIndex, duration) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | (u8)(duration)) + +/** + * Setup a request to unqueue a seqPlayer once that same setup seqPlayer is finished playing and disabled + * + * @param setupSeqPlayerIndex the index of the seqPlayer to unqueue once the same seqPlayer is disabled + * + * @bug this command was misimplemented and fails to unqueue. The command relies on `gActiveSeqs.seqId` for + * unqueueing, but seqId is reset before being used to unqueue. A simple fix is to unqueue based on + * `gActiveSeqs.prevSeqId` instead. + */ +#define SEQCMD_SETUP_UNQUEUE_SEQUENCE(setupSeqPlayerIndex) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_SEQ_UNQUEUE << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24)) + +/** + * Setup a request to restart and play an active sequence currently playing on a target seqPlayer + * once a setup seqPlayer is finished playing and disabled + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to restart its active sequence + */ +#define SEQCMD_SETUP_RESTART_SEQUENCE(setupSeqPlayerIndex, targetSeqPlayerIndex) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_RESTART_SEQ << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16)) + +/** + * Setup a request to scale the tempo of a sequence by a multiplicative value on a target seqPlayer + * once a setup seqPlayer is finished playing and disabled + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the tempo + * @param tempoScale the scaling factor of the tempo, relative to 100 + * + * @note a tempoScale of 200 will go double-time, 50 will go half-time. + * the absolute tempo is constrained to a maximum of 300 + */ +#define SEQCMD_SETUP_SCALE_TEMPO(setupSeqPlayerIndex, targetSeqPlayerIndex, duration, tempoScale) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_TEMPO_SCALE << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | \ + ((u8)(duration) << 8) | (u8)(tempoScale)) + +/** + * Setup a request to reset the tempo of a sequence to the original tempo on a target seqPlayer + * once a setup seqPlayer is finished playing and disabled + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the tempo + */ +#define SEQCMD_SETUP_RESET_TEMPO(setupSeqPlayerIndex, targetSeqPlayerIndex, duration) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_TEMPO_RESET << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | (u8)(duration)) + +/** + * Setup a request to play a sequence on a target seqPlayer once a setup seqPlayer is finished playing and disabled. + * This command is optionally paired with `SEQCMD_SETUP_SET_FADE_IN_TIMER` to set the fade in duration + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to play the sequence + * @param seqId the id of the sequence to play, see `SeqId` + */ +#define SEQCMD_SETUP_PLAY_SEQUENCE(setupSeqPlayerIndex, targetSeqPlayerIndex, seqId) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_PLAY_SEQ << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | (u16)(seqId)) + +/** + * This command is an optional command before `SEQCMD_SETUP_PLAY_SEQUENCE` to set the fade in duration + * (see cmd above) + * + * @param targetSeqPlayerIndex the index of the seqPlayer to play the sequence + * @param fadeInDuration duration the sequence will fade in over + */ +#define SEQCMD_SETUP_SET_FADE_IN_TIMER(targetSeqPlayerIndex, fadeInDuration) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_SET_FADE_TIMER << 20) | \ + ((u8)(targetSeqPlayerIndex) << 24) | ((u8)(fadeInDuration) << 8)) + +/** + * Setup a request to restore a volume on target seqPlayer once a setup seqPlayer is finished playing and disabled. + * Specifically, it will only restore volume if the number of queued requests on the setup seqPlayer matches + * the number of sequences queued + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the volume + * @param numSeqRequests the number of sequence requests queued that must match the actual number of sequence requests + */ +#define SEQCMD_SETUP_RESTORE_SEQPLAYER_VOLUME_IF_QUEUED(setupSeqPlayerIndex, targetSeqPlayerIndex, duration, \ + numSeqRequests) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | \ + (SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME_IF_QUEUED << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | \ + ((u8)(duration) << 8) | (u8)(numSeqRequests)) + +/** + * Setup a request to restore a volume on target seqPlayer once a setup seqPlayer is finished playing and disabled. + * Allows `scaleIndex` to be specified. + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to modify + * @param scaleIndex the scale index of a seqPlayer + * @param duration duration to transition to the volume + */ +#define SEQCMD_SETUP_RESTORE_SEQPLAYER_VOLUME_WITH_SCALE_INDEX(setupSeqPlayerIndex, targetSeqPlayerIndex, scaleIndex, \ + duration) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | \ + (SEQCMD_SUB_OP_SETUP_RESTORE_SEQPLAYER_VOLUME_WITH_SCALE_INDEX << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | \ + ((u8)(scaleIndex) << 8) | (u8)(duration)) + +/** + * Setup a request to disable (or reenable) specific channels on a target seqPlayer + * once a setup seqPlayer is finished playing and disabled. + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to modify + * @param channelMask a 16 bit mask where each bit maps to a channel. Bitflag on to disable + */ +#define SEQCMD_SETUP_SET_CHANNEL_DISABLE_MASK(setupSeqPlayerIndex, targetSeqPlayerIndex, channelMask) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_SET_CHANNEL_DISABLE_MASK << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | (u16)(channelMask)) + +/** + * Queue a request to scale the frequency of an entire sequence on a target seqPlayer + * once a setup seqPlayer is finished playing and disabled. + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param targetSeqPlayerIndex the index of the seqPlayer to modify + * @param duration duration to transition to the frequency + * @param freqScale the scaling factor to shift the pitch. Ranged from 0-0xFF, with 100 mapping to 1.0f + * + * @note The base value for frequency, 100, is 10 times smaller than other frequency commands. + * 200 will double the frequency (raise an octave), 50 will halve the frequency (lower an octave). + */ +#define SEQCMD_SETUP_SET_SEQPLAYER_FREQ(setupSeqPlayerIndex, targetSeqPlayerIndex, duration, freqScale) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_SET_SEQPLAYER_FREQ << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)(targetSeqPlayerIndex) << 16) | \ + ((u8)(duration) << 8) | (u8)(freqScale)) + +/** + * Queue a request to discard audio data by popping an entry from the persistent caches on the audio heap, + * once a setup seqPlayer is finished playing and disabled. + * + * @param setupSeqPlayerIndex the index of the seqPlayer to wait for to be disabled + * @param tableTypeFlag All tables with the flag `(tableTypeFlag & (1 << tableType))` will be discarded. Specifically: + * `(tableTypeFlag & 1)` will discard the `SEQUENCE_TABLE` + * `(tableTypeFlag & 2)` will discard the `FONT_TABLE` + * `(tableTypeFlag & 4)` will discard the `SAMPLE_TABLE` + */ +#define SEQCMD_SETUP_POP_PERSISTENT_CACHE(setupSeqPlayerIndex, tableTypeFlag) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_POP_PERSISTENT_CACHE << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24) | ((u8)tableTypeFlag)) + +/** + * Discard all setup command requests on a seqPlayerIndex by resetting the setup command queue + * + * @param setupSeqPlayerIndex the index of the seqPlayer to disable all setup commands + */ +#define SEQCMD_RESET_SETUP_CMDS(setupSeqPlayerIndex) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_SETUP_CMD << 28) | (SEQCMD_SUB_OP_SETUP_RESET_SETUP_CMDS << 20) | \ + ((u8)(setupSeqPlayerIndex) << 24)) + +/** + * ==== Audio Sequence Global Commands ==== + * + * The global commands will apply to the entire audio system and all 4 sequence players + */ + +/** + * Change the sound mode of audio + * + * @param soundMode see the `SoundMode` enum + */ +#define SEQCMD_SET_SOUND_MODE(soundMode) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_GLOBAL_CMD << 28) | (SEQCMD_SUB_OP_GLOBAL_SET_SOUND_MODE << 8) | (soundMode)) + +/** + * Disable (or reenable) new sequences from starting + * + * @param isDisabled true to disable, false to enable + * + * @note this does not disable the sfx player + */ +#define SEQCMD_DISABLE_PLAY_SEQUENCES(isDisabled) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_GLOBAL_CMD << 28) | (SEQCMD_SUB_OP_GLOBAL_DISABLE_NEW_SEQUENCES << 8) | \ + (u16)(isDisabled)) + +#define SEQCMD_DISABLE_PLAY_SEQUENCES_2(isDisabled) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_GLOBAL_CMD << 28) | (SEQCMD_SUB_OP_GLOBAL_DISABLE_NEW_SEQUENCES_2 << 8) | \ + (u16)(isDisabled)) + +/** + * Restart the audio heap with the specified settings + * + * @param fadeReverb bitmask for reverb indices indicating which reverbs to fade leading into audio heap reset + * @param sfxChannelLayout index for different mappings between the 7 banks and the 16 channels + * @param specId index for the audio specifications to set high-level audio parameters + * + * @note: For sfxChannelLayout, There are 4 possible layouts indexed by 0-3. + * However, only index 0 is properly implemented. Other indices lead to bugs and softlocks. + */ +#define SEQCMD_RESET_AUDIO_HEAP(fadeReverb, sfxChannelLayout, specId) \ + AudioSeq_QueueSeqCmd((SEQCMD_OP_RESET_AUDIO_HEAP << 28) | ((u8)(fadeReverb) << 16) | \ + ((u8)(sfxChannelLayout) << 8) | (u8)(specId)) + +#endif diff --git a/include/sequence.h b/include/sequence.h index 857609d4b..d8a9cd95a 100644 --- a/include/sequence.h +++ b/include/sequence.h @@ -1,8 +1,6 @@ #ifndef SEQUENCE_H #define SEQUENCE_H -#define NA_BGM_STOP 0x100000FF - #define NA_BGM_GENERAL_SFX 0x00 // General Sound Effects #define NA_BGM_AMBIENCE 0x01 // Ambient background noises #define NA_BGM_TERMINA_FIELD 0x02 // Termina Field @@ -133,12 +131,15 @@ #define NA_BGM_END_CREDITS_2 0x82 // The End/Credits II "STAFFROLL2" #define NA_BGM_DISABLED 0xFFFF +#define SEQ_FLAG_ASYNC 0x8000 + typedef enum { /* 0 */ SEQ_PLAYER_BGM_MAIN, /* 1 */ SEQ_PLAYER_FANFARE, /* 2 */ SEQ_PLAYER_SFX, /* 3 */ SEQ_PLAYER_BGM_SUB, /* 4 */ SEQ_PLAYER_AMBIENCE, + /* 5 */ SEQ_PLAYER_MAX, /* 0xFF */ SEQ_PLAYER_INVALID = 0xFF } SequencePlayerId; @@ -161,6 +162,14 @@ typedef enum { } ChannelIOPort; typedef enum { + /* 0 */ VOL_SCALE_INDEX_BGM_MAIN, + /* 1 */ VOL_SCALE_INDEX_FANFARE, + /* 2 */ VOL_SCALE_INDEX_SFX, + /* 3 */ VOL_SCALE_INDEX_BGM_SUB, + /* 4 */ VOL_SCALE_INDEX_MAX +} VolumeScaleIndex; // May be worth using SequencePlayerId instead + +typedef enum { /* 0x0 */ AMBIENCE_CHANNEL_STREAM_0, /* 0x1 */ AMBIENCE_CHANNEL_CRITTER_0, /* 0x2 */ AMBIENCE_CHANNEL_CRITTER_1, @@ -174,7 +183,7 @@ typedef enum { /* 0xD */ AMBIENCE_CHANNEL_SOUND_MODE, /* 0xE */ AMBIENCE_CHANNEL_RAIN, /* 0xF */ AMBIENCE_CHANNEL_LIGHTNING -} AmbienceChannelIndex; // playerIndex = SEQ_PLAYER_AMBIENCE +} AmbienceChannelIndex; // seqPlayerIndex = SEQ_PLAYER_AMBIENCE typedef enum { /* 0x00 */ AMBIENCE_ID_00, @@ -198,7 +207,7 @@ typedef enum { /* 0x12 */ AMBIENCE_ID_12, /* 0x13 */ AMBIENCE_ID_13, /* 0xFF */ AMBIENCE_ID_DISABLED = 0xFF -} AmbienceId; // playerIndex = SEQ_PLAYER_AMBIENCE +} AmbienceId; // seqPlayerIndex = SEQ_PLAYER_AMBIENCE typedef enum { /* 0x00 */ AMBIENCE_STREAM_0, diff --git a/include/variables.h b/include/variables.h index 9ce8d04d5..745c019a8 100644 --- a/include/variables.h +++ b/include/variables.h @@ -995,14 +995,9 @@ extern u8 gSfxChannelLayout; extern Vec3f gSfxDefaultPos; extern f32 gSfxDefaultFreqAndVolScale; extern s8 gSfxDefaultReverb; -// extern UNK_TYPE1 D_801DB4C0; -// extern UNK_TYPE1 D_801DB4C4; -// extern UNK_TYPE1 D_801DB4C8; -// extern UNK_TYPE1 D_801DB4CC; extern u8 gAudioSpecId; -// extern UNK_TYPE1 D_801DB4D8; -// extern UNK_TYPE4 D_801DB4DC; -extern ReverbSettings* gReverbSettingsTable[]; +extern u8 gAudioHeapResetState; +extern ReverbSettings* gReverbSettingsTable[10]; extern AudioSpec gAudioSpecs[21]; // rodata @@ -2669,38 +2664,14 @@ extern s32 D_801FD120; // extern UNK_TYPE1 D_801FD5E8; // extern UNK_TYPE1 D_801FD608; // extern UNK_TYPE1 D_801FD610; -// extern UNK_TYPE1 sSfxPlayerBank; -// extern UNK_TYPE1 sSfxItemBank; -// extern UNK_TYPE1 sSfxEnvironmentBank; -// extern UNK_TYPE1 sSfxEnemyBank; -// extern UNK_TYPE1 sSfxSystemBank; -// extern UNK_TYPE1 sSfxOcarinaBank; -// extern UNK_TYPE1 sSfxVoiceBank; -// extern SfxRequest sSfxRequests[0x100]; -// extern UNK_TYPE1 sSfxBankListEnd; -// extern UNK_TYPE1 sSfxBankFreeListStart; -// extern UNK_TYPE1 sSfxBankUnused; extern ActiveSfx gActiveSfx[7][3]; -// extern UNK_TYPE1 sCurSfxPlayerChannelIndex; -// extern UNK_TYPE1 gSfxBankMuted; -// extern UNK_TYPE1 sUnusedBankLerp; -// extern UNK_TYPE1 D_801FFD00; -// extern UNK_TYPE1 D_801FFD34; -// extern UNK_TYPE1 D_801FFD40; -// extern UNK_TYPE1 D_80200000; -// extern UNK_TYPE1 D_80200002; -// extern UNK_TYPE1 D_80200004; -// extern UNK_TYPE1 D_80200008; -// extern UNK_TYPE1 D_8020001E; -// extern UNK_TYPE1 D_802000C9; -// extern UNK_TYPE1 D_802000D4; +extern SeqRequest sSeqRequests[][5]; +extern u8 sNumSeqRequests[5]; +extern u32 sAudioSeqCmds[0xB0]; extern ActiveSequence gActiveSeqs[]; -// extern UNK_TYPE1 D_8020034A; -// extern UNK_TYPE1 D_80200B88; -// extern UNK_TYPE1 D_80200BBA; -// extern UNK_TYPE1 D_80200BCC; -// extern UNK_TYPE1 D_80200BCE; -// extern UNK_TYPE1 D_80200BD0; +extern u8 sResetAudioHeapTimer; +extern u16 sResetAudioHeapFadeReverbVolume; +extern u16 sResetAudioHeapFadeReverbVolumeStep; extern AudioContext gAudioCtx; // at 0x80200C70 extern AudioCustomUpdateFunction gAudioCustomUpdateFunction; extern AudioCustomSeqFunction gAudioCustomSeqFunction; diff --git a/include/z64.h b/include/z64.h index 6e8e72938..b91333288 100644 --- a/include/z64.h +++ b/include/z64.h @@ -20,6 +20,7 @@ #include "color.h" #include "ichain.h" #include "sequence.h" +#include "seqcmd.h" #include "sfx.h" #include "message_data_static.h" diff --git a/include/z64audio.h b/include/z64audio.h index ca54d2345..a37760566 100644 --- a/include/z64audio.h +++ b/include/z64audio.h @@ -12,6 +12,12 @@ #define SEQ_IO_VAL_NONE -1 typedef enum { + /* 0 */ AUDIO_HEAP_RESET_STATE_NONE, + /* 1 */ AUDIO_HEAP_RESET_STATE_RESETTING, + /* 2 */ AUDIO_HEAP_RESET_STATE_RESETTING_ALT // Never set to +} AudioHeapResetState; + +typedef enum { /* 0x00 */ AUDIO_CUSTOM_FUNCTION_SEQ_0, /* 0x01 */ AUDIO_CUSTOM_FUNCTION_SEQ_1, /* 0x02 */ AUDIO_CUSTOM_FUNCTION_SEQ_2, @@ -1090,50 +1096,50 @@ typedef struct { } AudioHeapInitSizes; // size = 0xC typedef struct { - /* 0x00 */ f32 unk_00; - /* 0x04 */ f32 unk_04; - /* 0x08 */ f32 unk_08; - /* 0x0C */ f32 unk_10; - /* 0x10 */ f32 unk_14; - /* 0x14 */ f32 unk_18; - /* 0x18 */ u16 unk_0C; - /* 0x1A */ u16 unk_1C; -} unk_50_s; // size = 0x1C + /* 0x00 */ f32 volCur; + /* 0x04 */ f32 volTarget; + /* 0x08 */ f32 volStep; + /* 0x0C */ f32 freqScaleCur; + /* 0x10 */ f32 freqScaleTarget; + /* 0x14 */ f32 freqScaleStep; + /* 0x18 */ u16 volTimer; + /* 0x1A */ u16 freqScaleTimer; +} ActiveSequenceChannelData; // size = 0x1C typedef struct { - /* 0x000 */ unk_50_s unk_50[0x10]; + /* 0x000 */ ActiveSequenceChannelData channelData[SEQ_NUM_CHANNELS]; /* 0x1C0 */ f32 volCur; /* 0x1C4 */ f32 volTarget; - /* 0x1C8 */ f32 unk_08; - /* 0x1CC */ u32 unk_14; - /* 0x1D0 */ f32 unk_1C; - /* 0x1D4 */ f32 unk_20; - /* 0x1D8 */ f32 unk_24; - /* 0x1DC */ u32 unk_2C[8]; - /* 0x1FC */ u32 unk_25C; - /* 0x200 */ u16 unk_0C; - /* 0x202 */ u16 unk_18; - /* 0x204 */ u16 unk_28; - /* 0x206 */ u16 unk_250; - /* 0x208 */ u16 unk_252; + /* 0x1C8 */ f32 volStep; + /* 0x1CC */ u32 tempoCmd; + /* 0x1D0 */ f32 tempoCur; + /* 0x1D4 */ f32 tempoTarget; + /* 0x1D8 */ f32 tempoStep; + /* 0x1DC */ u32 setupCmd[8]; // setup commands + /* 0x1FC */ u32 startAsyncSeqCmd; // temporarily stores the seqCmd used in SEQCMD_PLAY_SEQUENCE, to be called again once the font is reloaded in + /* 0x200 */ u16 volTimer; + /* 0x202 */ u16 tempoOriginal; + /* 0x204 */ u16 tempoTimer; + /* 0x206 */ u16 freqScaleChannelFlags; + /* 0x208 */ u16 volChannelFlags; /* 0x20A */ u16 seqId; - /* 0x20C */ u16 unk_256; - /* 0x20E */ u16 unk_258; - /* 0x210 */ u8 unk_260; - /* 0x211 */ u8 unk_261[0x1]; - /* 0x212 */ u8 volScales[0x4]; + /* 0x20C */ u16 prevSeqId; // last seqId played on a player + /* 0x20E */ u16 channelPortMask; + /* 0x210 */ u8 isWaitingForFonts; + /* 0x211 */ u8 fontId; + /* 0x212 */ u8 volScales[VOL_SCALE_INDEX_MAX]; /* 0x216 */ u8 volFadeTimer; /* 0x217 */ u8 fadeVolUpdate; - /* 0x218 */ u8 unk_4C; - /* 0x219 */ u8 unk_4D; - /* 0x21A */ u8 unk_4E; - /* 0x21B */ u8 unk_21B; + /* 0x218 */ u8 setupCmdTimer; + /* 0x219 */ u8 setupCmdNum; // number of setup commands + /* 0x21A */ u8 setupFadeTimer; + /* 0x21B */ u8 isSeqPlayerInit; } ActiveSequence; // size = 0x21C typedef struct { - /* 0x0 */ u8 unk_0; - /* 0x1 */ u8 unk_1; // importance? -} Struct_8016E320; // size = 0x02 + /* 0x0 */ u8 seqId; + /* 0x1 */ u8 priority; +} SeqRequest; // size = 0x02 typedef enum { /* 0 */ BANK_PLAYER, |
