mirror of
https://github.com/zeldaret/mm.git
synced 2026-08-04 01:02:54 -04:00
Audio_Load OK and Documented (#620)
* Copy audio_load progress from main branch * Fix warning * fix UB * cleanup WIP * Add docs, bss still broken * bss fix * bytesRemaining with size_t * PR Suggestions * PR Suggestions * Fix bss * Fix bss * PR Suggestions
This commit is contained in:
+46
-91
@@ -7,8 +7,8 @@ void bootproc(void);
|
||||
void Idle_ThreadEntry(void* arg);
|
||||
void ViConfig_UpdateVi(u32 arg0);
|
||||
void ViConfig_UpdateBlack(void);
|
||||
s32 DmaMgr_DMARomToRam(u32 src, void* dst, size_t size);
|
||||
void DmaMgr_DmaCallback0(OSPiHandle* piHandle, OSIoMesg* mb, s32 direction);
|
||||
s32 DmaMgr_DmaRomToRam(u32 src, void* dst, size_t size);
|
||||
s32 DmaMgr_DmaHandler(OSPiHandle* piHandle, OSIoMesg* mb, s32 direction);
|
||||
DmaEntry* DmaMgr_FindDmaEntry(u32 vromAddr);
|
||||
u32 DmaMgr_TranslateVromToRom(u32 vromAddr);
|
||||
s32 DmaMgr_FindDmaIndex(u32 vromAddr);
|
||||
@@ -3304,27 +3304,27 @@ s32 osFlashReadArray(OSIoMesg* mb, s32 priority, u32 pageNum, void* dramAddr, u3
|
||||
// void func_8018B0F0(void);
|
||||
// void func_8018B10C(void);
|
||||
// void func_8018B250(void);
|
||||
// void func_8018B318(void);
|
||||
void AudioHeap_DiscardFont(s32 fontId);
|
||||
// void func_8018B474(void);
|
||||
// void func_8018B4F8(void);
|
||||
void* AudioHeap_WritebackDCache(void* mem, size_t size);
|
||||
// void func_8018B520(void);
|
||||
// void func_8018B578(void);
|
||||
void* AudioHeap_AllocAttemptExternal(AudioAllocPool* pool, size_t size);
|
||||
void* AudioHeap_AllocDmaMemory(AudioAllocPool* pool, u32 size);
|
||||
// void func_8018B608(void);
|
||||
// void func_8018B640(void);
|
||||
void* AudioHeap_AllocZeroed(AudioAllocPool* pool, size_t size);
|
||||
// void func_8018B69C(void);
|
||||
// void func_8018B6E8(void);
|
||||
// void func_8018B740(void);
|
||||
void* AudioHeap_Alloc(AudioAllocPool* pool, size_t size);
|
||||
void AudioHeap_AllocPoolInit(AudioAllocPool* pool, void* mem, size_t size);
|
||||
// void func_8018B768(void);
|
||||
// void func_8018B77C(void);
|
||||
// void func_8018B7BC(void);
|
||||
// void func_8018B8FC(void);
|
||||
void AudioHeap_InitMainPool(s32 initPoolSize);
|
||||
// void func_8018B95C(void);
|
||||
// void func_8018B9E0(void);
|
||||
// void func_8018BA64(void);
|
||||
// void func_8018BB28(void);
|
||||
// void func_8018BBEC(void);
|
||||
// void func_8018C380(void);
|
||||
void* AudioHeap_AllocCached(s32 tableType, size_t size, s32 cache, s32 id);
|
||||
void* AudioHeap_SearchCaches(s32 tableType, s32 cache, s32 id);
|
||||
// void func_8018C3D8(void);
|
||||
// void func_8018C8E8(void);
|
||||
// void func_8018C93C(void);
|
||||
@@ -3332,11 +3332,11 @@ void* AudioHeap_AllocDmaMemory(AudioAllocPool* pool, u32 size);
|
||||
// void func_8018CB70(void);
|
||||
// void func_8018CB78(void);
|
||||
// void func_8018CC3C(void);
|
||||
// void func_8018CCA8(void);
|
||||
s32 AudioHeap_ResetStep(void);
|
||||
// void func_8018CFAC(void);
|
||||
// void func_8018D57C(void);
|
||||
// void func_8018D5D4(void);
|
||||
// void func_8018D658(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5);
|
||||
void* AudioHeap_SearchPermanentCache(s32 tableType, s32 id);
|
||||
void* AudioHeap_AllocPermanent(s32 tableType, s32 id, size_t size);
|
||||
void* AudioHeap_AllocSampleCache(size_t size, s32 fontId, void* sampleAddr, s8 medium, s32 cache);
|
||||
// void func_8018D6C8(void);
|
||||
// void func_8018D760(void);
|
||||
// void func_8018DA50(void);
|
||||
@@ -3347,84 +3347,39 @@ void* AudioHeap_AllocDmaMemory(AudioAllocPool* pool, u32 size);
|
||||
// void func_8018DDD4(void);
|
||||
// void func_8018DF24(void);
|
||||
// void func_8018DFE0(void);
|
||||
// void func_8018E00C(void);
|
||||
void AudioHeap_ApplySampleBankCache(s32 sampleBankId);
|
||||
// void func_8018E03C(void);
|
||||
// void func_8018E2A8(void);
|
||||
// void func_8018E344(void);
|
||||
// void func_8018E8C8(void);
|
||||
// void func_8018EB60(void);
|
||||
// void func_8018EC4C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5);
|
||||
// void func_8018EF88(void);
|
||||
s32 AudioLoad_IsFontLoadComplete(s32 bankId);
|
||||
// void func_8018F298(void);
|
||||
// void func_8018F310(void);
|
||||
// void func_8018F388(void);
|
||||
// void func_8018F3B8(void);
|
||||
// void func_8018F3E8(void);
|
||||
// void func_8018F448(void);
|
||||
// void func_8018F478(void);
|
||||
// void func_8018F4D8(void);
|
||||
// void func_8018F588(void);
|
||||
// void func_8018F604(void);
|
||||
// void func_8018F6F0(void);
|
||||
// void func_8018F7C0(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5);
|
||||
// void func_8018F7F8(void);
|
||||
// void func_8018F83C(void);
|
||||
// void func_8018F880(void);
|
||||
// void func_8018F8C4(void);
|
||||
// void func_8018F908(void);
|
||||
// void func_8018F9B8(void);
|
||||
// void func_8018FA60(void);
|
||||
// void func_8018FAD0(void);
|
||||
// void func_8018FB20(void);
|
||||
// void func_8018FB78(void);
|
||||
// void func_8018FCCC(void);
|
||||
// void func_8018FD20(void);
|
||||
// void func_8018FD40(void);
|
||||
// void func_8018FE5C(void);
|
||||
// void func_8018FF60(void);
|
||||
// void func_80190204(void);
|
||||
// void func_80190240(void);
|
||||
// void func_80190294(void);
|
||||
// void func_801902D8(void);
|
||||
// void func_80190544(void);
|
||||
// void func_80190668(void);
|
||||
// void func_8019067C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8);
|
||||
// void func_8019075C(void);
|
||||
// void func_8019077C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5);
|
||||
// void func_80190B08(void);
|
||||
void func_80190B38(void* callback);
|
||||
// void func_80190B50(void);
|
||||
// void func_80190BB0(void);
|
||||
// void func_80190F50(void);
|
||||
// void func_80190F64(void);
|
||||
// void func_80191134(void);
|
||||
// void func_801911CC(void);
|
||||
// void func_80191240(void);
|
||||
// void func_801913C8(void);
|
||||
// void func_8019144C(void);
|
||||
// void func_80191460(void);
|
||||
// void func_80191568(void);
|
||||
// void func_80191598(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8);
|
||||
// void func_8019161C(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7);
|
||||
// void func_80191740(void);
|
||||
// void func_80191864(void);
|
||||
// void func_80191870(void);
|
||||
// void func_801919AC(void);
|
||||
// void func_80191B40(void);
|
||||
// void func_80191BD0(void);
|
||||
// void func_80191C40(void);
|
||||
// void func_80191C54(void);
|
||||
// void func_80191D94(void);
|
||||
// void func_8019218C(void);
|
||||
// void func_80192340(void);
|
||||
// void func_80192388(void);
|
||||
// void func_801924BC(void);
|
||||
// void func_80192514(void);
|
||||
// void func_80192990(void);
|
||||
// void func_80192AE8(void);
|
||||
// void func_80192B54(void);
|
||||
// void func_80192BAC(void);
|
||||
void AudioLoad_DecreaseSampleDmaTtls(void);
|
||||
void* AudioLoad_DmaSampleData(uintptr_t devAddr, size_t size, s32 arg2, u8* dmaIndexRef, s32 medium);
|
||||
void AudioLoad_InitSampleDmaBuffers(s32 numNotes);
|
||||
s32 AudioLoad_IsFontLoadComplete(s32 fontId);
|
||||
s32 AudioLoad_IsSeqLoadComplete(s32 seqId);
|
||||
void AudioLoad_SetFontLoadStatus(s32 fontId, s32 status);
|
||||
void AudioLoad_SetSeqLoadStatus(s32 seqId, s32 status);
|
||||
void AudioLoad_SyncLoadSeqParts(s32 seqId, s32 arg1, s32 arg2, OSMesgQueue* arg3);
|
||||
s32 AudioLoad_SyncLoadInstrument(s32 fontId, s32 instId, s32 drumId);
|
||||
void AudioLoad_AsyncLoadSeq(s32 seqId, s32 arg1, s32 retData, OSMesgQueue* retQueue);
|
||||
void AudioLoad_AsyncLoadSampleBank(s32 sampleBankId, s32 arg1, s32 retData, OSMesgQueue* retQueue);
|
||||
void AudioLoad_AsyncLoadFont(s32 fontId, s32 arg1, s32 retData, OSMesgQueue* retQueue);
|
||||
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);
|
||||
void AudioLoad_ProcessLoads(s32 resetStatus);
|
||||
void AudioLoad_SetDmaHandler(DmaHandler callback);
|
||||
void AudioLoad_Init(void* heap, u32 heapSize);
|
||||
void AudioLoad_InitSlowLoads(void);
|
||||
s32 AudioLoad_SlowLoadSample(s32 fontId, s32 instId, s8* isDone);
|
||||
s32 AudioLoad_SlowLoadSeq(s32 seqId, u8* ramAddr, s8* isDone);
|
||||
void AudioLoad_InitAsyncLoads(void);
|
||||
void AudioLoad_LoadPermanentSamples(void);
|
||||
void AudioLoad_ScriptLoad(s32 tableType, s32 id, s8* isDone);
|
||||
void AudioLoad_ProcessScriptLoads(void);
|
||||
void AudioLoad_InitScriptLoads(void);
|
||||
AudioTask* func_80192BE0(void);
|
||||
// void func_80192C00(void);
|
||||
// void func_8019319C(void);
|
||||
@@ -3459,7 +3414,7 @@ AudioTask* func_80192BE0(void);
|
||||
// void func_80194548(void);
|
||||
// void func_80194568(void);
|
||||
// void func_80194668(void);
|
||||
// void func_801946E4(void);
|
||||
void Audio_InitMesgQueues(void);
|
||||
void Audio_InvalDCache(void* buf, size_t size);
|
||||
void Audio_WritebackDCache(void* buf, size_t size);
|
||||
// void func_80194790(void);
|
||||
@@ -3520,7 +3475,7 @@ void func_80199268(s32* param_1);
|
||||
// void func_8019A0BC(void);
|
||||
// void func_8019AA3C(void);
|
||||
// void func_8019AAF0(void);
|
||||
// void func_8019AB40(void);
|
||||
void AudioSeq_ResetSequencePlayer(SequencePlayer* seqPlayer);
|
||||
// void func_8019AC10(void);
|
||||
// void func_8019ACEC(void);
|
||||
// void func_8019ADBC(void);
|
||||
|
||||
@@ -153,6 +153,7 @@ extern GraphicsContext* __gfxCtx;
|
||||
#define ALIGN8(val) (((val) + 7) & ~7)
|
||||
#define ALIGN16(val) (((val) + 0xF) & ~0xF)
|
||||
#define ALIGN64(val) (((val) + 0x3F) & ~0x3F)
|
||||
#define ALIGN256(val) (((val) + 0xFF) & ~0xFF)
|
||||
|
||||
#define SQ(x) ((x) * (x))
|
||||
#define ABS(x) ((x) >= 0 ? (x) : -(x))
|
||||
|
||||
+9
-9
@@ -1656,7 +1656,7 @@ extern f32 gDefaultPanVolume[];
|
||||
// extern UNK_TYPE1 D_801D5FD4;
|
||||
extern UNK_PTR D_801D5FE0;
|
||||
// extern UNK_TYPE1 D_801D5FE4;
|
||||
// extern UNK_TYPE4 D_801D5FE8;
|
||||
extern s32 gAudioContextInitalized;
|
||||
// extern UNK_TYPE4 D_801D5FEC;
|
||||
// extern UNK_TYPE4 D_801D5FF0;
|
||||
// extern UNK_TYPE4 D_801D5FF4;
|
||||
@@ -3070,10 +3070,10 @@ extern const s16 gAudioTatumInit[];
|
||||
extern const AudioContextInitSizes gAudioContextInitSizes;
|
||||
// extern UNK_TYPE4 D_801E1108;
|
||||
// extern UNK_TYPE4 D_801E110C;
|
||||
// extern UNK_TYPE2 gSoundFontTable;
|
||||
// extern UNK_TYPE1 gSequenceFontTable;
|
||||
// extern UNK_TYPE2 gSequenceTable;
|
||||
// extern UNK_TYPE1 gSampleBankTable;
|
||||
extern u8 gSoundFontTable[];
|
||||
extern u8 gSequenceFontTable[];
|
||||
extern u8 gSequenceTable[];
|
||||
extern u8 gSampleBankTable[];
|
||||
extern u64 aspMainDataStart[];
|
||||
|
||||
// bss
|
||||
@@ -3593,10 +3593,10 @@ extern SoundRequest D_801FE7C0[1];
|
||||
// extern UNK_TYPE1 D_80200BCE;
|
||||
// extern UNK_TYPE1 D_80200BD0;
|
||||
extern AudioContext gAudioContext; // at 0x80200C70
|
||||
// extern UNK_TYPE4 D_80208E68;
|
||||
// extern UNK_TYPE4 D_80208E6C;
|
||||
// extern UNK_TYPE4 D_80208E70;
|
||||
// extern UNK_TYPE4 D_80208E74;
|
||||
extern void (*D_80208E68)(void);
|
||||
extern u32 (*D_80208E6C)(s8 value, SequenceChannel* channel);
|
||||
extern s32 (*D_80208E70)(SoundFontSample*, s32, s8, s32);
|
||||
extern Acmd* (*D_80208E74)(Acmd*, s32, s32);
|
||||
|
||||
// post-code buffers
|
||||
extern u8 gGfxSPTaskYieldBuffer[OS_YIELD_DATA_SIZE];
|
||||
|
||||
+125
-90
@@ -49,11 +49,10 @@ typedef enum {
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ MEDIUM_RAM,
|
||||
/* 1 */ MEDIUM_UNK1,
|
||||
/* 1 */ MEDIUM_UNK,
|
||||
/* 2 */ MEDIUM_CART,
|
||||
/* 3 */ MEDIUM_DISK_DRIVE,
|
||||
/* 4 */ MEDIUM_UNK4,
|
||||
/* 5 */ MEDIUM_UNK5
|
||||
/* 5 */ MEDIUM_RAM_UNLOADED = 5
|
||||
} SampleMedium;
|
||||
|
||||
typedef enum {
|
||||
@@ -71,6 +70,14 @@ typedef enum {
|
||||
/* 2 */ SAMPLE_TABLE
|
||||
} SampleBankTableType;
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ CACHE_LOAD_PERMANENT,
|
||||
/* 1 */ CACHE_LOAD_PERSISTENT,
|
||||
/* 2 */ CACHE_LOAD_TEMPORARY,
|
||||
/* 3 */ CACHE_LOAD_EITHER,
|
||||
/* 4 */ CACHE_LOAD_EITHER_NOSYNC
|
||||
} AudioCacheLoadType;
|
||||
|
||||
typedef enum {
|
||||
/* 0 */ CACHE_TEMPORARY,
|
||||
/* 1 */ CACHE_PERSISTENT,
|
||||
@@ -78,6 +85,15 @@ typedef enum {
|
||||
/* 3 */ CACHE_PERMANENT
|
||||
} 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
|
||||
} AudioLoadStatus;
|
||||
|
||||
typedef s32 (*DmaHandler)(OSPiHandle* handle, OSIoMesg* mb, s32 direction);
|
||||
|
||||
struct Note;
|
||||
@@ -242,9 +258,9 @@ typedef struct {
|
||||
} SoundFont; // size = 0x14
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8* pc;
|
||||
/* 0x00 */ u8* pc; // program counter
|
||||
/* 0x04 */ u8* stack[4];
|
||||
/* 0x14 */ u8 remLoopIters[4];
|
||||
/* 0x14 */ u8 remLoopIters[4]; // remaining loop iterations
|
||||
/* 0x18 */ u8 depth;
|
||||
/* 0x19 */ s8 value;
|
||||
} SeqScriptState; // size = 0x1C
|
||||
@@ -399,7 +415,7 @@ typedef struct SequenceChannel {
|
||||
/* 0x12 */ VibratoSubStruct vibrato;
|
||||
/* 0x20 */ u16 delay;
|
||||
/* 0x22 */ u16 unk_20;
|
||||
/* 0x24 */ u16 unk_22;
|
||||
/* 0x24 */ u16 unk_22; // Used for indexing data
|
||||
/* 0x26 */ s16 instOrWave; // either 0 (none), instrument index + 1, or
|
||||
// 0x80..0x83 for sawtooth/triangle/sine/square waves.
|
||||
/* 0x28 */ s16 transposition;
|
||||
@@ -623,32 +639,41 @@ typedef struct {
|
||||
/* 0x16 */ s16 lowPassFilterCutoffRight;
|
||||
} ReverbSettings; // size = 0x18
|
||||
|
||||
/**
|
||||
* The high-level audio specifications requested when initializing or resetting the audio heap.
|
||||
* Most often resets during scene transitions, but will highly depend on game play.
|
||||
*/
|
||||
typedef struct {
|
||||
/* 0x00 */ u32 frequency;
|
||||
/* 0x00 */ u32 samplingFreq; // Target sampling rate in Hz
|
||||
/* 0x04 */ u8 unk_04;
|
||||
/* 0x05 */ u8 numNotes;
|
||||
/* 0x06 */ u8 numSequencePlayers;
|
||||
/* 0x07 */ u8 unk_07[0x2]; // unused, set to zero
|
||||
/* 0x09 */ u8 numReverbs;
|
||||
/* 0x0A */ u8 unk_0A[0x2];
|
||||
/* 0x0C */ ReverbSettings* reverbSettings;
|
||||
/* 0x10 */ u16 sampleDmaBufSize1;
|
||||
/* 0x12 */ u16 sampleDmaBufSize2;
|
||||
/* 0x14 */ u16 unk_14;
|
||||
/* 0x18 */ u32 persistentSeqMem;
|
||||
/* 0x1C */ u32 persistentFontMem;
|
||||
/* 0x20 */ u32 persistentSampleMem;
|
||||
/* 0x24 */ u32 temporarySeqMem;
|
||||
/* 0x28 */ u32 temporaryFontMem;
|
||||
/* 0x2C */ u32 temporarySampleMem;
|
||||
/* 0x30 */ s32 persistentSampleCacheMem;
|
||||
/* 0x34 */ s32 temporarySampleCacheMem;
|
||||
/* 0x18 */ size_t persistentSeqCacheSize; // size of cache on audio pool to store sequences persistently
|
||||
/* 0x1C */ size_t persistentFontCacheSize; // size of cache on audio pool to store soundFonts persistently
|
||||
/* 0x20 */ size_t persistentSampleBankCacheSize; // size of cache on audio pool to store entire sample banks persistently
|
||||
/* 0x24 */ size_t temporarySeqCacheSize; // size of cache on audio pool to store sequences temporarily
|
||||
/* 0x28 */ size_t temporaryFontCacheSize; // size of cache on audio pool to store soundFonts temporarily
|
||||
/* 0x2C */ size_t temporarySampleBankCacheSize; // size of cache on audio pool to store entire sample banks temporarily
|
||||
/* 0x30 */ size_t persistentSampleCacheSize; // size of cache on audio pool to store individual samples persistently
|
||||
/* 0x34 */ size_t temporarySampleCacheSize; // size of cache on audio pool to store individual samples temporarily
|
||||
} AudioSpec; // size = 0x38
|
||||
|
||||
/**
|
||||
* The audio buffer stores the fully processed digital audio before it is sent to the audio interface (AI), then to the
|
||||
* digital-analog converter (DAC), then to play on the speakers. The audio buffer is written to by the rsp after
|
||||
* processing audio commands, and the audio buffer is read by AI which sends the data to the DAC.
|
||||
* This struct parameterizes that buffer.
|
||||
*/
|
||||
typedef struct {
|
||||
/* 0x00 */ s16 specUnk4;
|
||||
/* 0x02 */ u16 frequency;
|
||||
/* 0x04 */ u16 aiFrequency;
|
||||
/* 0x02 */ u16 samplingFreq; // Target sampling rate in Hz
|
||||
/* 0x04 */ u16 aiSamplingFreq; // True sampling rate set to the audio interface (AI) for the audio digital-analog converter (DAC)
|
||||
/* 0x06 */ s16 samplesPerFrameTarget;
|
||||
/* 0x08 */ s16 maxAiBufferLength;
|
||||
/* 0x0A */ s16 minAiBufferLength;
|
||||
@@ -663,20 +688,29 @@ typedef struct {
|
||||
/* 0x24 */ f32 unk_24;
|
||||
} AudioBufferParameters; // size = 0x28
|
||||
|
||||
/**
|
||||
* Meta-data associated with a pool (contain withing the Audio Heap)
|
||||
*/
|
||||
typedef struct {
|
||||
/* 0x0 */ u8* start;
|
||||
/* 0x4 */ u8* cur;
|
||||
/* 0x8 */ s32 size;
|
||||
/* 0xC */ s32 count;
|
||||
/* 0x0 */ u8* startAddr; // start addr of the pool
|
||||
/* 0x4 */ u8* curAddr; // address of the next available memory for allocation
|
||||
/* 0x8 */ size_t size; // size of the pool
|
||||
/* 0xC */ s32 count; // number of entries allocated to the pool
|
||||
} AudioAllocPool; // size = 0x10
|
||||
|
||||
/**
|
||||
* Audio cache entry data to store a single entry containing either a sequence, soundfont, or entire sample banks
|
||||
*/
|
||||
typedef struct {
|
||||
/* 0x0 */ u8* ptr;
|
||||
/* 0x4 */ u32 size;
|
||||
/* 0x0 */ u8* addr;
|
||||
/* 0x4 */ size_t size;
|
||||
/* 0x8 */ s16 tableType;
|
||||
/* 0xA */ s16 id;
|
||||
} AudioCacheEntry; // size = 0xC
|
||||
|
||||
/**
|
||||
* Audio cache entry data to store a single entry containing an individual sample
|
||||
*/
|
||||
typedef struct {
|
||||
/* 0x00 */ s8 inUse;
|
||||
/* 0x01 */ s8 origMedium;
|
||||
@@ -684,13 +718,16 @@ typedef struct {
|
||||
/* 0x03 */ char unk_03[0x5];
|
||||
/* 0x08 */ u8* allocatedAddr;
|
||||
/* 0x0C */ void* sampleAddr;
|
||||
/* 0x10 */ u32 size;
|
||||
/* 0x10 */ size_t size;
|
||||
} SampleCacheEntry; // size = 0x14
|
||||
|
||||
/**
|
||||
* Audio cache entry data to store individual samples
|
||||
*/
|
||||
typedef struct {
|
||||
/* 0x000 */ AudioAllocPool pool;
|
||||
/* 0x010 */ SampleCacheEntry entries[128];
|
||||
/* 0xA10 */ s32 size;
|
||||
/* 0xA10 */ s32 numEntries;
|
||||
} AudioSampleCache; // size = 0xA14
|
||||
|
||||
typedef struct {
|
||||
@@ -712,22 +749,21 @@ typedef struct {
|
||||
} AudioCache; // size = 0x110
|
||||
|
||||
typedef struct {
|
||||
/* 0x0 */ u32 wantPersistent;
|
||||
/* 0x4 */ u32 wantTemporary;
|
||||
} AudioPoolSplit2; // size = 0x8
|
||||
/* 0x0 */ size_t persistentCommonPoolSize;
|
||||
/* 0x4 */ size_t temporaryCommonPoolSize;
|
||||
} AudioCachePoolSplit; // size = 0x8
|
||||
|
||||
typedef struct {
|
||||
/* 0x0 */ u32 wantSeq;
|
||||
/* 0x4 */ u32 wantFont;
|
||||
/* 0x8 */ u32 wantSample;
|
||||
} AudioPoolSplit3; // size = 0xC
|
||||
/* 0x0 */ size_t seqCacheSize;
|
||||
/* 0x4 */ size_t fontCacheSize;
|
||||
/* 0x8 */ size_t sampleBankCacheSize;
|
||||
} AudioCommonPoolSplit; // size = 0xC
|
||||
|
||||
typedef struct {
|
||||
/* 0x0 */ u32 wantSeq;
|
||||
/* 0x4 */ u32 wantFont;
|
||||
/* 0x8 */ u32 wantSample;
|
||||
/* 0xC */ u32 wantCustom;
|
||||
} AudioPoolSplit4; // size = 0x10
|
||||
/* 0x0 */ size_t miscPoolSize;
|
||||
/* 0x4 */ u32 unkSizes[2];
|
||||
/* 0xC */ size_t cachePoolSize;
|
||||
} AudioSessionPoolSplit; // size = 0x10
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u32 endAndMediumKey;
|
||||
@@ -763,10 +799,10 @@ typedef struct {
|
||||
/* 0x01 */ s8 delay;
|
||||
/* 0x02 */ s8 medium;
|
||||
/* 0x04 */ u8* ramAddr;
|
||||
/* 0x08 */ u32 curDevAddr;
|
||||
/* 0x08 */ uintptr_t curDevAddr;
|
||||
/* 0x0C */ u8* curRamAddr;
|
||||
/* 0x10 */ u32 bytesRemaining;
|
||||
/* 0x14 */ u32 chunkSize;
|
||||
/* 0x10 */ size_t bytesRemaining;
|
||||
/* 0x14 */ size_t chunkSize;
|
||||
/* 0x18 */ s32 unkMediumParam;
|
||||
/* 0x1C */ u32 retMsg;
|
||||
/* 0x20 */ OSMesgQueue* retQueue;
|
||||
@@ -780,12 +816,12 @@ typedef struct {
|
||||
/* 0x01 */ u8 seqOrFontId;
|
||||
/* 0x02 */ u16 instId;
|
||||
/* 0x04 */ s32 unkMediumParam;
|
||||
/* 0x08 */ s32 curDevAddr;
|
||||
/* 0x08 */ uintptr_t curDevAddr;
|
||||
/* 0x0C */ u8* curRamAddr;
|
||||
/* 0x10 */ u8* ramAddr;
|
||||
/* 0x14 */ s32 status;
|
||||
/* 0x18 */ s32 bytesRemaining;
|
||||
/* 0x1C */ s8* isDone;
|
||||
/* 0x18 */ size_t bytesRemaining;
|
||||
/* 0x1C */ s8* isDone; // TODO: rename in OoT and sync up here. This is an external status while (s32 status) is an internal status
|
||||
/* 0x20 */ SoundFontSample sample;
|
||||
/* 0x30 */ OSMesgQueue msgqueue;
|
||||
/* 0x48 */ OSMesg msg;
|
||||
@@ -793,8 +829,8 @@ typedef struct {
|
||||
} AudioSlowLoad; // size = 0x64
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u32 romAddr;
|
||||
/* 0x04 */ u32 size;
|
||||
/* 0x00 */ uintptr_t romAddr;
|
||||
/* 0x04 */ size_t size;
|
||||
/* 0x08 */ s8 medium;
|
||||
/* 0x09 */ s8 cachePolicy;
|
||||
/* 0x0A */ s16 shortData1;
|
||||
@@ -805,7 +841,7 @@ typedef struct {
|
||||
typedef struct {
|
||||
/* 0x00 */ s16 numEntries;
|
||||
/* 0x02 */ s16 unkMediumParam;
|
||||
/* 0x04 */ u32 romAddr;
|
||||
/* 0x04 */ uintptr_t romAddr;
|
||||
/* 0x08 */ char pad[0x8];
|
||||
/* 0x10 */ AudioTableEntry entries[1]; // (dynamic size)
|
||||
} AudioTable; // size >= 0x20
|
||||
@@ -819,18 +855,18 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ u8* ramAddr;
|
||||
/* 0x04 */ u32 devAddr;
|
||||
/* 0x04 */ uintptr_t devAddr;
|
||||
/* 0x08 */ u16 sizeUnused;
|
||||
/* 0x0A */ u16 size;
|
||||
/* 0x0C */ u8 unused;
|
||||
/* 0x0D */ u8 reuseIndex; // position in sSampleDmaReuseQueue1/2, if ttl == 0
|
||||
/* 0x0E */ u8 ttl; // duration after which the DMA can be discarded
|
||||
/* 0x0E */ u8 ttl; // Time To Live: duration after which the DMA can be discarded
|
||||
} SampleDma; // size = 0x10
|
||||
|
||||
typedef struct {
|
||||
/* 0x0000 */ char unk_0000;
|
||||
/* 0x0001 */ s8 numSynthesisReverbs;
|
||||
/* 0x0002 */ u16 unk_2;
|
||||
/* 0x0002 */ u16 unk_2; // reads from audio spec unk_14, never used, always set to 0x7FFF
|
||||
/* 0x0004 */ u16 unk_4;
|
||||
/* 0x0006 */ char unk_0006[0xA];
|
||||
/* 0x0010 */ s16* curLoadedBook;
|
||||
@@ -862,13 +898,13 @@ typedef struct {
|
||||
/* 0x263C */ SampleDma* sampleDmas;
|
||||
/* 0x2640 */ u32 sampleDmaCount;
|
||||
/* 0x2644 */ u32 sampleDmaListSize1;
|
||||
/* 0x2648 */ s32 unused2628;
|
||||
/* 0x2648 */ s32 unused2648;
|
||||
/* 0x264C */ u8 sampleDmaReuseQueue1[0x100]; // read pos <= write pos, wrapping mod 256
|
||||
/* 0x274C */ u8 sampleDmaReuseQueue2[0x100];
|
||||
/* 0x284C */ u8 sampleDmaReuseQueue1RdPos;
|
||||
/* 0x284D */ u8 sampleDmaReuseQueue2RdPos;
|
||||
/* 0x284E */ u8 sampleDmaReuseQueue1WrPos;
|
||||
/* 0x284F */ u8 sampleDmaReuseQueue2WrPos;
|
||||
/* 0x284C */ u8 sampleDmaReuseQueue1RdPos; // Read position for dma 1
|
||||
/* 0x284D */ u8 sampleDmaReuseQueue2RdPos; // Read position for dma 2
|
||||
/* 0x284E */ u8 sampleDmaReuseQueue1WrPos; // Write position for dma 1
|
||||
/* 0x284F */ u8 sampleDmaReuseQueue2WrPos; // Write position for dma 2
|
||||
/* 0x2850 */ AudioTable* sequenceTable;
|
||||
/* 0x2854 */ AudioTable* soundFontTable;
|
||||
/* 0x2858 */ AudioTable* sampleBankTable;
|
||||
@@ -886,52 +922,52 @@ typedef struct {
|
||||
/* 0x28B8 */ s32 numNotes;
|
||||
/* 0x2898 */ s16 tempoInternalToExternal;
|
||||
/* 0x28BE */ s8 soundMode;
|
||||
/* 0x28C0 */ s32 totalTaskCnt;
|
||||
/* 0x28C0 */ s32 totalTaskCount; // The total number of times the top-level function on the audio thread is run since the last audio reset
|
||||
/* 0x28C4 */ s32 curAudioFrameDmaCount;
|
||||
/* 0x28C8 */ s32 rspTaskIdx;
|
||||
/* 0x28CC */ s32 curAIBufIdx;
|
||||
/* 0x28AC */ Acmd* abiCmdBufs[2];
|
||||
/* 0x28C8 */ s32 rspTaskIndex;
|
||||
/* 0x28CC */ s32 curAiBuffferIndex;
|
||||
/* 0x28AC */ Acmd* abiCmdBufs[2]; // Pointer to audio heap where the audio binary interface command lists are stored. Two lists that alternative every frame
|
||||
/* 0x28B4 */ Acmd* curAbiCmdBuf;
|
||||
/* 0x28DC */ AudioTask* currTask;
|
||||
/* 0x28DC */ AudioTask* curTask;
|
||||
/* 0x28C0 */ AudioTask rspTask[2];
|
||||
/* 0x2980 */ f32 unk_2960;
|
||||
/* 0x2984*/ s32 refreshRate;
|
||||
/* 0x2988 */ s16* aiBuffers[3];
|
||||
/* 0x2994 */ s16 aiBufLengths[3];
|
||||
/* 0x2988 */ s16* aiBuffers[3]; // Pointers to the audio buffer allocated on the initPool contained in the audio heap. Stores fully processed digital audio before transferring to the audio interface (AI)
|
||||
/* 0x2994 */ s16 aiBufLengths[3]; // Number of bytes to transfer to the audio interface buffer
|
||||
/* 0x299C */ u32 audioRandom;
|
||||
/* 0x29A0 */ s32 audioErrorFlags;
|
||||
/* 0x29A4 */ volatile u32 resetTimer;
|
||||
/* 0x29A8 */ u32 (*unk_29A8[4])(s8 value, SequenceChannel* channel);
|
||||
/* 0x29B8 */ s8 unk_29B8;
|
||||
/* 0x29BC */ s32 unk_29BC; // sMaxAbiCmdCnt
|
||||
/* 0x29C0 */ AudioAllocPool audioSessionPool;
|
||||
/* 0x29D0 */ AudioAllocPool externalPool;
|
||||
/* 0x29E0 */ AudioAllocPool audioInitPool;
|
||||
/* 0x29F0 */ AudioAllocPool notesAndBuffersPool;
|
||||
/* 0x29C0 */ AudioAllocPool audioSessionPool; // A sub-pool to main pool, contains all sub-pools and data that changes every audio reset
|
||||
/* 0x29D0 */ AudioAllocPool externalPool; // pool allocated on an external device. Never used in game
|
||||
/* 0x29E0 */ AudioAllocPool audioInitPool; // A sub-pool to the main pool, contains all sub-pools and data that persists every audio reset
|
||||
/* 0x29F0 */ AudioAllocPool miscPool; // A sub-pool to the session pool,
|
||||
/* 0x2A00 */ char unk_29D0[0x20]; // probably two unused pools
|
||||
/* 0x2A20 */ AudioAllocPool cachePool;
|
||||
/* 0x2A30 */ AudioAllocPool persistentCommonPool;
|
||||
/* 0x2A40 */ AudioAllocPool temporaryCommonPool;
|
||||
/* 0x2A50 */ AudioCache seqCache;
|
||||
/* 0x2B60 */ AudioCache fontCache;
|
||||
/* 0x2C70 */ AudioCache sampleBankCache;
|
||||
/* 0x2D80 */ AudioAllocPool permanentPool;
|
||||
/* 0x2D90 */ AudioCacheEntry permanentCache[32];
|
||||
/* 0x3690 */ AudioSampleCache persistentSampleCache;
|
||||
/* 0x40A4 */ AudioSampleCache temporarySampleCache;
|
||||
/* 0x4338 */ AudioPoolSplit4 sessionPoolSplit;
|
||||
/* 0x4348 */ AudioPoolSplit2 cachePoolSplit;
|
||||
/* 0x4350 */ AudioPoolSplit3 persistentCommonPoolSplit;
|
||||
/* 0x435C */ AudioPoolSplit3 temporaryCommonPoolSplit;
|
||||
/* 0x2A20 */ AudioAllocPool cachePool; // The common pool for all cache entries
|
||||
/* 0x2A30 */ AudioAllocPool persistentCommonPool; // A sub-pool to the cache pool, contains all caches for data stored persistently
|
||||
/* 0x2A40 */ AudioAllocPool temporaryCommonPool; // A sub-pool to the cache pool, contains all caches for data stored temporarily
|
||||
/* 0x2A50 */ AudioCache seqCache; // Cache to store sequences
|
||||
/* 0x2B60 */ AudioCache fontCache; // Cache to store soundFonts
|
||||
/* 0x2C70 */ AudioCache sampleBankCache; // Cache for loading entire sample banks
|
||||
/* 0x2D80 */ AudioAllocPool permanentPool; // Pool to stores audio data that is always loaded in. Primarily used for sfxs
|
||||
/* 0x2D90 */ AudioCacheEntry permanentEntries[32]; // indificual entries to the permanent pool
|
||||
/* 0x3690 */ AudioSampleCache persistentSampleCache; // Stores individual samples persistently
|
||||
/* 0x40A4 */ AudioSampleCache temporarySampleCache; // Stores individual samples temporarily
|
||||
/* 0x4338 */ AudioSessionPoolSplit sessionPoolSplit; // splits session pool into the cache pool and misc pool
|
||||
/* 0x4348 */ AudioCachePoolSplit cachePoolSplit; // splits cache pool into the persistent & temporary common pools
|
||||
/* 0x4350 */ AudioCommonPoolSplit persistentCommonPoolSplit; // splits persistent common pool into caches for sequences, soundFonts, sample banks
|
||||
/* 0x435C */ AudioCommonPoolSplit temporaryCommonPoolSplit; // splits temporary common pool into caches for sequences, soundFonts, sample banks
|
||||
/* 0x4368 */ u8 sampleFontLoadStatus[0x30];
|
||||
/* 0x4398 */ u8 fontLoadStatus[0x30];
|
||||
/* 0x43C8 */ u8 seqLoadStatus[0x80];
|
||||
/* 0x4448 */ volatile u8 resetStatus;
|
||||
/* 0x4449 */ u8 audioResetSpecIdToLoad;
|
||||
/* 0x444C */ s32 audioResetFadeOutFramesLeft;
|
||||
/* 0x4450 */ f32* unk_3520;
|
||||
/* 0x4450 */ f32* unk_3520; // fadeOutVelocities for ADSR
|
||||
/* 0x4454 */ u8* audioHeap;
|
||||
/* 0x4458 */ u32 audioHeapSize;
|
||||
/* 0x4458 */ size_t audioHeapSize;
|
||||
/* 0x445C */ Note* notes;
|
||||
/* 0x4460 */ SequencePlayer seqPlayers[5];
|
||||
/* 0x4B40 */ SequenceLayer sequenceLayers[80];
|
||||
@@ -939,11 +975,10 @@ typedef struct {
|
||||
/* 0x7924 */ s32 noteSubEuOffset;
|
||||
/* 0x7928 */ AudioListItem layerFreeList;
|
||||
/* 0x7938 */ NotePool noteFreeLists;
|
||||
/* 0x7978 */ u8 cmdWrPos;
|
||||
/* 0x7979 */ u8 cmdRdPos;
|
||||
/* 0x7978 */ u8 cmdWritePos;
|
||||
/* 0x7979 */ u8 cmdReadPos;
|
||||
/* 0x797A */ u8 cmdQueueFinished;
|
||||
/* 0x797C */ u16 unk_5BDC[4];
|
||||
/* 0x7984 */ char unk_7984[4];
|
||||
/* 0x797C */ u16 activeChannelsFlags[5]; // bitwise flag for 16 channels. Only channels with bit turned on will be processed
|
||||
/* 0x7988 */ OSMesgQueue* audioResetQueueP;
|
||||
/* 0x798C */ OSMesgQueue* taskStartQueueP;
|
||||
/* 0x7990 */ OSMesgQueue* cmdProcQueueP;
|
||||
@@ -953,7 +988,7 @@ typedef struct {
|
||||
/* 0x79DC */ OSMesg taskStartMsgs[1];
|
||||
/* 0x79E0 */ OSMesg audioResetMesgs[1];
|
||||
/* 0x79E4 */ OSMesg cmdProcMsgs[4];
|
||||
/* 0x79F4 */ AudioCmd cmdBuf[0x100];
|
||||
/* 0x79F4 */ AudioCmd cmdBuf[0x100]; // Audio commands used to transfer audio requests from the graph thread to the audio thread
|
||||
/* 0x81F4 */ char unk_81F4[4];
|
||||
} AudioContext; // size = 0x81F8
|
||||
|
||||
@@ -972,9 +1007,9 @@ typedef struct {
|
||||
} NoteSubAttributes; // size = 0x1A
|
||||
|
||||
typedef struct {
|
||||
/* 0x0 */ u32 heapSize;
|
||||
/* 0x4 */ u32 initPoolSize;
|
||||
/* 0x8 */ u32 permanentPoolSize;
|
||||
/* 0x0 */ size_t heapSize; // total number of bytes allocated to the audio heap. Must be <= the size of `gAudioHeap` (ideally about the same size)
|
||||
/* 0x4 */ size_t mainPoolSplitSize; // The entire audio heap is split into two pools.
|
||||
/* 0x8 */ size_t permanentPoolSize;
|
||||
} AudioContextInitSizes; // size = 0xC
|
||||
|
||||
typedef struct {
|
||||
|
||||
Reference in New Issue
Block a user