Mario Kart 64
Loading...
Searching...
No Matches
load.h
Go to the documentation of this file.
1#ifndef AUDIO_LOAD_H
2#define AUDIO_LOAD_H
3
4#include <PR/ultratypes.h>
5#include "audio/internal.h"
6
7#define AUDIO_FRAME_DMA_QUEUE_SIZE 0x40
8
9#define PRELOAD_BANKS 2
10#define PRELOAD_SEQUENCE 1
11
12#define IS_SEQUENCE_CHANNEL_VALID(ptr) ((uintptr_t) (ptr) != (uintptr_t) & gSequenceChannelNone)
13
14struct SharedDma {
15 /*0x0*/ u8* buffer; // target, points to pre-allocated buffer
16 /*0x4*/ uintptr_t source; // device address
17 /*0x8*/ u16 sizeUnused; // set to bufSize, never read
18 /*0xA*/ u16 bufSize; // size of buffer
19 /*0xC*/ u8 unused2; // set to 0, never read
20 /*0xD*/ u8 reuseIndex; // position in sSampleDmaReuseQueue1/2, if ttl == 0
21 /*0xE*/ u8 ttl; // duration after which the DMA can be discarded
22}; // size = 0x10
23
24void audio_dma_copy_immediate(u8* devAddr, void* vAddr, size_t nbytes);
25void audio_dma_copy_async(uintptr_t, void*, size_t, OSMesgQueue*, OSIoMesg*);
26void audio_dma_partial_copy_async(uintptr_t*, u8**, ssize_t*, OSMesgQueue*, OSIoMesg*);
28void* dma_sample_data(uintptr_t, u32, s32, u8*);
31s32 func_800BB388(s32 bankId, s32 instId, s32 arg2);
33void patch_sound(struct AudioBankSound* sound, u8* memBase, u8* offsetBase);
34void func_800BB584(s32);
35void patch_audio_bank(struct AudioBank* mem, u8* offset, u32 numInstruments, u32 numDrums);
40u8 get_missing_bank(u32 seqId, s32* nonNullCount, s32* nullCount);
43void load_sequence(u32, u32, s32);
45
50extern struct AudioListItem gLayerFreeList;
51extern struct NotePool gNoteFreeLists;
52extern OSMesgQueue gCurrAudioFrameDmaQueue;
55extern OSMesgQueue D_803B6720;
56extern OSMesg D_803B6738;
57
58extern OSIoMesg D_803B6740;
59extern struct SharedDma sSampleDmas[0x70];
62extern s32 D_803B6E60;
63extern s32 load_bss_pad;
64
65extern u8 sSampleDmaReuseQueue1[256];
66extern u8 sSampleDmaReuseQueue2[256];
71
74extern ALSeqFile* gAlTbl;
75extern u8* gAlBankSets;
76extern u16 gSequenceCount;
77extern struct CtlEntry* gCtlEntries;
79extern u32 D_803B70A8;
80extern s32 gMaxAudioCmds;
84extern volatile s32 gAudioFrameCount;
86
87#endif // AUDIO_LOAD_H
#define SEQUENCE_CHANNELS
Definition internal.h:7
#define SEQUENCE_LAYERS
Definition internal.h:8
#define SEQUENCE_PLAYERS
Definition internal.h:6
u8 sSampleDmaReuseQueueTail1
Definition load.c:38
void decrease_sample_dma_ttls(void)
Definition load.c:138
s16 gTempoInternalToExternal
Definition load.c:53
void func_800BB030(s32)
void * sequence_dma_immediate(s32, s32)
Definition load.c:546
s8 gAudioLibSoundMode
Definition load.c:54
void * sequence_dma_async(s32, s32, struct SequencePlayer *)
Definition load.c:566
u8 sSampleDmaReuseQueue2[256]
Definition load.c:37
OSIoMesg D_803B6740
Definition load.c:29
s32 gMaxAudioCmds
Definition load.c:51
void patch_audio_bank(struct AudioBank *mem, u8 *offset, u32 numInstruments, u32 numDrums)
Definition load.c:423
struct AudioBank * bank_load_async(s32, s32, struct SequencePlayer *)
Definition load.c:514
void load_sequence_internal(u32, u32, s32)
Definition load.c:696
ALSeqFile * gAlTbl
Definition load.c:45
void * dma_sample_data(uintptr_t, u32, s32, u8 *)
Definition load.c:166
struct SequencePlayer gSequencePlayers[SEQUENCE_PLAYERS]
Definition load.c:16
struct SequenceChannel gSequenceChannels[SEQUENCE_CHANNELS]
Definition load.c:17
struct SequenceChannelLayer gSequenceLayers[SEQUENCE_LAYERS]
Definition load.c:18
u8 sSampleDmaReuseQueueTail2
Definition load.c:39
u32 sSampleDmaListSize1
Definition load.c:32
void audio_dma_copy_async(uintptr_t, void *, size_t, OSMesgQueue *, OSIoMesg *)
Definition load.c:119
u8 sSampleDmaReuseQueueHead2
Definition load.c:41
void audio_dma_partial_copy_async(uintptr_t *, u8 **, ssize_t *, OSMesgQueue *, OSIoMesg *)
Definition load.c:128
u8 sSampleDmaReuseQueueHead1
Definition load.c:40
u8 sSampleDmaReuseQueue1[256]
Definition load.c:36
void load_sequence(u32, u32, s32)
Definition load.c:686
u8 get_missing_bank(u32 seqId, s32 *nonNullCount, s32 *nullCount)
Definition load.c:599
struct AudioBank * bank_load_immediate(s32, s32)
Definition load.c:491
volatile s32 gAudioFrameCount
Definition load.c:56
s32 load_bss_pad
Definition load.c:34
OSMesgQueue D_803B6720
Definition load.c:26
struct SharedDma sSampleDmas[0x70]
Definition load.c:30
OSMesg gCurrAudioFrameDmaMesgBufs[AUDIO_FRAME_DMA_QUEUE_SIZE]
Definition load.c:24
void audio_dma_copy_immediate(u8 *devAddr, void *vAddr, size_t nbytes)
Definition load.c:108
s32 gCurrAudioFrameDmaCount
Definition load.c:57
struct SequenceChannel gSequenceChannelNone
Definition load.c:19
u32 gSampleDmaNumListItems
Definition load.c:31
u16 gSequenceCount
Definition load.c:47
void preload_sequence(u32, u8)
Definition load.c:653
OSMesgQueue gCurrAudioFrameDmaQueue
Definition load.c:23
s32 func_800BB388(s32 bankId, s32 instId, s32 arg2)
Definition load.c:330
s32 func_800BB304(struct AudioBankSample *)
Definition load.c:309
s32 D_803B6E60
Definition load.c:33
#define AUDIO_FRAME_DMA_QUEUE_SIZE
Definition load.h:7
OSIoMesg gCurrAudioFrameDmaIoMesgBufs[AUDIO_FRAME_DMA_QUEUE_SIZE]
Definition load.c:25
s32 gMaxSimultaneousNotes
Definition load.c:52
void patch_sound(struct AudioBankSound *sound, u8 *memBase, u8 *offsetBase)
Definition load.c:375
void func_800BB584(s32)
Definition load.c:409
struct AudioBank * load_banks_immediate(s32, u8 *)
Definition load.c:629
struct AudioBufferParametersEU gAudioBufferParameters
Definition load.c:49
void func_800BB43C(ALSeqFile *, u8 *)
Definition load.c:363
ALSeqFile * gSeqFileHeader
Definition load.c:43
struct NotePool gNoteFreeLists
Definition load.c:22
u8 * gAlBankSets
Definition load.c:46
struct AudioListItem gLayerFreeList
Definition load.c:21
struct CtlEntry * gCtlEntries
Definition load.c:48
u32 D_803B70A8
Definition load.c:50
ALSeqFile * gAlCtlHeader
Definition load.c:44
OSMesg D_803B6738
Definition load.c:27
Definition libaudio.h:11
Definition internal.h:132
Definition internal.h:141
Definition internal.h:165
Definition internal.h:532
Definition internal.h:66
Definition internal.h:170
Definition internal.h:83
Definition os_pi.h:53
Definition internal.h:342
Definition internal.h:285
Definition internal.h:186
Definition load.h:14
uintptr_t source
Definition load.h:16
u16 sizeUnused
Definition load.h:17
u8 reuseIndex
Definition load.h:20
u8 * buffer
Definition load.h:15
u8 unused2
Definition load.h:19
u16 bufSize
Definition load.h:18
u8 ttl
Definition load.h:21
signed int s32
Definition ultratypes.h:15
unsigned int u32
Definition ultratypes.h:16
signed char s8
Definition ultratypes.h:11
signed short int s16
Definition ultratypes.h:13
unsigned short int u16
Definition ultratypes.h:14
ptrdiff_t ssize_t
Definition ultratypes.h:47
unsigned char u8
Definition ultratypes.h:12