mirror of
https://github.com/zeldaret/oot.git
synced 2024-11-14 05:19:36 +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:
parent
17f08788aa
commit
af6b821193
5 changed files with 1440 additions and 1385 deletions
|
@ -119,4 +119,10 @@ typedef struct {
|
||||||
u16 params;
|
u16 params;
|
||||||
} SfxParams;
|
} SfxParams;
|
||||||
|
|
||||||
|
#if OOT_DEBUG
|
||||||
|
#define SFX_DIST_SCALING 1.0f
|
||||||
|
#else
|
||||||
|
#define SFX_DIST_SCALING 10.0f
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
1382
src/audio/debug.inc.c
Normal file
1382
src/audio/debug.inc.c
Normal file
File diff suppressed because it is too large
Load diff
1420
src/audio/general.c
1420
src/audio/general.c
File diff suppressed because it is too large
Load diff
|
@ -43,7 +43,7 @@ void Audio_StartSequence(u8 seqPlayerIndex, u8 seqId, u8 seqArgs, u16 fadeInDura
|
||||||
|
|
||||||
if (!gStartSeqDisabled || (seqPlayerIndex == SEQ_PLAYER_SFX)) {
|
if (!gStartSeqDisabled || (seqPlayerIndex == SEQ_PLAYER_SFX)) {
|
||||||
seqArgs &= 0x7F;
|
seqArgs &= 0x7F;
|
||||||
if (seqArgs == 0x7F) {
|
if (OOT_DEBUG && (seqArgs == 0x7F)) {
|
||||||
// `fadeInDuration` is interpreted as skip ticks
|
// `fadeInDuration` is interpreted as skip ticks
|
||||||
duration = (fadeInDuration >> 3) * 60 * gAudioCtx.audioBufferParameters.updatesPerFrame;
|
duration = (fadeInDuration >> 3) * 60 * gAudioCtx.audioBufferParameters.updatesPerFrame;
|
||||||
Audio_QueueCmdS32(0x85000000 | _SHIFTL(seqPlayerIndex, 16, 8) | _SHIFTL(seqId, 8, 8), duration);
|
Audio_QueueCmdS32(0x85000000 | _SHIFTL(seqPlayerIndex, 16, 8) | _SHIFTL(seqId, 8, 8), duration);
|
||||||
|
@ -103,10 +103,12 @@ void Audio_ProcessSeqCmd(u32 cmd) {
|
||||||
f32 freqScaleTarget;
|
f32 freqScaleTarget;
|
||||||
s32 pad;
|
s32 pad;
|
||||||
|
|
||||||
|
#if OOT_DEBUG
|
||||||
if (gAudioDebugPrintSeqCmd && (cmd & SEQCMD_OP_MASK) != (SEQCMD_OP_SET_PLAYER_IO << 28)) {
|
if (gAudioDebugPrintSeqCmd && (cmd & SEQCMD_OP_MASK) != (SEQCMD_OP_SET_PLAYER_IO << 28)) {
|
||||||
AudioDebug_ScrPrt("SEQ H", (cmd >> 16) & 0xFFFF);
|
AudioDebug_ScrPrt("SEQ H", (cmd >> 16) & 0xFFFF);
|
||||||
AudioDebug_ScrPrt(" L", cmd & 0xFFFF);
|
AudioDebug_ScrPrt(" L", cmd & 0xFFFF);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
op = cmd >> 28;
|
op = cmd >> 28;
|
||||||
seqPlayerIndex = (cmd & 0xF000000) >> 24;
|
seqPlayerIndex = (cmd & 0xF000000) >> 24;
|
||||||
|
|
|
@ -70,6 +70,8 @@ void Audio_PlaySfxGeneral(u16 sfxId, Vec3f* pos, u8 token, f32* freqScale, f32*
|
||||||
|
|
||||||
if (!gSfxBankMuted[SFX_BANK_SHIFT(sfxId)]) {
|
if (!gSfxBankMuted[SFX_BANK_SHIFT(sfxId)]) {
|
||||||
req = &sSfxRequests[gSfxRequestWriteIndex];
|
req = &sSfxRequests[gSfxRequestWriteIndex];
|
||||||
|
|
||||||
|
#if OOT_DEBUG
|
||||||
if (!gAudioSfxSwapOff) {
|
if (!gAudioSfxSwapOff) {
|
||||||
for (i = 0; i < 10; i++) {
|
for (i = 0; i < 10; i++) {
|
||||||
if (sfxId == gAudioSfxSwapSource[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->sfxId = sfxId;
|
||||||
req->pos = pos;
|
req->pos = pos;
|
||||||
req->token = token;
|
req->token = token;
|
||||||
|
@ -164,10 +168,14 @@ void Audio_ProcessSfxRequest(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bankId = SFX_BANK(req->sfxId);
|
bankId = SFX_BANK(req->sfxId);
|
||||||
|
|
||||||
|
#if OOT_DEBUG
|
||||||
if ((1 << bankId) & D_801333F0) {
|
if ((1 << bankId) & D_801333F0) {
|
||||||
AudioDebug_ScrPrt("SE", req->sfxId);
|
AudioDebug_ScrPrt("SE", req->sfxId);
|
||||||
bankId = SFX_BANK(req->sfxId);
|
bankId = SFX_BANK(req->sfxId);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
index = gSfxBanks[bankId][0].next;
|
index = gSfxBanks[bankId][0].next;
|
||||||
while (index != 0xFF && index != 0) {
|
while (index != 0xFF && index != 0) {
|
||||||
|
@ -318,7 +326,7 @@ void Audio_ChooseActiveSfx(u8 bankId) {
|
||||||
entry->dist = 0.0f;
|
entry->dist = 0.0f;
|
||||||
} else {
|
} else {
|
||||||
tempf1 = *entry->posY * 1;
|
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;
|
sfxImportance = entry->sfxImportance;
|
||||||
if (entry->sfxParams & SFX_FLAG_4) {
|
if (entry->sfxParams & SFX_FLAG_4) {
|
||||||
|
@ -718,6 +726,8 @@ void Audio_ResetSfx(void) {
|
||||||
gSfxBanks[bankId][i].prev = i - 1;
|
gSfxBanks[bankId][i].prev = i - 1;
|
||||||
gSfxBanks[bankId][i].next = 0xFF;
|
gSfxBanks[bankId][i].next = 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if OOT_DEBUG
|
||||||
if (D_801333F8 == 0) {
|
if (D_801333F8 == 0) {
|
||||||
for (bankId = 0; bankId < 10; bankId++) {
|
for (bankId = 0; bankId < 10; bankId++) {
|
||||||
gAudioSfxSwapSource[bankId] = 0;
|
gAudioSfxSwapSource[bankId] = 0;
|
||||||
|
@ -726,4 +736,5 @@ void Audio_ResetSfx(void) {
|
||||||
}
|
}
|
||||||
D_801333F8++;
|
D_801333F8++;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue