mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-17 13:24:45 +00:00
Audio WIP (#836)
* being code_800EC960 * wip * wip * more audio progress * migrate data in code_800E11F0 * wip * make ok * remove asm * wip * move some variables outside of gAudioContext to the AudioContext structure due to the size used in func_800E3094 * more progress * wip * wip * split code_800E11F0 * migrate rodata in code_800E11F0 * match functions that couldn't because of data issues * move code_800E4FE0 asm files * wip * more wip * fix global functions, and forward declarations * wip * wip * wip * ocarina wip * match a couple functions * some progress * separate some bss * match func_800EDA3C * some matching * more matches * migrate audio rodata * some matches * more matchess * start on synthesis * work on synthesis * fix function declaration * Merge branch 'master' into audio * match a few more functions * wip * wip * more matching, rename Audio_SetBGM to Audio_QueueSeqCmd * name several audio functions, and audiocontext members * more naming, rename code_800E11F0 to audio_load, code_800DAAC0 to audio_synthesis * audio wip * match a few more functions. * wip * add missing NON_MATCHING directive * wip * some matching, data reogranization * match cursed function * wip * wip * formatting * remove prefix from struct memebers * missed function rename * review Co-authored-by: fig02 <fig02srl@gmail.com>
This commit is contained in:
parent
cc9a04feb4
commit
d1a5ea5110
429 changed files with 9047 additions and 17038 deletions
|
@ -2,7 +2,7 @@
|
|||
#include "global.h"
|
||||
|
||||
f32 func_800DDE20(f32 arg0) {
|
||||
return 256.0f * gAudioContext.gAudioBufferParameters.unkUpdatesPerFrameScaled / arg0;
|
||||
return 256.0f * gAudioContext.audioBufferParameters.unkUpdatesPerFrameScaled / arg0;
|
||||
}
|
||||
|
||||
void func_800DDE3C(void) {
|
||||
|
@ -33,20 +33,20 @@ void Audio_ResetLoadStatus(void) {
|
|||
s32 i;
|
||||
|
||||
for (i = 0; i < 0x30; i++) {
|
||||
if (gAudioContext.gBankLoadStatus[i] != 5) {
|
||||
gAudioContext.gBankLoadStatus[i] = 0;
|
||||
if (gAudioContext.bankLoadStatus[i] != 5) {
|
||||
gAudioContext.bankLoadStatus[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 0x30; i++) {
|
||||
if (gAudioContext.gUnusedLoadStatus[i] != 5) {
|
||||
gAudioContext.gUnusedLoadStatus[i] = 0;
|
||||
if (gAudioContext.audioTableLoadStatus[i] != 5) {
|
||||
gAudioContext.audioTableLoadStatus[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < 0x80; i++) {
|
||||
if (gAudioContext.gSeqLoadStatus[i] != 5) {
|
||||
gAudioContext.gSeqLoadStatus[i] = 0;
|
||||
if (gAudioContext.seqLoadstatus[i] != 5) {
|
||||
gAudioContext.seqLoadstatus[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -54,8 +54,8 @@ void Audio_ResetLoadStatus(void) {
|
|||
void Audio_DiscardBank(s32 bankId) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < gAudioContext.gMaxSimultaneousNotes; i++) {
|
||||
Note* note = &gAudioContext.gNotes[i];
|
||||
for (i = 0; i < gAudioContext.maxSimultaneousNotes; i++) {
|
||||
Note* note = &gAudioContext.notes[i];
|
||||
|
||||
if (note->playbackState.bankId == bankId) {
|
||||
if (note->playbackState.unk_04 == 0 && note->playbackState.priority != 0) {
|
||||
|
@ -64,7 +64,7 @@ void Audio_DiscardBank(s32 bankId) {
|
|||
}
|
||||
Audio_NoteDisable(note);
|
||||
Audio_AudioListRemove(¬e->listItem);
|
||||
Audio_AudioListPushBack(&gNoteFreeLists.disabled, ¬e->listItem);
|
||||
Audio_AudioListPushBack(&gAudioContext.noteFreeLists.disabled, ¬e->listItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,14 +72,14 @@ void Audio_DiscardBank(s32 bankId) {
|
|||
void func_800DE12C(s32 bankId) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < gAudioContext.gMaxSimultaneousNotes; i++) {
|
||||
Note* note = &gAudioContext.gNotes[i];
|
||||
for (i = 0; i < gAudioContext.maxSimultaneousNotes; i++) {
|
||||
Note* note = &gAudioContext.notes[i];
|
||||
NotePlaybackState* state = ¬e->playbackState;
|
||||
|
||||
if (state->bankId == bankId) {
|
||||
if (state->priority != 0 && state->adsr.action.s.state == ADSR_STATE_DECAY) {
|
||||
state->priority = 1;
|
||||
state->adsr.fadeOutVel = gAudioContext.gAudioBufferParameters.updatesPerFrameInv;
|
||||
state->adsr.fadeOutVel = gAudioContext.audioBufferParameters.updatesPerFrameInv;
|
||||
state->adsr.action.s.release = true;
|
||||
}
|
||||
}
|
||||
|
@ -89,22 +89,22 @@ void func_800DE12C(s32 bankId) {
|
|||
void Audio_DiscardSequence(s32 seqId) {
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < gAudioContext.gAudioBufferParameters.numSequencePlayers; i++) {
|
||||
if (gAudioContext.gSequencePlayers[i].enabled && gAudioContext.gSequencePlayers[i].seqId == seqId) {
|
||||
Audio_SequencePlayerDisable(&gAudioContext.gSequencePlayers[i]);
|
||||
for (i = 0; i < gAudioContext.audioBufferParameters.numSequencePlayers; i++) {
|
||||
if (gAudioContext.seqPlayers[i].enabled && gAudioContext.seqPlayers[i].seqId == seqId) {
|
||||
Audio_SequencePlayerDisable(&gAudioContext.seqPlayers[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_800DE238(void* mem, u32 size) {
|
||||
func_800E6880(mem, size);
|
||||
Audio_osWritebackDCache(mem, size);
|
||||
}
|
||||
|
||||
void* func_800DE258(SoundAllocPool* pool, u32 size) {
|
||||
void* ret = NULL;
|
||||
|
||||
if (gAudioContext.gUnkPool.start != 0) {
|
||||
ret = Audio_AllocZeroed(&gAudioContext.gUnkPool, size);
|
||||
if (gAudioContext.unkPool.start != 0) {
|
||||
ret = Audio_AllocZeroed(&gAudioContext.unkPool, size);
|
||||
}
|
||||
if (ret == NULL) {
|
||||
ret = Audio_AllocZeroed(pool, size);
|
||||
|
@ -115,8 +115,8 @@ void* func_800DE258(SoundAllocPool* pool, u32 size) {
|
|||
void* func_800DE2B0(SoundAllocPool* pool, u32 size) {
|
||||
void* ret = NULL;
|
||||
|
||||
if (gAudioContext.gUnkPool.start != NULL) {
|
||||
ret = Audio_Alloc(&gAudioContext.gUnkPool, size);
|
||||
if (gAudioContext.unkPool.start != NULL) {
|
||||
ret = Audio_Alloc(&gAudioContext.unkPool, size);
|
||||
}
|
||||
if (ret == NULL) {
|
||||
ret = Audio_Alloc(pool, size);
|
||||
|
@ -206,16 +206,16 @@ void func_800DE4B0(s32 poolIdx) {
|
|||
|
||||
switch (poolIdx) {
|
||||
case 0:
|
||||
loadedPool = &gAudioContext.gSeqLoadedPool;
|
||||
table = gAudioContext.gSeqLoadStatus;
|
||||
loadedPool = &gAudioContext.seqLoadedPool;
|
||||
table = gAudioContext.seqLoadstatus;
|
||||
break;
|
||||
case 1:
|
||||
loadedPool = &gAudioContext.gBankLoadedPool;
|
||||
table = gAudioContext.gBankLoadStatus;
|
||||
loadedPool = &gAudioContext.bankLoadedPool;
|
||||
table = gAudioContext.bankLoadStatus;
|
||||
break;
|
||||
case 2:
|
||||
loadedPool = &gAudioContext.gUnusedLoadedPool;
|
||||
table = gAudioContext.gUnusedLoadStatus;
|
||||
loadedPool = &gAudioContext.unusedLoadedPool;
|
||||
table = gAudioContext.audioTableLoadStatus;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -241,52 +241,52 @@ void func_800DE4B0(s32 poolIdx) {
|
|||
}
|
||||
|
||||
void Audio_InitMainPools(s32 sizeForAudioInitPool) {
|
||||
Audio_SoundAllocPoolInit(&gAudioContext.gAudioInitPool, gAudioContext.gAudioHeap, sizeForAudioInitPool);
|
||||
Audio_SoundAllocPoolInit(&gAudioContext.gAudioSessionPool, gAudioContext.gAudioHeap + sizeForAudioInitPool,
|
||||
gAudioContext.gAudioHeapSize - sizeForAudioInitPool);
|
||||
gAudioContext.gUnkPool.start = NULL;
|
||||
Audio_SoundAllocPoolInit(&gAudioContext.audioInitPool, gAudioContext.audioHeap, sizeForAudioInitPool);
|
||||
Audio_SoundAllocPoolInit(&gAudioContext.audioSessionPool, gAudioContext.audioHeap + sizeForAudioInitPool,
|
||||
gAudioContext.audioHeapSize - sizeForAudioInitPool);
|
||||
gAudioContext.unkPool.start = NULL;
|
||||
}
|
||||
|
||||
void Audio_SessionPoolsInit(AudioPoolSplit4* split) {
|
||||
gAudioContext.gAudioSessionPool.cur = gAudioContext.gAudioSessionPool.start;
|
||||
Audio_SoundAllocPoolInit(&gAudioContext.gNotesAndBuffersPool,
|
||||
Audio_Alloc(&gAudioContext.gAudioSessionPool, split->wantSeq), split->wantSeq);
|
||||
Audio_SoundAllocPoolInit(&gAudioContext.gSeqAndBankPool,
|
||||
Audio_Alloc(&gAudioContext.gAudioSessionPool, split->wantCustom), split->wantCustom);
|
||||
gAudioContext.audioSessionPool.cur = gAudioContext.audioSessionPool.start;
|
||||
Audio_SoundAllocPoolInit(&gAudioContext.notesAndBuffersPool,
|
||||
Audio_Alloc(&gAudioContext.audioSessionPool, split->wantSeq), split->wantSeq);
|
||||
Audio_SoundAllocPoolInit(&gAudioContext.seqAndBankPool,
|
||||
Audio_Alloc(&gAudioContext.audioSessionPool, split->wantCustom), split->wantCustom);
|
||||
}
|
||||
|
||||
void Audio_SeqAndBankPoolInit(AudioPoolSplit2* split) {
|
||||
gAudioContext.gSeqAndBankPool.cur = gAudioContext.gSeqAndBankPool.start;
|
||||
Audio_SoundAllocPoolInit(&gAudioContext.gPersistentCommonPool,
|
||||
Audio_Alloc(&gAudioContext.gSeqAndBankPool, split->wantPersistent), split->wantPersistent);
|
||||
Audio_SoundAllocPoolInit(&gAudioContext.gTemporaryCommonPool,
|
||||
Audio_Alloc(&gAudioContext.gSeqAndBankPool, split->wantTemporary), split->wantTemporary);
|
||||
gAudioContext.seqAndBankPool.cur = gAudioContext.seqAndBankPool.start;
|
||||
Audio_SoundAllocPoolInit(&gAudioContext.persistentCommonPool,
|
||||
Audio_Alloc(&gAudioContext.seqAndBankPool, split->wantPersistent), split->wantPersistent);
|
||||
Audio_SoundAllocPoolInit(&gAudioContext.temporaryCommonPool,
|
||||
Audio_Alloc(&gAudioContext.seqAndBankPool, split->wantTemporary), split->wantTemporary);
|
||||
}
|
||||
|
||||
void Audio_PersistentPoolsInit(AudioPoolSplit3* split) {
|
||||
gAudioContext.gPersistentCommonPool.cur = gAudioContext.gPersistentCommonPool.start;
|
||||
Audio_SoundAllocPoolInit(&gAudioContext.gSeqLoadedPool.persistent.pool,
|
||||
Audio_Alloc(&gAudioContext.gPersistentCommonPool, split->wantSeq), split->wantSeq);
|
||||
Audio_SoundAllocPoolInit(&gAudioContext.gBankLoadedPool.persistent.pool,
|
||||
Audio_Alloc(&gAudioContext.gPersistentCommonPool, split->wantBank), split->wantBank);
|
||||
Audio_SoundAllocPoolInit(&gAudioContext.gUnusedLoadedPool.persistent.pool,
|
||||
Audio_Alloc(&gAudioContext.gPersistentCommonPool, split->wantUnused), split->wantUnused);
|
||||
Audio_PersistentPoolClear(&gAudioContext.gSeqLoadedPool.persistent);
|
||||
Audio_PersistentPoolClear(&gAudioContext.gBankLoadedPool.persistent);
|
||||
Audio_PersistentPoolClear(&gAudioContext.gUnusedLoadedPool.persistent);
|
||||
gAudioContext.persistentCommonPool.cur = gAudioContext.persistentCommonPool.start;
|
||||
Audio_SoundAllocPoolInit(&gAudioContext.seqLoadedPool.persistent.pool,
|
||||
Audio_Alloc(&gAudioContext.persistentCommonPool, split->wantSeq), split->wantSeq);
|
||||
Audio_SoundAllocPoolInit(&gAudioContext.bankLoadedPool.persistent.pool,
|
||||
Audio_Alloc(&gAudioContext.persistentCommonPool, split->wantBank), split->wantBank);
|
||||
Audio_SoundAllocPoolInit(&gAudioContext.unusedLoadedPool.persistent.pool,
|
||||
Audio_Alloc(&gAudioContext.persistentCommonPool, split->wantUnused), split->wantUnused);
|
||||
Audio_PersistentPoolClear(&gAudioContext.seqLoadedPool.persistent);
|
||||
Audio_PersistentPoolClear(&gAudioContext.bankLoadedPool.persistent);
|
||||
Audio_PersistentPoolClear(&gAudioContext.unusedLoadedPool.persistent);
|
||||
}
|
||||
|
||||
void Audio_TemporaryPoolsInit(AudioPoolSplit3* split) {
|
||||
gAudioContext.gTemporaryCommonPool.cur = gAudioContext.gTemporaryCommonPool.start;
|
||||
Audio_SoundAllocPoolInit(&gAudioContext.gSeqLoadedPool.temporary.pool,
|
||||
Audio_Alloc(&gAudioContext.gTemporaryCommonPool, split->wantSeq), split->wantSeq);
|
||||
Audio_SoundAllocPoolInit(&gAudioContext.gBankLoadedPool.temporary.pool,
|
||||
Audio_Alloc(&gAudioContext.gTemporaryCommonPool, split->wantBank), split->wantBank);
|
||||
Audio_SoundAllocPoolInit(&gAudioContext.gUnusedLoadedPool.temporary.pool,
|
||||
Audio_Alloc(&gAudioContext.gTemporaryCommonPool, split->wantUnused), split->wantUnused);
|
||||
Audio_TemporaryPoolClear(&gAudioContext.gSeqLoadedPool.temporary);
|
||||
Audio_TemporaryPoolClear(&gAudioContext.gBankLoadedPool.temporary);
|
||||
Audio_TemporaryPoolClear(&gAudioContext.gUnusedLoadedPool.temporary);
|
||||
gAudioContext.temporaryCommonPool.cur = gAudioContext.temporaryCommonPool.start;
|
||||
Audio_SoundAllocPoolInit(&gAudioContext.seqLoadedPool.temporary.pool,
|
||||
Audio_Alloc(&gAudioContext.temporaryCommonPool, split->wantSeq), split->wantSeq);
|
||||
Audio_SoundAllocPoolInit(&gAudioContext.bankLoadedPool.temporary.pool,
|
||||
Audio_Alloc(&gAudioContext.temporaryCommonPool, split->wantBank), split->wantBank);
|
||||
Audio_SoundAllocPoolInit(&gAudioContext.unusedLoadedPool.temporary.pool,
|
||||
Audio_Alloc(&gAudioContext.temporaryCommonPool, split->wantUnused), split->wantUnused);
|
||||
Audio_TemporaryPoolClear(&gAudioContext.seqLoadedPool.temporary);
|
||||
Audio_TemporaryPoolClear(&gAudioContext.bankLoadedPool.temporary);
|
||||
Audio_TemporaryPoolClear(&gAudioContext.unusedLoadedPool.temporary);
|
||||
}
|
||||
|
||||
void* Audio_AllocBankOrSeq(s32 poolIdx, s32 size, s32 arg2, s32 id) {
|
||||
|
@ -303,16 +303,16 @@ void* Audio_AllocBankOrSeq(s32 poolIdx, s32 size, s32 arg2, s32 id) {
|
|||
|
||||
switch (poolIdx) {
|
||||
case 0:
|
||||
loadedPool = &gAudioContext.gSeqLoadedPool;
|
||||
table = gAudioContext.gSeqLoadStatus;
|
||||
loadedPool = &gAudioContext.seqLoadedPool;
|
||||
table = gAudioContext.seqLoadstatus;
|
||||
break;
|
||||
case 1:
|
||||
loadedPool = &gAudioContext.gBankLoadedPool;
|
||||
table = gAudioContext.gBankLoadStatus;
|
||||
loadedPool = &gAudioContext.bankLoadedPool;
|
||||
table = gAudioContext.bankLoadStatus;
|
||||
break;
|
||||
case 2:
|
||||
loadedPool = &gAudioContext.gUnusedLoadedPool;
|
||||
table = gAudioContext.gUnusedLoadStatus;
|
||||
loadedPool = &gAudioContext.unusedLoadedPool;
|
||||
table = gAudioContext.audioTableLoadStatus;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -329,28 +329,28 @@ void* Audio_AllocBankOrSeq(s32 poolIdx, s32 size, s32 arg2, s32 id) {
|
|||
|
||||
if (poolIdx == 1) {
|
||||
if (firstVal == 4) {
|
||||
for (i = 0; i < gAudioContext.gMaxSimultaneousNotes; i++) {
|
||||
if (gAudioContext.gNotes[i].playbackState.bankId == tp->entries[0].id &&
|
||||
gAudioContext.gNotes[i].noteSubEu.bitField0.s.enabled != 0) {
|
||||
for (i = 0; i < gAudioContext.maxSimultaneousNotes; i++) {
|
||||
if (gAudioContext.notes[i].playbackState.bankId == tp->entries[0].id &&
|
||||
gAudioContext.notes[i].noteSubEu.bitField0.s.enabled != 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == gAudioContext.gMaxSimultaneousNotes) {
|
||||
if (i == gAudioContext.maxSimultaneousNotes) {
|
||||
Audio_SetBankLoadStatus(tp->entries[0].id, 3);
|
||||
firstVal = 3;
|
||||
}
|
||||
}
|
||||
|
||||
if (secondVal == 4) {
|
||||
for (i = 0; i < gAudioContext.gMaxSimultaneousNotes; i++) {
|
||||
if (gAudioContext.gNotes[i].playbackState.bankId == tp->entries[1].id &&
|
||||
gAudioContext.gNotes[i].noteSubEu.bitField0.s.enabled != 0) {
|
||||
for (i = 0; i < gAudioContext.maxSimultaneousNotes; i++) {
|
||||
if (gAudioContext.notes[i].playbackState.bankId == tp->entries[1].id &&
|
||||
gAudioContext.notes[i].noteSubEu.bitField0.s.enabled != 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == gAudioContext.gMaxSimultaneousNotes) {
|
||||
if (i == gAudioContext.maxSimultaneousNotes) {
|
||||
Audio_SetBankLoadStatus(tp->entries[1].id, 3);
|
||||
secondVal = 3;
|
||||
}
|
||||
|
@ -371,54 +371,54 @@ void* Audio_AllocBankOrSeq(s32 poolIdx, s32 size, s32 arg2, s32 id) {
|
|||
// Check if there is a side which isn't in active use, if so, evict that one.
|
||||
if (poolIdx == 0) {
|
||||
if (firstVal == 2) {
|
||||
for (i = 0; i < gAudioContext.gAudioBufferParameters.numSequencePlayers; i++) {
|
||||
if (gAudioContext.gSequencePlayers[i].enabled != 0 &&
|
||||
gAudioContext.gSequencePlayers[i].seqId == tp->entries[0].id) {
|
||||
for (i = 0; i < gAudioContext.audioBufferParameters.numSequencePlayers; i++) {
|
||||
if (gAudioContext.seqPlayers[i].enabled != 0 &&
|
||||
gAudioContext.seqPlayers[i].seqId == tp->entries[0].id) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == gAudioContext.gAudioBufferParameters.numSequencePlayers) {
|
||||
if (i == gAudioContext.audioBufferParameters.numSequencePlayers) {
|
||||
tp->nextSide = 0;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
if (secondVal == 2) {
|
||||
for (i = 0; i < gAudioContext.gAudioBufferParameters.numSequencePlayers; i++) {
|
||||
if (gAudioContext.gSequencePlayers[i].enabled != 0 &&
|
||||
gAudioContext.gSequencePlayers[i].seqId == tp->entries[1].id) {
|
||||
for (i = 0; i < gAudioContext.audioBufferParameters.numSequencePlayers; i++) {
|
||||
if (gAudioContext.seqPlayers[i].enabled != 0 &&
|
||||
gAudioContext.seqPlayers[i].seqId == tp->entries[1].id) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == gAudioContext.gAudioBufferParameters.numSequencePlayers) {
|
||||
if (i == gAudioContext.audioBufferParameters.numSequencePlayers) {
|
||||
tp->nextSide = 1;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
} else if (poolIdx == 1) {
|
||||
if (firstVal == 2) {
|
||||
for (i = 0; i < gAudioContext.gMaxSimultaneousNotes; i++) {
|
||||
if (gAudioContext.gNotes[i].playbackState.bankId == tp->entries[0].id &&
|
||||
gAudioContext.gNotes[i].noteSubEu.bitField0.s.enabled != 0) {
|
||||
for (i = 0; i < gAudioContext.maxSimultaneousNotes; i++) {
|
||||
if (gAudioContext.notes[i].playbackState.bankId == tp->entries[0].id &&
|
||||
gAudioContext.notes[i].noteSubEu.bitField0.s.enabled != 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == gAudioContext.gMaxSimultaneousNotes) {
|
||||
if (i == gAudioContext.maxSimultaneousNotes) {
|
||||
tp->nextSide = 0;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
if (secondVal == 2) {
|
||||
for (i = 0; i < gAudioContext.gMaxSimultaneousNotes; i++) {
|
||||
if (gAudioContext.gNotes[i].playbackState.bankId == tp->entries[1].id &&
|
||||
gAudioContext.gNotes[i].noteSubEu.bitField0.s.enabled != 0) {
|
||||
for (i = 0; i < gAudioContext.maxSimultaneousNotes; i++) {
|
||||
if (gAudioContext.notes[i].playbackState.bankId == tp->entries[1].id &&
|
||||
gAudioContext.notes[i].noteSubEu.bitField0.s.enabled != 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == gAudioContext.gMaxSimultaneousNotes) {
|
||||
if (i == gAudioContext.maxSimultaneousNotes) {
|
||||
tp->nextSide = 1;
|
||||
goto done;
|
||||
}
|
||||
|
@ -565,13 +565,13 @@ void* func_800DF0CC(s32 poolIdx, s32 arg1, s32 bankId) {
|
|||
|
||||
switch (poolIdx) {
|
||||
case 0:
|
||||
loadedPool = &gAudioContext.gSeqLoadedPool;
|
||||
loadedPool = &gAudioContext.seqLoadedPool;
|
||||
break;
|
||||
case 1:
|
||||
loadedPool = &gAudioContext.gBankLoadedPool;
|
||||
loadedPool = &gAudioContext.bankLoadedPool;
|
||||
break;
|
||||
case 2:
|
||||
loadedPool = &gAudioContext.gUnusedLoadedPool;
|
||||
loadedPool = &gAudioContext.unusedLoadedPool;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -673,15 +673,15 @@ void func_800DF7C4(void) {
|
|||
s32 i;
|
||||
s32 j;
|
||||
|
||||
if (gAudioContext.gAudioBufferParameters.presetUnk4 == 2) {
|
||||
if (gAudioContext.audioBufferParameters.presetUnk4 == 2) {
|
||||
count = 2;
|
||||
} else {
|
||||
count = 1;
|
||||
}
|
||||
|
||||
for (i = 0; i < gAudioContext.gNumSynthesisReverbs; i++) {
|
||||
for (i = 0; i < gAudioContext.numSynthesisReverbs; i++) {
|
||||
for (j = 0; j < count; j++) {
|
||||
func_800DF7BC(&gAudioContext.gSynthesisReverbs[i]);
|
||||
func_800DF7BC(&gAudioContext.synthesisReverbs[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -690,11 +690,11 @@ void func_800DF888(void) {
|
|||
s32 ind;
|
||||
s32 i;
|
||||
|
||||
ind = gAudioContext.unk_28A8;
|
||||
gAudioContext.unk_2974[ind] = gAudioContext.gAudioBufferParameters.minAiBufferLength;
|
||||
ind = gAudioContext.curAIBufIdx;
|
||||
gAudioContext.aiBufLengths[ind] = gAudioContext.audioBufferParameters.minAiBufferLength;
|
||||
|
||||
for (i = 0; i < 0x580; i++) {
|
||||
gAudioContext.unk_2968[ind][i] = 0;
|
||||
gAudioContext.aiBuffers[ind][i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -703,80 +703,80 @@ s32 Audio_ResetStep(void) {
|
|||
s32 j;
|
||||
s32 sp24;
|
||||
|
||||
if (gAudioContext.gAudioBufferParameters.presetUnk4 == 2) {
|
||||
if (gAudioContext.audioBufferParameters.presetUnk4 == 2) {
|
||||
sp24 = 2;
|
||||
} else {
|
||||
sp24 = 1;
|
||||
}
|
||||
|
||||
switch (gAudioContext.gAudioResetStatus) {
|
||||
switch (gAudioContext.resetStatus) {
|
||||
case 5:
|
||||
for (i = 0; i < gAudioContext.gAudioBufferParameters.numSequencePlayers; i++) {
|
||||
Audio_SequencePlayerDisableAsFinished(&gAudioContext.gSequencePlayers[i]);
|
||||
for (i = 0; i < gAudioContext.audioBufferParameters.numSequencePlayers; i++) {
|
||||
Audio_SequencePlayerDisableAsFinished(&gAudioContext.seqPlayers[i]);
|
||||
}
|
||||
gAudioContext.gAudioResetFadeOutFramesLeft = 2 / sp24;
|
||||
gAudioContext.gAudioResetStatus--;
|
||||
gAudioContext.audioResetFadeOutFramesLeft = 2 / sp24;
|
||||
gAudioContext.resetStatus--;
|
||||
break;
|
||||
|
||||
case 4:
|
||||
if (gAudioContext.gAudioResetFadeOutFramesLeft != 0) {
|
||||
gAudioContext.gAudioResetFadeOutFramesLeft--;
|
||||
if (gAudioContext.audioResetFadeOutFramesLeft != 0) {
|
||||
gAudioContext.audioResetFadeOutFramesLeft--;
|
||||
func_800DF7C4();
|
||||
} else {
|
||||
for (i = 0; i < gAudioContext.gMaxSimultaneousNotes; i++) {
|
||||
if (gAudioContext.gNotes[i].noteSubEu.bitField0.s.enabled &&
|
||||
gAudioContext.gNotes[i].playbackState.adsr.action.s.state != ADSR_STATE_DISABLED) {
|
||||
gAudioContext.gNotes[i].playbackState.adsr.fadeOutVel =
|
||||
gAudioContext.gAudioBufferParameters.updatesPerFrameInv;
|
||||
gAudioContext.gNotes[i].playbackState.adsr.action.s.release = true;
|
||||
for (i = 0; i < gAudioContext.maxSimultaneousNotes; i++) {
|
||||
if (gAudioContext.notes[i].noteSubEu.bitField0.s.enabled &&
|
||||
gAudioContext.notes[i].playbackState.adsr.action.s.state != ADSR_STATE_DISABLED) {
|
||||
gAudioContext.notes[i].playbackState.adsr.fadeOutVel =
|
||||
gAudioContext.audioBufferParameters.updatesPerFrameInv;
|
||||
gAudioContext.notes[i].playbackState.adsr.action.s.release = true;
|
||||
}
|
||||
}
|
||||
gAudioContext.gAudioResetFadeOutFramesLeft = 8 / sp24;
|
||||
gAudioContext.gAudioResetStatus--;
|
||||
gAudioContext.audioResetFadeOutFramesLeft = 8 / sp24;
|
||||
gAudioContext.resetStatus--;
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if (gAudioContext.gAudioResetFadeOutFramesLeft != 0) {
|
||||
gAudioContext.gAudioResetFadeOutFramesLeft--;
|
||||
if (gAudioContext.audioResetFadeOutFramesLeft != 0) {
|
||||
gAudioContext.audioResetFadeOutFramesLeft--;
|
||||
func_800DF7C4();
|
||||
} else {
|
||||
gAudioContext.gAudioResetFadeOutFramesLeft = 2 / sp24;
|
||||
gAudioContext.gAudioResetStatus--;
|
||||
gAudioContext.audioResetFadeOutFramesLeft = 2 / sp24;
|
||||
gAudioContext.resetStatus--;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
func_800DF888();
|
||||
if (gAudioContext.gAudioResetFadeOutFramesLeft != 0) {
|
||||
gAudioContext.gAudioResetFadeOutFramesLeft--;
|
||||
if (gAudioContext.audioResetFadeOutFramesLeft != 0) {
|
||||
gAudioContext.audioResetFadeOutFramesLeft--;
|
||||
} else {
|
||||
gAudioContext.gAudioResetStatus--;
|
||||
gAudioContext.resetStatus--;
|
||||
func_800E0CBC();
|
||||
func_800E1148();
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
func_800DFBF8();
|
||||
gAudioContext.gAudioResetStatus = 0;
|
||||
Audio_InitHeap();
|
||||
gAudioContext.resetStatus = 0;
|
||||
for (i = 0; i < 3; i++) {
|
||||
gAudioContext.unk_2974[i] = gAudioContext.gAudioBufferParameters.maxAiBufferLength;
|
||||
gAudioContext.aiBufLengths[i] = gAudioContext.audioBufferParameters.maxAiBufferLength;
|
||||
for (j = 0; j < 0x580; j++) {
|
||||
gAudioContext.unk_2968[i][j] = 0;
|
||||
gAudioContext.aiBuffers[i][j] = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (gAudioContext.gAudioResetStatus < 3) {
|
||||
if (gAudioContext.resetStatus < 3) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void func_800DFBF8(void) {
|
||||
void Audio_InitHeap(void) {
|
||||
s32 pad1[4];
|
||||
s16* mem;
|
||||
s32 persistentMem;
|
||||
|
@ -787,112 +787,113 @@ void func_800DFBF8(void) {
|
|||
s32 i;
|
||||
s32 j;
|
||||
s32 pad2;
|
||||
AudioSessionSettings* preset = &gAudioSessionPresets[gAudioContext.gAudioResetPresetIdToLoad];
|
||||
AudioSessionSettings* preset = &gAudioSessionPresets[gAudioContext.audioResetPresetIdToLoad];
|
||||
|
||||
gAudioContext.gSampleDmaNumListItems = 0;
|
||||
gAudioContext.gAudioBufferParameters.frequency = preset->frequency;
|
||||
gAudioContext.gAudioBufferParameters.aiFrequency = osAiSetFrequency(gAudioContext.gAudioBufferParameters.frequency);
|
||||
gAudioContext.gAudioBufferParameters.samplesPerFrameTarget =
|
||||
((gAudioContext.gAudioBufferParameters.frequency / gAudioContext.gRefreshRate) + 0xF) & 0xFFF0;
|
||||
gAudioContext.gAudioBufferParameters.minAiBufferLength =
|
||||
gAudioContext.gAudioBufferParameters.samplesPerFrameTarget - 0x10;
|
||||
gAudioContext.gAudioBufferParameters.maxAiBufferLength =
|
||||
gAudioContext.gAudioBufferParameters.samplesPerFrameTarget + 0x10;
|
||||
gAudioContext.gAudioBufferParameters.updatesPerFrame =
|
||||
((gAudioContext.gAudioBufferParameters.samplesPerFrameTarget + 0x10) / 0xD0) + 1;
|
||||
gAudioContext.gAudioBufferParameters.samplesPerUpdate =
|
||||
(gAudioContext.gAudioBufferParameters.samplesPerFrameTarget /
|
||||
gAudioContext.gAudioBufferParameters.updatesPerFrame) &
|
||||
preset = &gAudioSessionPresets[gAudioContext.audioResetPresetIdToLoad];
|
||||
gAudioContext.sampleDmaReqCnt = 0;
|
||||
gAudioContext.audioBufferParameters.frequency = preset->frequency;
|
||||
gAudioContext.audioBufferParameters.aiFrequency = osAiSetFrequency(gAudioContext.audioBufferParameters.frequency);
|
||||
gAudioContext.audioBufferParameters.samplesPerFrameTarget =
|
||||
((gAudioContext.audioBufferParameters.frequency / gAudioContext.refreshRate) + 0xF) & 0xFFF0;
|
||||
gAudioContext.audioBufferParameters.minAiBufferLength =
|
||||
gAudioContext.audioBufferParameters.samplesPerFrameTarget - 0x10;
|
||||
gAudioContext.audioBufferParameters.maxAiBufferLength =
|
||||
gAudioContext.audioBufferParameters.samplesPerFrameTarget + 0x10;
|
||||
gAudioContext.audioBufferParameters.updatesPerFrame =
|
||||
((gAudioContext.audioBufferParameters.samplesPerFrameTarget + 0x10) / 0xD0) + 1;
|
||||
gAudioContext.audioBufferParameters.samplesPerUpdate =
|
||||
(gAudioContext.audioBufferParameters.samplesPerFrameTarget /
|
||||
gAudioContext.audioBufferParameters.updatesPerFrame) &
|
||||
~7;
|
||||
gAudioContext.gAudioBufferParameters.samplesPerUpdateMax =
|
||||
gAudioContext.gAudioBufferParameters.samplesPerUpdate + 8;
|
||||
gAudioContext.gAudioBufferParameters.samplesPerUpdateMin =
|
||||
gAudioContext.gAudioBufferParameters.samplesPerUpdate - 8;
|
||||
gAudioContext.gAudioBufferParameters.resampleRate = 32000.0f / (s32)gAudioContext.gAudioBufferParameters.frequency;
|
||||
gAudioContext.gAudioBufferParameters.unkUpdatesPerFrameScaled =
|
||||
(1.0f / 256.0f) / gAudioContext.gAudioBufferParameters.updatesPerFrame;
|
||||
gAudioContext.gAudioBufferParameters.unk_24 = gAudioContext.gAudioBufferParameters.updatesPerFrame * 0.25f;
|
||||
gAudioContext.gAudioBufferParameters.updatesPerFrameInv =
|
||||
1.0f / gAudioContext.gAudioBufferParameters.updatesPerFrame;
|
||||
gAudioContext.audioBufferParameters.samplesPerUpdateMax =
|
||||
gAudioContext.audioBufferParameters.samplesPerUpdate + 8;
|
||||
gAudioContext.audioBufferParameters.samplesPerUpdateMin =
|
||||
gAudioContext.audioBufferParameters.samplesPerUpdate - 8;
|
||||
gAudioContext.audioBufferParameters.resampleRate = 32000.0f / (s32)gAudioContext.audioBufferParameters.frequency;
|
||||
gAudioContext.audioBufferParameters.unkUpdatesPerFrameScaled =
|
||||
(1.0f / 256.0f) / gAudioContext.audioBufferParameters.updatesPerFrame;
|
||||
gAudioContext.audioBufferParameters.unk_24 = gAudioContext.audioBufferParameters.updatesPerFrame * 0.25f;
|
||||
gAudioContext.audioBufferParameters.updatesPerFrameInv =
|
||||
1.0f / gAudioContext.audioBufferParameters.updatesPerFrame;
|
||||
gAudioContext.unk_2874 = preset->unk_10;
|
||||
gAudioContext.unk_2878 = preset->unk_12;
|
||||
|
||||
gAudioContext.gMaxSimultaneousNotes = preset->maxSimultaneousNotes;
|
||||
gAudioContext.gAudioBufferParameters.numSequencePlayers = preset->numSequencePlayers;
|
||||
if (gAudioContext.gAudioBufferParameters.numSequencePlayers > 4) {
|
||||
gAudioContext.gAudioBufferParameters.numSequencePlayers = 4;
|
||||
gAudioContext.maxSimultaneousNotes = preset->maxSimultaneousNotes;
|
||||
gAudioContext.audioBufferParameters.numSequencePlayers = preset->numSequencePlayers;
|
||||
if (gAudioContext.audioBufferParameters.numSequencePlayers > 4) {
|
||||
gAudioContext.audioBufferParameters.numSequencePlayers = 4;
|
||||
}
|
||||
gAudioContext.unk_2 = preset->unk_14;
|
||||
gAudioContext.gTempoInternalToExternal = (u32)(gAudioContext.gAudioBufferParameters.updatesPerFrame * 2880000.0f /
|
||||
gAudioContext.tempoInternalToExternal = (u32)(gAudioContext.audioBufferParameters.updatesPerFrame * 2880000.0f /
|
||||
gTatumsPerBeat / gAudioContext.unk_2960);
|
||||
|
||||
gAudioContext.unk_2870 = gAudioContext.gRefreshRate;
|
||||
gAudioContext.unk_2870 *= gAudioContext.gAudioBufferParameters.updatesPerFrame;
|
||||
gAudioContext.unk_2870 /= gAudioContext.gAudioBufferParameters.aiFrequency;
|
||||
gAudioContext.unk_2870 /= gAudioContext.gTempoInternalToExternal;
|
||||
gAudioContext.unk_2870 = gAudioContext.refreshRate;
|
||||
gAudioContext.unk_2870 *= gAudioContext.audioBufferParameters.updatesPerFrame;
|
||||
gAudioContext.unk_2870 /= gAudioContext.audioBufferParameters.aiFrequency;
|
||||
gAudioContext.unk_2870 /= gAudioContext.tempoInternalToExternal;
|
||||
|
||||
gAudioContext.gAudioBufferParameters.presetUnk4 = preset->unk_04;
|
||||
gAudioContext.gAudioBufferParameters.samplesPerFrameTarget *= gAudioContext.gAudioBufferParameters.presetUnk4;
|
||||
gAudioContext.gAudioBufferParameters.maxAiBufferLength *= gAudioContext.gAudioBufferParameters.presetUnk4;
|
||||
gAudioContext.gAudioBufferParameters.minAiBufferLength *= gAudioContext.gAudioBufferParameters.presetUnk4;
|
||||
gAudioContext.gAudioBufferParameters.updatesPerFrame *= gAudioContext.gAudioBufferParameters.presetUnk4;
|
||||
gAudioContext.audioBufferParameters.presetUnk4 = preset->unk_04;
|
||||
gAudioContext.audioBufferParameters.samplesPerFrameTarget *= gAudioContext.audioBufferParameters.presetUnk4;
|
||||
gAudioContext.audioBufferParameters.maxAiBufferLength *= gAudioContext.audioBufferParameters.presetUnk4;
|
||||
gAudioContext.audioBufferParameters.minAiBufferLength *= gAudioContext.audioBufferParameters.presetUnk4;
|
||||
gAudioContext.audioBufferParameters.updatesPerFrame *= gAudioContext.audioBufferParameters.presetUnk4;
|
||||
|
||||
if (gAudioContext.gAudioBufferParameters.presetUnk4 >= 2) {
|
||||
gAudioContext.gAudioBufferParameters.maxAiBufferLength -= 0x10;
|
||||
if (gAudioContext.audioBufferParameters.presetUnk4 >= 2) {
|
||||
gAudioContext.audioBufferParameters.maxAiBufferLength -= 0x10;
|
||||
}
|
||||
|
||||
gAudioContext.gMaxAudioCmds =
|
||||
gAudioContext.gMaxSimultaneousNotes * 0x10 * gAudioContext.gAudioBufferParameters.updatesPerFrame +
|
||||
gAudioContext.maxAudioCmds =
|
||||
gAudioContext.maxSimultaneousNotes * 0x10 * gAudioContext.audioBufferParameters.updatesPerFrame +
|
||||
preset->numReverbs * 0x18 + 0x140;
|
||||
|
||||
persistentMem = preset->persistentSeqMem + preset->persistentBankMem + preset->persistentUnusedMem + 0x10;
|
||||
temporaryMem = preset->temporarySeqMem + preset->temporaryBankMem + preset->temporaryUnusedMem + 0x10;
|
||||
totalMem = persistentMem + temporaryMem;
|
||||
wantMisc = gAudioContext.gAudioSessionPool.size - totalMem - 0x100;
|
||||
wantMisc = gAudioContext.audioSessionPool.size - totalMem - 0x100;
|
||||
|
||||
if (gAudioContext.gUnkPool.start != NULL) {
|
||||
gAudioContext.gUnkPool.cur = gAudioContext.gUnkPool.start;
|
||||
if (gAudioContext.unkPool.start != NULL) {
|
||||
gAudioContext.unkPool.cur = gAudioContext.unkPool.start;
|
||||
}
|
||||
|
||||
gAudioContext.sSessionPoolSplit.wantSeq = wantMisc;
|
||||
gAudioContext.sSessionPoolSplit.wantCustom = totalMem;
|
||||
Audio_SessionPoolsInit(&gAudioContext.sSessionPoolSplit);
|
||||
gAudioContext.sSeqAndBankPoolSplit.wantPersistent = persistentMem;
|
||||
gAudioContext.sSeqAndBankPoolSplit.wantTemporary = temporaryMem;
|
||||
Audio_SeqAndBankPoolInit(&gAudioContext.sSeqAndBankPoolSplit);
|
||||
gAudioContext.sPersistentCommonPoolSplit.wantSeq = preset->persistentSeqMem;
|
||||
gAudioContext.sPersistentCommonPoolSplit.wantBank = preset->persistentBankMem;
|
||||
gAudioContext.sPersistentCommonPoolSplit.wantUnused = preset->persistentUnusedMem;
|
||||
Audio_PersistentPoolsInit(&gAudioContext.sPersistentCommonPoolSplit);
|
||||
gAudioContext.sTemporaryCommonPoolSplit.wantSeq = preset->temporarySeqMem;
|
||||
gAudioContext.sTemporaryCommonPoolSplit.wantBank = preset->temporaryBankMem;
|
||||
gAudioContext.sTemporaryCommonPoolSplit.wantUnused = preset->temporaryUnusedMem;
|
||||
Audio_TemporaryPoolsInit(&gAudioContext.sTemporaryCommonPoolSplit);
|
||||
gAudioContext.sessionPoolSplit.wantSeq = wantMisc;
|
||||
gAudioContext.sessionPoolSplit.wantCustom = totalMem;
|
||||
Audio_SessionPoolsInit(&gAudioContext.sessionPoolSplit);
|
||||
gAudioContext.seqAndBankPoolSplit.wantPersistent = persistentMem;
|
||||
gAudioContext.seqAndBankPoolSplit.wantTemporary = temporaryMem;
|
||||
Audio_SeqAndBankPoolInit(&gAudioContext.seqAndBankPoolSplit);
|
||||
gAudioContext.persistentCommonPoolSplit.wantSeq = preset->persistentSeqMem;
|
||||
gAudioContext.persistentCommonPoolSplit.wantBank = preset->persistentBankMem;
|
||||
gAudioContext.persistentCommonPoolSplit.wantUnused = preset->persistentUnusedMem;
|
||||
Audio_PersistentPoolsInit(&gAudioContext.persistentCommonPoolSplit);
|
||||
gAudioContext.temporaryCommonPoolSplit.wantSeq = preset->temporarySeqMem;
|
||||
gAudioContext.temporaryCommonPoolSplit.wantBank = preset->temporaryBankMem;
|
||||
gAudioContext.temporaryCommonPoolSplit.wantUnused = preset->temporaryUnusedMem;
|
||||
Audio_TemporaryPoolsInit(&gAudioContext.temporaryCommonPoolSplit);
|
||||
|
||||
Audio_ResetLoadStatus();
|
||||
gAudioContext.gNotes =
|
||||
Audio_AllocZeroed(&gAudioContext.gNotesAndBuffersPool, gAudioContext.gMaxSimultaneousNotes * sizeof(Note));
|
||||
gAudioContext.notes =
|
||||
Audio_AllocZeroed(&gAudioContext.notesAndBuffersPool, gAudioContext.maxSimultaneousNotes * sizeof(Note));
|
||||
Audio_NoteInitAll();
|
||||
Audio_InitNoteFreeList();
|
||||
gAudioContext.gNoteSubsEu = Audio_AllocZeroed(&gAudioContext.gNotesAndBuffersPool,
|
||||
gAudioContext.gAudioBufferParameters.updatesPerFrame *
|
||||
gAudioContext.gMaxSimultaneousNotes * sizeof(NoteSubEu));
|
||||
gAudioContext.noteSubsEu = Audio_AllocZeroed(&gAudioContext.notesAndBuffersPool,
|
||||
gAudioContext.audioBufferParameters.updatesPerFrame *
|
||||
gAudioContext.maxSimultaneousNotes * sizeof(NoteSubEu));
|
||||
|
||||
for (i = 0; i != 2; i++) {
|
||||
gAudioContext.gAudioCmdBuffers[i] =
|
||||
Audio_AllocDmaMemoryZeroed(&gAudioContext.gNotesAndBuffersPool, gAudioContext.gMaxAudioCmds * sizeof(u64));
|
||||
gAudioContext.abiCmdBufs[i] =
|
||||
Audio_AllocDmaMemoryZeroed(&gAudioContext.notesAndBuffersPool, gAudioContext.maxAudioCmds * sizeof(u64));
|
||||
}
|
||||
|
||||
gAudioContext.unk_3520 = Audio_Alloc(&gAudioContext.gNotesAndBuffersPool, 0x100 * sizeof(f32));
|
||||
gAudioContext.unk_3520 = Audio_Alloc(&gAudioContext.notesAndBuffersPool, 0x100 * sizeof(f32));
|
||||
func_800DDE3C();
|
||||
for (i = 0; i < 4; i++) {
|
||||
gAudioContext.gSynthesisReverbs[i].useReverb = 0;
|
||||
gAudioContext.synthesisReverbs[i].useReverb = 0;
|
||||
}
|
||||
|
||||
gAudioContext.gNumSynthesisReverbs = preset->numReverbs;
|
||||
for (i = 0; i < gAudioContext.gNumSynthesisReverbs; i++) {
|
||||
gAudioContext.numSynthesisReverbs = preset->numReverbs;
|
||||
for (i = 0; i < gAudioContext.numSynthesisReverbs; i++) {
|
||||
ReverbSettings* settings = &preset->reverbSettings[i];
|
||||
SynthesisReverb* reverb = &gAudioContext.gSynthesisReverbs[i];
|
||||
SynthesisReverb* reverb = &gAudioContext.synthesisReverbs[i];
|
||||
reverb->downsampleRate = settings->downsampleRate;
|
||||
reverb->windowSize = settings->windowSize * 64;
|
||||
reverb->windowSize /= reverb->downsampleRate;
|
||||
|
@ -906,52 +907,52 @@ void func_800DFBF8(void) {
|
|||
reverb->unk_05 = settings->unk_10;
|
||||
reverb->unk_08 = settings->unk_12;
|
||||
reverb->useReverb = 8;
|
||||
reverb->unk_28 = func_800DE258(&gAudioContext.gNotesAndBuffersPool, reverb->windowSize * sizeof(s16));
|
||||
reverb->unk_2C = func_800DE258(&gAudioContext.gNotesAndBuffersPool, reverb->windowSize * sizeof(s16));
|
||||
reverb->unk_1C = 0;
|
||||
reverb->leftRingBuf = func_800DE258(&gAudioContext.notesAndBuffersPool, reverb->windowSize * sizeof(s16));
|
||||
reverb->rightRingBuf = func_800DE258(&gAudioContext.notesAndBuffersPool, reverb->windowSize * sizeof(s16));
|
||||
reverb->nextRingBufPos = 0;
|
||||
reverb->unk_20 = 0;
|
||||
reverb->unk_03 = 0;
|
||||
reverb->unk_24 = reverb->windowSize;
|
||||
reverb->unk_02 = 2;
|
||||
reverb->unk_00 = 1;
|
||||
reverb->curFrame = 0;
|
||||
reverb->bufSizePerChan = reverb->windowSize;
|
||||
reverb->framesToIgnore = 2;
|
||||
reverb->resampleFlags = 1;
|
||||
reverb->sound.sample = &reverb->sample;
|
||||
reverb->sample.loop = &reverb->loop;
|
||||
reverb->sound.tuning = 1.0f;
|
||||
reverb->sample.bits4 = 4;
|
||||
reverb->sample.bits2 = 0;
|
||||
reverb->sample.bits24 = reverb->windowSize * 2;
|
||||
reverb->sample.sampleAddr = (u8*)reverb->unk_28;
|
||||
reverb->sample.size = reverb->windowSize * 2;
|
||||
reverb->sample.sampleAddr = (u8*)reverb->leftRingBuf;
|
||||
reverb->loop.start = 0;
|
||||
reverb->loop.count = 1;
|
||||
reverb->loop.end = reverb->windowSize;
|
||||
|
||||
if (reverb->downsampleRate != 1) {
|
||||
reverb->unk_0E = 0x8000 / reverb->downsampleRate;
|
||||
reverb->unk_30 = Audio_AllocZeroed(&gAudioContext.gNotesAndBuffersPool, 0x20);
|
||||
reverb->unk_34 = Audio_AllocZeroed(&gAudioContext.gNotesAndBuffersPool, 0x20);
|
||||
reverb->unk_38 = Audio_AllocZeroed(&gAudioContext.gNotesAndBuffersPool, 0x20);
|
||||
reverb->unk_3C = Audio_AllocZeroed(&gAudioContext.gNotesAndBuffersPool, 0x20);
|
||||
for (j = 0; j < gAudioContext.gAudioBufferParameters.updatesPerFrame; j++) {
|
||||
mem = func_800DE258(&gAudioContext.gNotesAndBuffersPool, 0x340);
|
||||
reverb->unk_30 = Audio_AllocZeroed(&gAudioContext.notesAndBuffersPool, 0x20);
|
||||
reverb->unk_34 = Audio_AllocZeroed(&gAudioContext.notesAndBuffersPool, 0x20);
|
||||
reverb->unk_38 = Audio_AllocZeroed(&gAudioContext.notesAndBuffersPool, 0x20);
|
||||
reverb->unk_3C = Audio_AllocZeroed(&gAudioContext.notesAndBuffersPool, 0x20);
|
||||
for (j = 0; j < gAudioContext.audioBufferParameters.updatesPerFrame; j++) {
|
||||
mem = func_800DE258(&gAudioContext.notesAndBuffersPool, 0x340);
|
||||
reverb->items[0][j].toDownsampleLeft = mem;
|
||||
reverb->items[0][j].toDownsampleRight = mem + 0x1A0 / sizeof(s16);
|
||||
mem = func_800DE258(&gAudioContext.gNotesAndBuffersPool, 0x340);
|
||||
mem = func_800DE258(&gAudioContext.notesAndBuffersPool, 0x340);
|
||||
reverb->items[1][j].toDownsampleLeft = mem;
|
||||
reverb->items[1][j].toDownsampleRight = mem + 0x1A0 / sizeof(s16);
|
||||
}
|
||||
}
|
||||
|
||||
if (settings->unk_14 != 0) {
|
||||
reverb->unk_278 = Audio_AllocDmaMemoryZeroed(&gAudioContext.gNotesAndBuffersPool, 0x40);
|
||||
reverb->unk_270 = Audio_AllocDmaMemory(&gAudioContext.gNotesAndBuffersPool, 8 * sizeof(s16));
|
||||
reverb->unk_278 = Audio_AllocDmaMemoryZeroed(&gAudioContext.notesAndBuffersPool, 0x40);
|
||||
reverb->unk_270 = Audio_AllocDmaMemory(&gAudioContext.notesAndBuffersPool, 8 * sizeof(s16));
|
||||
func_800DF5DC(reverb->unk_270, settings->unk_14);
|
||||
} else {
|
||||
reverb->unk_270 = NULL;
|
||||
}
|
||||
|
||||
if (settings->unk_16 != 0) {
|
||||
reverb->unk_27C = Audio_AllocDmaMemoryZeroed(&gAudioContext.gNotesAndBuffersPool, 0x40);
|
||||
reverb->unk_274 = Audio_AllocDmaMemory(&gAudioContext.gNotesAndBuffersPool, 8 * sizeof(s16));
|
||||
reverb->unk_27C = Audio_AllocDmaMemoryZeroed(&gAudioContext.notesAndBuffersPool, 0x40);
|
||||
reverb->unk_274 = Audio_AllocDmaMemory(&gAudioContext.notesAndBuffersPool, 8 * sizeof(s16));
|
||||
func_800DF5DC(reverb->unk_274, settings->unk_16);
|
||||
} else {
|
||||
reverb->unk_274 = NULL;
|
||||
|
@ -959,17 +960,17 @@ void func_800DFBF8(void) {
|
|||
}
|
||||
|
||||
Audio_InitSequencePlayers();
|
||||
for (j = 0; j < gAudioContext.gAudioBufferParameters.numSequencePlayers; j++) {
|
||||
for (j = 0; j < gAudioContext.audioBufferParameters.numSequencePlayers; j++) {
|
||||
func_800EC734(j);
|
||||
Audio_ResetSequencePlayer(&gAudioContext.gSequencePlayers[j]);
|
||||
Audio_ResetSequencePlayer(&gAudioContext.seqPlayers[j]);
|
||||
}
|
||||
|
||||
func_800E0634(preset->unk_30, preset->unk_34);
|
||||
func_800E1618(gAudioContext.gMaxSimultaneousNotes);
|
||||
func_800E1618(gAudioContext.maxSimultaneousNotes);
|
||||
gAudioContext.unk_176C = 0;
|
||||
func_800E3400();
|
||||
Audio_SyncLoadsInit();
|
||||
func_800E4FB0();
|
||||
func_800E3A14();
|
||||
Audio_AsyncLoadReqInit();
|
||||
gAudioContext.unk_4 = 0x1000;
|
||||
func_800E4D94();
|
||||
intMask = osSetIntMask(1);
|
||||
|
@ -1027,13 +1028,13 @@ void* func_800E05C4(u32 size, s32 arg1, void* arg2, s8 arg3, s32 arg4) {
|
|||
void func_800E0634(u32 arg0, u32 arg1) {
|
||||
void* mem;
|
||||
|
||||
mem = func_800DE2B0(&gAudioContext.gNotesAndBuffersPool, arg0);
|
||||
mem = func_800DE2B0(&gAudioContext.notesAndBuffersPool, arg0);
|
||||
if (mem == NULL) {
|
||||
gAudioContext.unk_2EE0.pool.size = 0;
|
||||
} else {
|
||||
Audio_SoundAllocPoolInit(&gAudioContext.unk_2EE0.pool, mem, arg0);
|
||||
}
|
||||
mem = func_800DE2B0(&gAudioContext.gNotesAndBuffersPool, arg1);
|
||||
mem = func_800DE2B0(&gAudioContext.notesAndBuffersPool, arg1);
|
||||
if (mem == NULL) {
|
||||
gAudioContext.unk_3174.pool.size = 0;
|
||||
} else {
|
||||
|
@ -1073,10 +1074,10 @@ UnkHeapEntry* func_800E06CC(u32 size) {
|
|||
|
||||
index = -1;
|
||||
for (i = 0; i < gAudioContext.unk_176C; i++) {
|
||||
thing = &gAudioContext.unk_0D68[i];
|
||||
thing = &gAudioContext.unk_0D54[i + 1];
|
||||
if (thing->unk_10 == 0) {
|
||||
start = thing->unk_08;
|
||||
end = thing->unk_08 + thing->sample->bits24 - 1;
|
||||
end = thing->unk_08 + thing->sample->size - 1;
|
||||
|
||||
if (end < allocBefore && start < allocBefore) {
|
||||
continue;
|
||||
|
@ -1131,7 +1132,7 @@ void func_800E0964(UnkHeapEntry* entry, s32 bankId) {
|
|||
s32 drumId;
|
||||
s32 sfxId;
|
||||
|
||||
for (instId = 0; instId < gAudioContext.gCtlEntries[bankId].numInstruments; instId++) {
|
||||
for (instId = 0; instId < gAudioContext.ctlEntries[bankId].numInstruments; instId++) {
|
||||
inst = Audio_GetInstrumentInner(bankId, instId);
|
||||
if (inst != NULL) {
|
||||
if (inst->normalRangeLo != 0) {
|
||||
|
@ -1144,14 +1145,14 @@ void func_800E0964(UnkHeapEntry* entry, s32 bankId) {
|
|||
}
|
||||
}
|
||||
|
||||
for (drumId = 0; drumId < gAudioContext.gCtlEntries[bankId].numDrums; drumId++) {
|
||||
for (drumId = 0; drumId < gAudioContext.ctlEntries[bankId].numDrums; drumId++) {
|
||||
drum = Audio_GetDrum(bankId, drumId);
|
||||
if (drum != NULL) {
|
||||
func_800E0BB4(entry, drum->sound.sample);
|
||||
}
|
||||
}
|
||||
|
||||
for (sfxId = 0; sfxId < gAudioContext.gCtlEntries[bankId].numSfx; sfxId++) {
|
||||
for (sfxId = 0; sfxId < gAudioContext.ctlEntries[bankId].numSfx; sfxId++) {
|
||||
sfx = Audio_GetSfx(bankId, sfxId);
|
||||
if (sfx != NULL) {
|
||||
func_800E0BB4(entry, sfx->sample);
|
||||
|
@ -1165,10 +1166,10 @@ void func_800E0AD8(UnkHeapEntry* entry) {
|
|||
s32 unk3;
|
||||
s32 bankId;
|
||||
|
||||
numBanks = *gAudioContext.unk_2834;
|
||||
numBanks = gAudioContext.audioBankTable->header.entryCnt;
|
||||
for (bankId = 0; bankId < numBanks; bankId++) {
|
||||
unk2 = gAudioContext.gCtlEntries[bankId].unk_02;
|
||||
unk3 = gAudioContext.gCtlEntries[bankId].unk_03;
|
||||
unk2 = gAudioContext.ctlEntries[bankId].unk_02;
|
||||
unk3 = gAudioContext.ctlEntries[bankId].unk_03;
|
||||
if (((unk2 != 0xFF) && (entry->unk_02 == unk2)) || ((unk3 != 0xFF) && (entry->unk_02 == unk3)) ||
|
||||
entry->unk_02 == 0) {
|
||||
if (func_800DF074(1, 2, bankId) != NULL) {
|
||||
|
@ -1220,10 +1221,10 @@ void func_800E0CBC(void) {
|
|||
s32 bankId;
|
||||
s32 j;
|
||||
|
||||
numBanks = *gAudioContext.unk_2834;
|
||||
numBanks = gAudioContext.audioBankTable->header.entryCnt;
|
||||
for (bankId = 0; bankId < numBanks; bankId++) {
|
||||
unk2 = gAudioContext.gCtlEntries[bankId].unk_02;
|
||||
unk3 = gAudioContext.gCtlEntries[bankId].unk_03;
|
||||
unk2 = gAudioContext.ctlEntries[bankId].unk_02;
|
||||
unk3 = gAudioContext.ctlEntries[bankId].unk_03;
|
||||
if ((unk2 == 0xFF) && (unk3 == 0xFF)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -1268,8 +1269,8 @@ void func_800E0E90(s32 id) {
|
|||
}
|
||||
|
||||
void func_800E0EB4(s32 arg0, s32 id) {
|
||||
ManyStruct_800E0E0C_2* manyThing;
|
||||
Struct_800E0E0C_2* thing;
|
||||
AudioTable* audioTable;
|
||||
AudioTableEntry* thing;
|
||||
s32 numBanks;
|
||||
s32 instId;
|
||||
s32 drumId;
|
||||
|
@ -1284,19 +1285,19 @@ void func_800E0EB4(s32 arg0, s32 id) {
|
|||
u8** fakematch;
|
||||
s32 pad[4];
|
||||
|
||||
manyThing = gAudioContext.unk_2838;
|
||||
numBanks = *gAudioContext.unk_2834;
|
||||
audioTable = gAudioContext.audioTable;
|
||||
numBanks = gAudioContext.audioBankTable->header.entryCnt;
|
||||
sp78.unk_0 = func_800DF074(2, 2, id);
|
||||
if (sp78.unk_0 == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
thing = &manyThing->unk_C[id];
|
||||
sp78.unk_8 = thing->unk_8;
|
||||
sp78.unk_C = thing->unk_C;
|
||||
thing = &audioTable->entries[id];
|
||||
sp78.unk_8 = thing->size;
|
||||
sp78.unk_C = thing->unk_08;
|
||||
|
||||
if ((sp78.unk_C == 2) || (sp78.unk_C == 3)) {
|
||||
sp78.unk_4 = thing->unk_4;
|
||||
sp78.unk_4 = thing->romAddr;
|
||||
} else {
|
||||
sp78.unk_4 = NULL;
|
||||
}
|
||||
|
@ -1310,8 +1311,8 @@ void func_800E0EB4(s32 arg0, s32 id) {
|
|||
}
|
||||
|
||||
for (bankId = 0; bankId < numBanks; bankId++) {
|
||||
unk2 = gAudioContext.gCtlEntries[bankId].unk_02;
|
||||
unk3 = gAudioContext.gCtlEntries[bankId].unk_03;
|
||||
unk2 = gAudioContext.ctlEntries[bankId].unk_02;
|
||||
unk3 = gAudioContext.ctlEntries[bankId].unk_03;
|
||||
if ((unk2 != 0xFF) || (unk3 != 0xFF)) {
|
||||
if (!Audio_IsBankLoadComplete(bankId) || func_800DF074(1, 2, bankId) == NULL) {
|
||||
continue;
|
||||
|
@ -1323,7 +1324,7 @@ void func_800E0EB4(s32 arg0, s32 id) {
|
|||
continue;
|
||||
}
|
||||
|
||||
for (instId = 0; instId < gAudioContext.gCtlEntries[bankId].numInstruments; instId++) {
|
||||
for (instId = 0; instId < gAudioContext.ctlEntries[bankId].numInstruments; instId++) {
|
||||
inst = Audio_GetInstrumentInner(bankId, instId);
|
||||
if (inst != NULL) {
|
||||
if (inst->normalRangeLo != 0) {
|
||||
|
@ -1336,14 +1337,14 @@ void func_800E0EB4(s32 arg0, s32 id) {
|
|||
}
|
||||
}
|
||||
|
||||
for (drumId = 0; drumId < gAudioContext.gCtlEntries[bankId].numDrums; drumId++) {
|
||||
for (drumId = 0; drumId < gAudioContext.ctlEntries[bankId].numDrums; drumId++) {
|
||||
drum = Audio_GetDrum(bankId, drumId);
|
||||
if (drum != NULL) {
|
||||
func_800E0E0C(&sp78, drum->sound.sample);
|
||||
}
|
||||
}
|
||||
|
||||
for (sfxId = 0; sfxId < gAudioContext.gCtlEntries[bankId].numSfx; sfxId++) {
|
||||
for (sfxId = 0; sfxId < gAudioContext.ctlEntries[bankId].numSfx; sfxId++) {
|
||||
sfx = Audio_GetSfx(bankId, sfxId);
|
||||
if (sfx != NULL) {
|
||||
func_800E0E0C(&sp78, sfx->sample);
|
||||
|
@ -1359,7 +1360,7 @@ void func_800E1148(void) {
|
|||
TemporaryPool* temporary;
|
||||
u32 i;
|
||||
|
||||
pool = &gAudioContext.gUnusedLoadedPool;
|
||||
pool = &gAudioContext.unusedLoadedPool;
|
||||
temporary = &pool->temporary;
|
||||
|
||||
if (temporary->entries[0].id != -1) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue