Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

audio_seqplayer.c OK and partial docs #833

Merged
merged 13 commits into from
Jul 22, 2022
40 changes: 7 additions & 33 deletions include/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -3242,8 +3242,8 @@ void AudioLoad_AsyncLoadFont(s32 fontId, s32 arg1, s32 retData, OSMesgQueue* ret
u8* AudioLoad_GetFontsForSequence(s32 seqId, u32* outNumFonts);
void AudioLoad_DiscardSeqFonts(s32 seqId);
void func_8018FA60(u32 tableType, u32 id, s32 arg2, s32 arg3);
s32 AudioLoad_SyncIniPlayer(s32 playerIdx, s32 seqId, s32 arg2);
s32 AudioLoad_SyncInitSetSeqqPlayerSkipTicks(s32 playerIdx, s32 seqId, s32 skipTicks);
s32 AudioLoad_SyncInitSeqPlayer(s32 playerIndex, s32 seqId, s32 arg2);
s32 AudioLoad_SyncInitSeqPlayerSkipTicks(s32 playerIndex, s32 seqId, s32 skipTicks);
void AudioLoad_ProcessLoads(s32 resetStatus);
void AudioLoad_SetDmaHandler(DmaHandler callback);
void AudioLoad_Init(void* heap, u32 heapSize);
Expand Down Expand Up @@ -3318,41 +3318,15 @@ void AudioEffects_NoteVibratoInit(Note* note);
void AudioEffects_NotePortamentoInit(Note* note);
void AudioEffects_AdsrInit(AdsrState* adsr, AdsrEnvelope* envelope, s16* volOut);
f32 AudioEffects_AdsrUpdate(AdsrState* adsr);
// void func_801974D0(void);
// void func_80197538(void);
// void func_80197714(void);
// void func_80197880(void);
// void func_801979D8(void);
// void func_80197A54(void);
void AudioSeq_SequenceChannelDisable(SequenceChannel* channel);
// void func_80197B14(void);
// void func_80197C0C(void);
// void func_80197C8C(void);
void AudioSeq_SequencePlayerDisableAsFinished(SequencePlayer* seqPlayer);
void AudioSeq_SequencePlayerDisable(SequencePlayer* seqPlayer);
void AudioSeq_AudioListPushBack(AudioListItem* list, AudioListItem* item);
void* AudioSeq_AudioListPopBack(AudioListItem* list);
// void func_80197E88(void);
// void func_80197F28(void);
// void func_80197F3C(void);
// void func_80197F74(void);
// void func_80197FB4(void);
// void func_801980D0(void);
// void func_8019815C(void);
// void func_8019825C(void);
// void func_80198640(void);
// void func_80198CE0(void);
// void func_801990F4(void);
// void func_80199124(void);
// void func_80199198(void);
// void func_80199244(void);
void func_80199268(s32* param_1);
// void func_8019A0BC(void);
// void func_8019AA3C(void);
// void func_8019AAF0(void);
void AudioSeq_ProcessSequences(s32 arg0);
void AudioSeq_SkipForwardSequence(SequencePlayer* seqPlayer);
void AudioSeq_ResetSequencePlayer(SequencePlayer* seqPlayer);
void AudioSeq_InitSequencePlayerChannels(s32 playerIdx);
// void func_8019ACEC(void);
void AudioSeq_InitSequencePlayerChannels(s32 playerIndex);
void AudioSeq_InitSequencePlayers(void);
void func_8019AE40(s32 param_1, s32 param_2, u32 param_3, s32 param_4);
void func_8019AEC0(UNK_PTR param_1, UNK_PTR param_2);
Expand Down Expand Up @@ -3474,7 +3448,7 @@ void func_801A1DB8(Vec3f* vec, u8 seqId, f32 arg2);
// void func_801A1E0C(void);
void func_801A1F00(u8 arg0, u16 seqId);
void func_801A1F88(void);
void func_801A1FB4(u8 playerIdx, Vec3f* pos, u16 seqId, f32 maxDist);
void func_801A1FB4(u8 playerIndex, Vec3f* pos, u16 seqId, f32 maxDist);
// void func_801A2090(void);
void func_801A246C(u8 param_1, u8 param_2);
// void func_801A2544(void);
Expand Down Expand Up @@ -3592,7 +3566,7 @@ void Audio_QueueSeqCmd(u32 cmd);
// void func_801A89D0(void);
s32 func_801A8A50(s32 param1);
// void func_801A8ABC(void);
void Audio_SetVolumeScale(u8 playerIdx, u8 scaleIdx, u8 targetVol, u8 volFadeTimer);
void Audio_SetVolumeScale(u8 playerIndex, u8 scaleIndex, u8 targetVol, u8 volFadeTimer);
// void func_801A8D5C(void);
// void func_801A8E90(void);
// void func_801A9768(void);
Expand Down
14 changes: 5 additions & 9 deletions include/variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -1580,16 +1580,12 @@ extern s16 gHighPassFilterData[];
extern s16 gBandStopFilterData[];
extern s16 gBandPassFilterData[];
extern s16* gWaveSamples[9];
extern UNK_PTR D_801D4D98;
extern UNK_PTR D_801D4DB0;
extern f32 gBendPitchOneOctaveFrequencies[256];
// extern UNK_TYPE1 D_801D4FB4;
// extern UNK_TYPE4 gBendPitchTwoSemitonesFrequencies;
// extern UNK_TYPE4 D_801D53B4;
// extern UNK_TYPE1 gPitchFrequencies;
// extern UNK_TYPE1 gDefaultShortNoteVelocityTable;
// extern UNK_TYPE1 gDefaultShortNoteGateTimeTable;
// extern UNK_TYPE1 gDefaultEnvelope;
extern f32 gBendPitchTwoSemitonesFrequencies[];
extern f32 gPitchFrequencies[];
extern u8 gDefaultShortNoteVelocityTable[];
extern u8 gDefaultShortNoteGateTimeTable[];
extern AdsrEnvelope gDefaultEnvelope[];
extern NoteSubEu gZeroNoteSub;
extern NoteSubEu gDefaultNoteSub;
extern u16 gHeadsetPanQuantization[];
Expand Down
32 changes: 16 additions & 16 deletions include/z64audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ typedef enum {
} AudioCacheType;

typedef enum {
/* 0 */ LOAD_STATUS_0,
/* 1 */ LOAD_STATUS_1,
/* 2 */ LOAD_STATUS_2, // Samples/Seqplayer
/* 3 */ LOAD_STATUS_3, // Sequences
/* 4 */ LOAD_STATUS_4, // SoundFonts
/* 5 */ LOAD_STATUS_5 // Permanent
/* 0 */ LOAD_STATUS_NOT_LOADED,
Kenix3 marked this conversation as resolved.
Show resolved Hide resolved
/* 1 */ LOAD_STATUS_IN_PROGRESS,
/* 2 */ LOAD_STATUS_COMPLETE,
/* 3 */ LOAD_STATUS_DISCARDABLE,
/* 4 */ LOAD_STATUS_MAYBE_DISCARDABLE,
/* 5 */ LOAD_STATUS_PERMANENTLY_LOADED
engineer124 marked this conversation as resolved.
Show resolved Hide resolved
} AudioLoadStatus;

typedef s32 (*DmaHandler)(OSPiHandle* handle, OSIoMesg* mb, s32 direction);
Expand Down Expand Up @@ -231,15 +231,15 @@ typedef struct {
/* 0x00 */ u8 loaded;
/* 0x01 */ u8 normalRangeLo;
/* 0x02 */ u8 normalRangeHi;
/* 0x03 */ u8 releaseRate;
/* 0x03 */ u8 adsrDecayIndex; // index used to obtain adsr decay rate from adsrDecayTable
engineer124 marked this conversation as resolved.
Show resolved Hide resolved
/* 0x04 */ AdsrEnvelope* envelope;
/* 0x08 */ SoundFontSound lowNotesSound;
/* 0x10 */ SoundFontSound normalNotesSound;
/* 0x18 */ SoundFontSound highNotesSound;
} Instrument; // size = 0x20

typedef struct {
/* 0x00 */ u8 releaseRate;
/* 0x00 */ u8 adsrDecayIndex; // index used to obtain adsr decay rate from adsrDecayTable
/* 0x01 */ u8 pan;
/* 0x02 */ u8 loaded;
/* 0x04 */ SoundFontSound sound;
Expand Down Expand Up @@ -281,7 +281,7 @@ typedef struct {
/* 0x004 */ u8 seqId;
/* 0x005 */ u8 defaultFont;
/* 0x006 */ u8 unk_06[1];
/* 0x007 */ s8 playerIdx;
/* 0x007 */ s8 playerIndex;
/* 0x008 */ u16 tempo; // tatums per minute
/* 0x00A */ u16 tempoAcc;
/* 0x00C */ s16 unk_0C;
Expand Down Expand Up @@ -313,7 +313,7 @@ typedef struct {
} SequencePlayer; // size = 0x160

typedef struct {
/* 0x0 */ u8 releaseRate;
/* 0x0 */ u8 decayIndex; // index used to obtain adsr decay rate from adsrDecayTable
/* 0x1 */ u8 sustain;
/* 0x4 */ AdsrEnvelope* envelope;
} AdsrSettings; // size = 0x8
Expand Down Expand Up @@ -356,7 +356,7 @@ typedef union {

typedef struct {
/* 0x00 */ u8 reverb;
/* 0x01 */ u8 unk_1;
/* 0x01 */ u8 gain; // Increases volume by a multiplicative scaling factor. Represented as a UQ4.4 number
/* 0x02 */ u8 pan;
/* 0x03 */ u8 unk_3; // Possibly part of stereo?
/* 0x04 */ Stereo stereo;
Expand Down Expand Up @@ -406,7 +406,7 @@ typedef struct SequenceChannel {
/* 0x09 */ u8 bookOffset;
/* 0x0A */ u8 newPan;
/* 0x0B */ u8 panChannelWeight; // proportion of pan that comes from the channel (0..128)
/* 0x0C */ u8 unk_0C;
/* 0x0C */ u8 gain; // Increases volume by a multiplicative scaling factor. Represented as a UQ4.4 number
/* 0x0D */ u8 velocityRandomVariance;
/* 0x0E */ u8 gateTimeRandomVariance;
/* 0x0F */ u8 unk_0F;
Expand Down Expand Up @@ -434,7 +434,7 @@ typedef struct SequenceChannel {
/* 0x80 */ AdsrSettings adsr;
/* 0x88 */ NotePool notePool;
/* 0xC8 */ s8 soundScriptIO[8]; // bridge between sound script and audio lib, "io ports"
/* 0xD0 */ u8* unk_D0; // New to MM
/* 0xD0 */ u8* sfxState; // New to MM
engineer124 marked this conversation as resolved.
Show resolved Hide resolved
/* 0xD4 */ s16* filter;
/* 0xD8 */ Stereo stereo;
/* 0xDC */ s32 unk_DC; // New to MM
Expand Down Expand Up @@ -596,7 +596,7 @@ typedef struct {
/* 0x01 */ u8 hasTwoParts : 1;
/* 0x01 */ u8 usesHeadsetPanEffects2 : 1;
} bitField1;
/* 0x02 */ u8 unk_2;
/* 0x02 */ u8 gain; // Increases volume by a multiplicative scaling factor. Represented as a UQ4.4 number
/* 0x03 */ u8 headsetPanRight;
/* 0x04 */ u8 headsetPanLeft;
/* 0x05 */ u8 reverbVol;
Expand Down Expand Up @@ -965,7 +965,7 @@ typedef struct {
/* 0x4448 */ volatile u8 resetStatus;
/* 0x4449 */ u8 audioResetSpecIdToLoad;
/* 0x444C */ s32 audioResetFadeOutFramesLeft;
/* 0x4450 */ f32* unk_3520; // fadeOutVelocities for ADSR
/* 0x4450 */ f32* adsrDecayTable; // A table on the audio heap that stores decay rates used for adsr
engineer124 marked this conversation as resolved.
Show resolved Hide resolved
/* 0x4454 */ u8* audioHeap;
/* 0x4458 */ size_t audioHeapSize;
/* 0x445C */ Note* notes;
Expand Down Expand Up @@ -994,7 +994,7 @@ typedef struct {

typedef struct {
/* 0x00 */ u8 reverbVol;
/* 0x01 */ u8 unk_1;
/* 0x01 */ u8 gain; // Increases volume by a multiplicative scaling factor. Represented as a UQ4.4 number
/* 0x02 */ u8 pan;
/* 0x03 */ u8 unk_3;
/* 0x04 */ Stereo stereo;
Expand Down
1 change: 0 additions & 1 deletion spec
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,6 @@ beginseg
include "build/src/code/audio/audio_playback.o"
include "build/src/code/audio/audio_effects.o"
include "build/src/code/audio/audio_seqplayer.o"
include "build/data/code/audio_seqplayer.data.o"
include "build/data/code/audio_dramStack.data.o"
include "build/asm/code/code_8019AE40.text.o" // handwritten
pad_text
Expand Down
Loading