2019-12-01 21:52:53 -05:00
|
|
|
#ifndef AUDIO_MEMORY_H
|
|
|
|
#define AUDIO_MEMORY_H
|
2019-08-25 00:46:40 -04:00
|
|
|
|
|
|
|
#include "internal.h"
|
|
|
|
|
|
|
|
#define SOUND_LOAD_STATUS_NOT_LOADED 0
|
|
|
|
#define SOUND_LOAD_STATUS_IN_PROGRESS 1
|
|
|
|
#define SOUND_LOAD_STATUS_COMPLETE 2
|
|
|
|
#define SOUND_LOAD_STATUS_DISCARDABLE 3
|
|
|
|
|
|
|
|
#define IS_BANK_LOAD_COMPLETE(bankId) (gBankLoadStatus[bankId] >= SOUND_LOAD_STATUS_COMPLETE)
|
|
|
|
#define IS_SEQ_LOAD_COMPLETE(seqId) (gSeqLoadStatus[seqId] >= SOUND_LOAD_STATUS_COMPLETE)
|
|
|
|
|
|
|
|
struct SoundAllocPool
|
|
|
|
{
|
|
|
|
u8 *start;
|
|
|
|
u8 *cur;
|
|
|
|
u32 size;
|
|
|
|
s32 unused; // set to 0, never read
|
|
|
|
}; // size = 0x10
|
|
|
|
|
|
|
|
struct SeqOrBankEntry {
|
|
|
|
u8 *ptr;
|
|
|
|
u32 size;
|
|
|
|
s32 id; // seqId or bankId
|
|
|
|
}; // size = 0xC
|
|
|
|
|
|
|
|
struct PersistentPool
|
|
|
|
{
|
|
|
|
/*0x00*/ u32 numEntries;
|
|
|
|
/*0x04*/ struct SoundAllocPool pool;
|
|
|
|
/*0x14*/ struct SeqOrBankEntry entries[32];
|
|
|
|
}; // size = 0x194
|
|
|
|
|
|
|
|
struct TemporaryPool
|
|
|
|
{
|
|
|
|
/*0x00*/ u32 nextSide;
|
|
|
|
/*0x04*/ struct SoundAllocPool pool;
|
|
|
|
/*0x14*/ struct SeqOrBankEntry entries[2];
|
|
|
|
}; // size = 0x2C
|
|
|
|
|
|
|
|
struct SoundMultiPool
|
|
|
|
{
|
|
|
|
/*0x000*/ struct PersistentPool persistent;
|
|
|
|
/*0x194*/ struct TemporaryPool temporary;
|
|
|
|
/* */ u32 pad2[4];
|
|
|
|
}; // size = 0x1D0
|
|
|
|
|
|
|
|
extern u8 gAudioHeap[];
|
2019-11-03 14:36:27 -05:00
|
|
|
extern s16 gVolume;
|
|
|
|
extern s8 gReverbDownsampleRate;
|
|
|
|
extern struct SoundAllocPool gAudioInitPool;
|
|
|
|
extern struct SoundAllocPool gNotesAndBuffersPool;
|
2019-08-25 00:46:40 -04:00
|
|
|
extern struct SoundMultiPool gSeqLoadedPool;
|
|
|
|
extern struct SoundMultiPool gBankLoadedPool;
|
|
|
|
extern u8 gBankLoadStatus[64];
|
|
|
|
extern u8 gSeqLoadStatus[256];
|
|
|
|
|
|
|
|
void *soundAlloc(struct SoundAllocPool *pool, u32 size);
|
2019-11-03 14:36:27 -05:00
|
|
|
void sound_init_main_pools(s32 sizeForAudioInitPool);
|
2019-08-25 00:46:40 -04:00
|
|
|
void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg3, s32 id);
|
|
|
|
void *get_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 arg2);
|
2019-11-03 14:36:27 -05:00
|
|
|
void audio_reset_session(struct AudioSessionSettings *preset);
|
2019-08-25 00:46:40 -04:00
|
|
|
|
2019-12-01 21:52:53 -05:00
|
|
|
#endif /* AUDIO_MEMORY_H */
|