diff options
| author | Tharo <17233964+Thar0@users.noreply.github.com> | 2024-12-21 01:41:14 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-20 20:41:14 -0500 |
| commit | 81df2d4ba3bfd4e8683b0b70cc7c582305dac068 (patch) | |
| tree | 623eb85fd817a25cc5ba966a4a5d5ba5c6188a27 /src/audio | |
| parent | 1adf696588d41d2c3fee4cb4f25cfa4c7d27be19 (diff) | |
Move const-qualified data from session_config.c to session_init.c, no longer qualify them as const and incrementally link instead (#2381)
Diffstat (limited to 'src/audio')
| -rw-r--r-- | src/audio/lib/load.c | 3 | ||||
| -rw-r--r-- | src/audio/session_config.c | 24 | ||||
| -rw-r--r-- | src/audio/session_init.c | 26 |
3 files changed, 27 insertions, 26 deletions
diff --git a/src/audio/lib/load.c b/src/audio/lib/load.c index 3e66c7932..0aa3324d7 100644 --- a/src/audio/lib/load.c +++ b/src/audio/lib/load.c @@ -1250,8 +1250,7 @@ void AudioLoad_Init(void* heap, u32 heapSize) { ramAddr = AudioHeap_Alloc(&gAudioCtx.initPool, gAudioHeapInitSizes.permanentPoolSize); if (ramAddr == NULL) { - // cast away const from gAudioHeapInitSizes - *((u32*)&gAudioHeapInitSizes.permanentPoolSize) = 0; + gAudioHeapInitSizes.permanentPoolSize = 0; } AudioHeap_InitPool(&gAudioCtx.permanentPool, ramAddr, gAudioHeapInitSizes.permanentPoolSize); diff --git a/src/audio/session_config.c b/src/audio/session_config.c index 27771515a..a531d6c27 100644 --- a/src/audio/session_config.c +++ b/src/audio/session_config.c @@ -1,33 +1,9 @@ #include "global.h" -#include "assets/audio/sequence_sizes.h" -#include "assets/audio/soundfont_sizes.h" -#define SFX_SEQ_SIZE Sequence_0_SIZE -#define SFX_SOUNDFONTS_SIZE (Soundfont_0_SIZE + Soundfont_1_SIZE) AudioContext gAudioCtx; AudioCustomUpdateFunction gAudioCustomUpdateFunction; s32 D_801755D8[3]; // unused -const TempoData gTempoData = { - 0x1C00, // unk_00 - SEQTICKS_PER_BEAT, // seqTicksPerBeat -}; - -// Sizes of everything on the init pool -#define AI_BUFFERS_SIZE (AIBUF_SIZE * ARRAY_COUNT(gAudioCtx.aiBuffers)) -#define SOUNDFONT_LIST_SIZE (NUM_SOUNDFONTS * sizeof(SoundFont)) -#if OOT_VERSION < PAL_1_0 || PLATFORM_GC -#define PERMANENT_POOL_SIZE (SFX_SEQ_SIZE + SFX_SOUNDFONTS_SIZE) -#else -#define PERMANENT_POOL_SIZE (SFX_SEQ_SIZE + SFX_SOUNDFONTS_SIZE + 0x10) -#endif - -const AudioHeapInitSizes gAudioHeapInitSizes = { - ALIGN16(sizeof(gAudioHeap) - 0x100), // audio heap size - ALIGN16(PERMANENT_POOL_SIZE + AI_BUFFERS_SIZE + SOUNDFONT_LIST_SIZE), // init pool size - ALIGN16(PERMANENT_POOL_SIZE), // permanent pool size -}; - #define DEFAULT_REVERB_SETTINGS \ { 1, 0x30, 0x3000, 0, 0, 0x7FFF, 0x0000, 0x0000, 0xFF, 0x3000, 0x0, 0x0 } diff --git a/src/audio/session_init.c b/src/audio/session_init.c new file mode 100644 index 000000000..0abc371ec --- /dev/null +++ b/src/audio/session_init.c @@ -0,0 +1,26 @@ +#include "global.h" +#include "assets/audio/sequence_sizes.h" +#include "assets/audio/soundfont_sizes.h" + +#define SFX_SEQ_SIZE Sequence_0_SIZE +#define SFX_SOUNDFONTS_SIZE (Soundfont_0_SIZE + Soundfont_1_SIZE) + +TempoData gTempoData = { + 0x1C00, // unk_00 + SEQTICKS_PER_BEAT, // seqTicksPerBeat +}; + +// Sizes of everything on the init pool +#define AI_BUFFERS_SIZE (AIBUF_SIZE * ARRAY_COUNT(gAudioCtx.aiBuffers)) +#define SOUNDFONT_LIST_SIZE (NUM_SOUNDFONTS * sizeof(SoundFont)) +#if OOT_VERSION < PAL_1_0 || PLATFORM_GC +#define PERMANENT_POOL_SIZE (SFX_SEQ_SIZE + SFX_SOUNDFONTS_SIZE) +#else +#define PERMANENT_POOL_SIZE (SFX_SEQ_SIZE + SFX_SOUNDFONTS_SIZE + 0x10) +#endif + +AudioHeapInitSizes gAudioHeapInitSizes = { + ALIGN16(sizeof(gAudioHeap) - 0x100), // audio heap size + ALIGN16(PERMANENT_POOL_SIZE + AI_BUFFERS_SIZE + SOUNDFONT_LIST_SIZE), // init pool size + ALIGN16(PERMANENT_POOL_SIZE), // permanent pool size +}; |
