1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-10 17:00:19 +00:00
This commit is contained in:
zelda2774 2021-08-25 23:09:24 +02:00
parent 6c76c1875d
commit 1b057824f7
7 changed files with 120 additions and 150 deletions

View file

@ -621,46 +621,46 @@ void func_800DF1D8(f32 arg0, f32 arg1, u16* arg2) {
}
}
void func_800DF5AC(s16* arg0) {
void func_800DF5AC(s16* filter) {
s32 i;
for (i = 0; i < 8; i++) {
arg0[i] = 0;
filter[i] = 0;
}
}
void func_800DF5DC(s16* arg0, s32 arg1) {
void func_800DF5DC(s16* filter, s32 arg1) {
s32 i;
s16* ptr = &D_80130228[8 * arg1];
for (i = 0; i < 8; i++) {
arg0[i] = ptr[i];
filter[i] = ptr[i];
}
}
void func_800DF630(s16* arg0, s32 arg1) {
void func_800DF630(s16* filter, s32 arg1) {
s32 i;
s16* ptr = &D_80130328[8 * (arg1 - 1)];
for (i = 0; i < 8; i++) {
arg0[i] = ptr[i];
filter[i] = ptr[i];
}
}
void func_800DF688(s16* arg0, s32 arg1, s32 arg2) {
void func_800DF688(s16* filter, s32 arg1, s32 arg2) {
s32 i;
if (arg1 == 0 && arg2 == 0) {
func_800DF5DC(arg0, 0);
func_800DF5DC(filter, 0);
} else if (arg2 == 0) {
func_800DF5DC(arg0, arg1);
func_800DF5DC(filter, arg1);
} else if (arg1 == 0) {
func_800DF630(arg0, arg2);
func_800DF630(filter, arg2);
} else {
s16* ptr1 = &D_80130228[8 * arg1];
s16* ptr2 = &D_80130328[8 * (arg2 - 1)];
for (i = 0; i < 8; i++) {
arg0[i] = (ptr1[i] + ptr2[i]) / 2;
filter[i] = (ptr1[i] + ptr2[i]) / 2;
}
}
}

View file

@ -6,7 +6,7 @@ typedef enum { LOAD_STATUS_WAITING, LOAD_STATUS_START, LOAD_STATUS_LOADING, LOAD
#define RELOC(v, base) (reloc = (void*)((u32)v + (u32)base))
/* forward declarations */
s32 func_800E217C(s32 playerIdx, s32, s32);
s32 func_800E217C(s32 playerIndex, s32, s32);
unk_ldr* func_800E2454(u32 bankId);
AudioBankSample* Audio_GetBankSample(s32 bankId, s32 sfxId);
void Audio_ProcessAsyncLoads(s32 arg0);
@ -381,27 +381,27 @@ void func_800E202C(s32 arg0) {
Audio_DiscardBank(arg0);
}
s32 func_800E20D4(s32 playerIdx, s32 seqId, s32 arg2) {
s32 func_800E20D4(s32 playerIndex, s32 seqId, s32 arg2) {
if (gAudioContext.resetTimer != 0) {
return 0;
} else {
gAudioContext.seqPlayers[playerIdx].unk_DC = 0;
return func_800E217C(playerIdx, seqId, arg2);
gAudioContext.seqPlayers[playerIndex].unk_DC = 0;
return func_800E217C(playerIndex, seqId, arg2);
}
}
s32 func_800E2124(s32 playerIdx, s32 seqId, s32 arg2) {
s32 func_800E2124(s32 playerIndex, s32 seqId, s32 arg2) {
if (gAudioContext.resetTimer != 0) {
return 0;
}
gAudioContext.seqPlayers[playerIdx].unk_DC = arg2;
return func_800E217C(playerIdx, seqId, 0);
gAudioContext.seqPlayers[playerIndex].unk_DC = arg2;
return func_800E217C(playerIndex, seqId, 0);
}
// InitSeqPlayer
s32 func_800E217C(s32 playerIdx, s32 seqId, s32 arg2) {
SequencePlayer* seqPlayer = &gAudioContext.seqPlayers[playerIdx];
s32 func_800E217C(s32 playerIndex, s32 seqId, s32 arg2) {
SequencePlayer* seqPlayer = &gAudioContext.seqPlayers[playerIndex];
u8* seqData;
s32 phi_s0;
s32 phi_s1;
@ -437,7 +437,7 @@ s32 func_800E217C(s32 playerIdx, s32 seqId, s32 arg2) {
seqPlayer->scriptState.depth = 0;
seqPlayer->delay = 0;
seqPlayer->finished = 0;
seqPlayer->seqVariationEu = playerIdx;
seqPlayer->playerIndex = playerIndex;
Audio_ProcessSequence(seqPlayer);
}

View file

@ -95,7 +95,7 @@ void Audio_NoteSetVelPanReverb(Note* note, NoteSubEu* sub, Reverb* reverb) {
sub->targetVolRight = (s32)((vel * volRight) * 4095.999f);
sub->unk_2 = reverb->unk_1;
sub->unk_14 = reverb->unk_10;
sub->filter = reverb->filter;
sub->unk_07 = reverb->unk_14;
sub->unk_0E = reverb->unk_16;
sub->reverbVol = reverbVol;
@ -256,7 +256,7 @@ void Audio_ProcessNotes(void) {
reverb.vol = attributes->reverb;
reverb.reverbBits = attributes->reverbBits;
reverb.unk_1 = attributes->unk_1;
reverb.unk_10 = attributes->unk_10;
reverb.filter = attributes->filter;
reverb.unk_14 = attributes->unk_4;
reverb.unk_16 = attributes->unk_6;
bookOffset = noteSubEu->bitField1.s.bookOffset;
@ -274,7 +274,7 @@ void Audio_ProcessNotes(void) {
}
reverb.vol = channel->reverb;
reverb.unk_1 = channel->unk_0C;
reverb.unk_10 = channel->unk_CC;
reverb.filter = channel->filter;
reverb.unk_14 = channel->unk_0F;
reverb.unk_16 = channel->unk_20;
bookOffset = channel->bookOffset & 0x7;
@ -471,13 +471,13 @@ void Audio_SeqChanLayerDecayRelease(SequenceChannelLayer* seqLayer, s32 target)
chan = seqLayer->seqChannel;
attributes->reverb = chan->reverb;
attributes->unk_1 = chan->unk_0C;
attributes->unk_10 = chan->unk_CC;
attributes->filter = chan->filter;
if (attributes->unk_10 != NULL) {
if (attributes->filter != NULL) {
for (i = 0; i < 8; i++) {
attributes->unk_14[i] = attributes->unk_10[i];
attributes->filterBuf[i] = attributes->filter[i];
}
attributes->unk_10 = attributes->unk_14;
attributes->filter = attributes->filterBuf;
}
attributes->unk_6 = chan->unk_20;

View file

@ -144,7 +144,7 @@ void Audio_SequenceChannelInit(SequenceChannel* seqChannel) {
seqChannel->vibratoRateChangeDelay = 0;
seqChannel->vibratoExtentChangeDelay = 0;
seqChannel->vibratoDelay = 0;
seqChannel->unk_CC = NULL;
seqChannel->filter = NULL;
seqChannel->unk_20 = 0;
seqChannel->unk_0F = 0;
seqChannel->volume = 1.0f;
@ -1275,7 +1275,7 @@ void Audio_SequenceChannelProcessScript(SequenceChannel* channel) {
channel->vibratoRateTarget = 0;
channel->vibratoRateStart = 0;
channel->vibratoRateChangeDelay = 0;
channel->unk_CC = NULL;
channel->filter = NULL;
channel->unk_0C = 0;
channel->adsr.sustain = 0;
channel->velocityRandomVariance = 0;
@ -1295,18 +1295,18 @@ void Audio_SequenceChannelProcessScript(SequenceChannel* channel) {
case 0xB0:
offset = (u16)parameters[0];
data = seqPlayer->seqData + offset;
channel->unk_CC = (s16*)data;
channel->filter = (s16*)data;
break;
case 0xB1:
channel->unk_CC = NULL;
channel->filter = NULL;
break;
case 0xB3:
command = parameters[0];
if (channel->unk_CC != NULL) {
if (channel->filter != NULL) {
lowBits = (command >> 4) & 0xF;
command &= 0xF;
func_800DF688(channel->unk_CC, lowBits, command);
func_800DF688(channel->filter, lowBits, command);
}
break;
case 0xB2:
@ -1676,11 +1676,11 @@ void Audio_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
case 0xC4:
command = Audio_M64ReadU8(seqScript);
if (command == 0xFF) {
command = seqPlayer->seqVariationEu;
command = seqPlayer->playerIndex;
}
commandLow = Audio_M64ReadU8(seqScript);
func_800E20D4(command, commandLow, 0);
if (command == (u8)seqPlayer->seqVariationEu) {
if (command == (u8)seqPlayer->playerIndex) {
return;
}
break;

View file

@ -34,7 +34,7 @@ extern u32 D_801304A8;
extern u32 D_801304AC;
extern u8 D_801304C0[];
void AudioSynth_InitNextRingBuf(s32 chunkSize, s32 bufIndex, s32 reverbIndex) {
void AudioSynth_InitNextRingBuf(s32 chunkLen, s32 bufIndex, s32 reverbIndex) {
ReverbRingBufferItem* bufItem;
s32 pad[3];
SynthesisReverb* reverb = &gAudioContext.synthesisReverbs[reverbIndex];
@ -64,7 +64,7 @@ void AudioSynth_InitNextRingBuf(s32 chunkSize, s32 bufIndex, s32 reverbIndex) {
}
bufItem = &reverb->items[reverb->curFrame][bufIndex];
sampleCnt = chunkSize / reverb->downsampleRate;
sampleCnt = chunkLen / reverb->downsampleRate;
extraSamples = (sampleCnt + reverb->nextRingBufPos) - reverb->bufSizePerChan;
temp_a0_2 = reverb->nextRingBufPos;
if (extraSamples < 0) {
@ -80,7 +80,7 @@ void AudioSynth_InitNextRingBuf(s32 chunkSize, s32 bufIndex, s32 reverbIndex) {
}
bufItem->numSamplesAfterDownsampling = sampleCnt;
bufItem->chunkLen = chunkSize;
bufItem->chunkLen = chunkLen;
if (reverb->unk_14 != 0) {
temp_a0_4 = reverb->unk_14 + temp_a0_2;
@ -88,7 +88,7 @@ void AudioSynth_InitNextRingBuf(s32 chunkSize, s32 bufIndex, s32 reverbIndex) {
temp_a0_4 -= reverb->bufSizePerChan;
}
bufItem = &reverb->items2[reverb->curFrame][bufIndex];
sampleCnt = chunkSize / reverb->downsampleRate;
sampleCnt = chunkLen / reverb->downsampleRate;
extraSamples = (temp_a0_4 + sampleCnt) - reverb->bufSizePerChan;
if (extraSamples < 0) {
bufItem->lengthA = sampleCnt * 2;
@ -100,7 +100,7 @@ void AudioSynth_InitNextRingBuf(s32 chunkSize, s32 bufIndex, s32 reverbIndex) {
bufItem->startPos = temp_a0_4;
}
bufItem->numSamplesAfterDownsampling = sampleCnt;
bufItem->chunkLen = chunkSize;
bufItem->chunkLen = chunkLen;
}
}
@ -125,7 +125,7 @@ void func_800DB03C(s32 arg0) {
}
Acmd* AudioSynth_Update(Acmd* cmdStart, s32* cmdCnt, s16* aiStart, s32 aiBufLen) {
s32 chunkSize;
s32 chunkLen;
s16* aiBufP;
Acmd* cmdP;
s32 i;
@ -142,25 +142,25 @@ Acmd* AudioSynth_Update(Acmd* cmdStart, s32* cmdCnt, s16* aiStart, s32 aiBufLen)
gAudioContext.curLoadedBook = NULL;
for (i = gAudioContext.audioBufferParameters.updatesPerFrame; i > 0; i--) {
if (i == 1) {
chunkSize = aiBufLen;
chunkLen = aiBufLen;
} else if ((aiBufLen / i) >= gAudioContext.audioBufferParameters.samplesPerUpdateMax) {
chunkSize = gAudioContext.audioBufferParameters.samplesPerUpdateMax;
chunkLen = gAudioContext.audioBufferParameters.samplesPerUpdateMax;
} else if (gAudioContext.audioBufferParameters.samplesPerUpdateMin >= (aiBufLen / i)) {
chunkSize = gAudioContext.audioBufferParameters.samplesPerUpdateMin;
chunkLen = gAudioContext.audioBufferParameters.samplesPerUpdateMin;
} else {
chunkSize = gAudioContext.audioBufferParameters.samplesPerUpdate;
chunkLen = gAudioContext.audioBufferParameters.samplesPerUpdate;
}
for (j = 0; j < gAudioContext.numSynthesisReverbs; j++) {
if (gAudioContext.synthesisReverbs[j].useReverb) {
AudioSynth_InitNextRingBuf(chunkSize, gAudioContext.audioBufferParameters.updatesPerFrame - i, j);
AudioSynth_InitNextRingBuf(chunkLen, gAudioContext.audioBufferParameters.updatesPerFrame - i, j);
}
}
cmdP = AudioSynth_DoOneAudioUpdate(aiBufP, chunkSize, cmdP,
cmdP = AudioSynth_DoOneAudioUpdate(aiBufP, chunkLen, cmdP,
gAudioContext.audioBufferParameters.updatesPerFrame - i);
aiBufLen -= chunkSize;
aiBufP += chunkSize * 2;
aiBufLen -= chunkLen;
aiBufP += chunkLen * 2;
}
for (j = 0; j < gAudioContext.numSynthesisReverbs; j++) {
@ -702,7 +702,7 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
u32 nSamplesToLoad;
u16 unk7;
u16 unkE;
s16* thing4;
s16* filter;
s32 bookOffset;
s32 finished;
s32 aligned;
@ -745,7 +745,6 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
if (noteSubEu->bitField1.s.isSyntheticWave) {
cmd = AudioSynth_LoadWaveSamples(cmd, noteSubEu, synthState, nSamplesToLoad);
// loopInfo = loopInfo;
noteSamplesDmemAddrBeforeResampling = DMEM_UNCOMPRESSED_NOTE + (synthState->samplePosInt * 2);
synthState->samplePosInt += nSamplesToLoad;
} else {
@ -1014,9 +1013,9 @@ Acmd* AudioSynth_ProcessNote(s32 noteIndex, NoteSubEu* noteSubEu, NoteSynthesisS
AudioSynth_HiLoGain(cmd++, phi_a1_2, DMEM_TEMP, 0, (aiBufLen * 2) + 0x20);
}
thing4 = noteSubEu->unk_14;
if (thing4 != 0) {
AudioSynth_SetFilterCount(cmd++, aiBufLen * 2, thing4);
filter = noteSubEu->filter;
if (filter != 0) {
AudioSynth_SetFilterCount(cmd++, aiBufLen * 2, filter);
AudioSynth_SetFilter(cmd++, flags, DMEM_TEMP, synthState->synthesisBuffers->mixEnvelopeState);
}