1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-10 19:20:13 +00:00

Audio retail OK (#1650)

* general OK

* wait for data

* sfx and sequence

* PR Suggestions

* debug file

* data

* PR
This commit is contained in:
engineer124 2024-01-31 10:24:13 +11:00 committed by GitHub
parent 17f08788aa
commit af6b821193
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 1440 additions and 1385 deletions

View file

@ -119,4 +119,10 @@ typedef struct {
u16 params;
} SfxParams;
#if OOT_DEBUG
#define SFX_DIST_SCALING 1.0f
#else
#define SFX_DIST_SCALING 10.0f
#endif
#endif

1382
src/audio/debug.inc.c Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -43,7 +43,7 @@ void Audio_StartSequence(u8 seqPlayerIndex, u8 seqId, u8 seqArgs, u16 fadeInDura
if (!gStartSeqDisabled || (seqPlayerIndex == SEQ_PLAYER_SFX)) {
seqArgs &= 0x7F;
if (seqArgs == 0x7F) {
if (OOT_DEBUG && (seqArgs == 0x7F)) {
// `fadeInDuration` is interpreted as skip ticks
duration = (fadeInDuration >> 3) * 60 * gAudioCtx.audioBufferParameters.updatesPerFrame;
Audio_QueueCmdS32(0x85000000 | _SHIFTL(seqPlayerIndex, 16, 8) | _SHIFTL(seqId, 8, 8), duration);
@ -103,10 +103,12 @@ void Audio_ProcessSeqCmd(u32 cmd) {
f32 freqScaleTarget;
s32 pad;
#if OOT_DEBUG
if (gAudioDebugPrintSeqCmd && (cmd & SEQCMD_OP_MASK) != (SEQCMD_OP_SET_PLAYER_IO << 28)) {
AudioDebug_ScrPrt("SEQ H", (cmd >> 16) & 0xFFFF);
AudioDebug_ScrPrt(" L", cmd & 0xFFFF);
}
#endif
op = cmd >> 28;
seqPlayerIndex = (cmd & 0xF000000) >> 24;

View file

@ -70,6 +70,8 @@ void Audio_PlaySfxGeneral(u16 sfxId, Vec3f* pos, u8 token, f32* freqScale, f32*
if (!gSfxBankMuted[SFX_BANK_SHIFT(sfxId)]) {
req = &sSfxRequests[gSfxRequestWriteIndex];
#if OOT_DEBUG
if (!gAudioSfxSwapOff) {
for (i = 0; i < 10; i++) {
if (sfxId == gAudioSfxSwapSource[i]) {
@ -89,6 +91,8 @@ void Audio_PlaySfxGeneral(u16 sfxId, Vec3f* pos, u8 token, f32* freqScale, f32*
}
}
}
#endif
req->sfxId = sfxId;
req->pos = pos;
req->token = token;
@ -164,10 +168,14 @@ void Audio_ProcessSfxRequest(void) {
}
bankId = SFX_BANK(req->sfxId);
#if OOT_DEBUG
if ((1 << bankId) & D_801333F0) {
AudioDebug_ScrPrt("SE", req->sfxId);
bankId = SFX_BANK(req->sfxId);
}
#endif
count = 0;
index = gSfxBanks[bankId][0].next;
while (index != 0xFF && index != 0) {
@ -318,7 +326,7 @@ void Audio_ChooseActiveSfx(u8 bankId) {
entry->dist = 0.0f;
} else {
tempf1 = *entry->posY * 1;
entry->dist = (SQ(*entry->posX) + SQ(tempf1) + SQ(*entry->posZ)) * 1;
entry->dist = (SQ(*entry->posX) + SQ(tempf1) + SQ(*entry->posZ)) / SFX_DIST_SCALING;
}
sfxImportance = entry->sfxImportance;
if (entry->sfxParams & SFX_FLAG_4) {
@ -718,6 +726,8 @@ void Audio_ResetSfx(void) {
gSfxBanks[bankId][i].prev = i - 1;
gSfxBanks[bankId][i].next = 0xFF;
}
#if OOT_DEBUG
if (D_801333F8 == 0) {
for (bankId = 0; bankId < 10; bankId++) {
gAudioSfxSwapSource[bankId] = 0;
@ -726,4 +736,5 @@ void Audio_ResetSfx(void) {
}
D_801333F8++;
}
#endif
}