1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-06 16:04:35 +00:00

Audio Sequence Player Ids Enum (#1040)

* bgm.h -> sequence.h

* First round of filling in enum

* More

* seqCmd

* format
This commit is contained in:
engineer124 2021-12-01 05:47:09 +11:00 committed by GitHub
parent d9c1dffe09
commit 783ef3a117
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 413 additions and 393 deletions

View file

@ -108,15 +108,15 @@ void Audio_SetSoundBanksMute(u16 muteMask) {
void Audio_QueueSeqCmdMute(u8 channelIdx) {
D_801333D0 |= (1 << channelIdx);
Audio_SetVolScale(0, 2, 0x40, 0xF);
Audio_SetVolScale(3, 2, 0x40, 0xF);
Audio_SetVolScale(SEQ_PLAYER_BGM_MAIN, 2, 0x40, 0xF);
Audio_SetVolScale(SEQ_PLAYER_BGM_SUB, 2, 0x40, 0xF);
}
void Audio_ClearBGMMute(u8 channelIdx) {
D_801333D0 &= ((1 << channelIdx) ^ 0xFFFF);
if (D_801333D0 == 0) {
Audio_SetVolScale(0, 2, 0x7F, 0xF);
Audio_SetVolScale(3, 2, 0x7F, 0xF);
Audio_SetVolScale(SEQ_PLAYER_BGM_MAIN, 2, 0x7F, 0xF);
Audio_SetVolScale(SEQ_PLAYER_BGM_SUB, 2, 0x7F, 0xF);
}
}
@ -496,7 +496,7 @@ void Audio_PlayActiveSounds(u8 bankId) {
entryIndex = gActiveSounds[bankId][i].entryIndex;
if (entryIndex != 0xFF) {
entry = &gSoundBanks[bankId][entryIndex];
channel = gAudioContext.seqPlayers[2].channels[sCurSfxPlayerChannelIdx];
channel = gAudioContext.seqPlayers[SEQ_PLAYER_SFX].channels[sCurSfxPlayerChannelIdx];
if (entry->state == SFX_STATE_READY) {
entry->channelIdx = sCurSfxPlayerChannelIdx;
if (entry->sfxParams & 8) {
@ -519,10 +519,11 @@ void Audio_PlayActiveSounds(u8 bankId) {
}
}
Audio_SetSoundProperties(bankId, entryIndex, sCurSfxPlayerChannelIdx);
Audio_QueueCmdS8(0x06020000 | ((sCurSfxPlayerChannelIdx & 0xFF) << 8), 1);
Audio_QueueCmdS8(0x06020000 | ((sCurSfxPlayerChannelIdx & 0xFF) << 8) | 4, entry->sfxId & 0xFF);
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | ((sCurSfxPlayerChannelIdx & 0xFF) << 8), 1);
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | ((sCurSfxPlayerChannelIdx & 0xFF) << 8) | 4,
entry->sfxId & 0xFF);
if (gIsLargeSoundBank[bankId]) {
Audio_QueueCmdS8(0x06020000 | ((sCurSfxPlayerChannelIdx & 0xFF) << 8) | 5,
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | ((sCurSfxPlayerChannelIdx & 0xFF) << 8) | 5,
(entry->sfxId & 0x100) >> 8);
}
if (entry->sfxId & 0xC00) {
@ -554,7 +555,7 @@ void Audio_StopSfxByBank(u8 bankId) {
while (entryIndex != 0xFF) {
entry = &gSoundBanks[bankId][entryIndex];
if (entry->state >= SFX_STATE_PLAYING_REFRESH) {
Audio_QueueCmdS8(0x06020000 | ((entry->channelIdx & 0xFF) << 8), 0);
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | ((entry->channelIdx & 0xFF) << 8), 0);
}
if (entry->state != SFX_STATE_EMPTY) {
Audio_RemoveSoundBankEntry(bankId, entryIndex);
@ -574,7 +575,7 @@ void func_800F8884(u8 bankId, Vec3f* pos) {
entry = &gSoundBanks[bankId][entryIndex];
if (entry->posX == &pos->x) {
if (entry->state >= SFX_STATE_PLAYING_REFRESH) {
Audio_QueueCmdS8(0x06020000 | ((entry->channelIdx & 0xFF) << 8), 0);
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | ((entry->channelIdx & 0xFF) << 8), 0);
}
if (entry->state != SFX_STATE_EMPTY) {
Audio_RemoveSoundBankEntry(bankId, entryIndex);
@ -616,7 +617,7 @@ void Audio_StopSfxByPosAndId(Vec3f* pos, u16 sfxId) {
entry = &gSoundBanks[SFX_BANK(sfxId)][entryIndex];
if (entry->posX == &pos->x && entry->sfxId == sfxId) {
if (entry->state >= SFX_STATE_PLAYING_REFRESH) {
Audio_QueueCmdS8(0x06020000 | ((entry->channelIdx & 0xFF) << 8), 0);
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | ((entry->channelIdx & 0xFF) << 8), 0);
}
if (entry->state != SFX_STATE_EMPTY) {
Audio_RemoveSoundBankEntry(SFX_BANK(sfxId), entryIndex);
@ -644,7 +645,7 @@ void Audio_StopSfxByTokenAndId(u8 token, u16 sfxId) {
entry = &gSoundBanks[SFX_BANK(sfxId)][entryIndex];
if (entry->token == token && entry->sfxId == sfxId) {
if (entry->state >= SFX_STATE_PLAYING_REFRESH) {
Audio_QueueCmdS8(0x06020000 | ((entry->channelIdx & 0xFF) << 8), 0);
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | ((entry->channelIdx & 0xFF) << 8), 0);
}
if (entry->state != SFX_STATE_EMPTY) {
Audio_RemoveSoundBankEntry(SFX_BANK(sfxId), entryIndex);
@ -671,7 +672,7 @@ void Audio_StopSfxById(u32 sfxId) {
entry = &gSoundBanks[SFX_BANK(sfxId)][entryIndex];
if (entry->sfxId == sfxId) {
if (entry->state >= SFX_STATE_PLAYING_REFRESH) {
Audio_QueueCmdS8(0x06020000 | ((entry->channelIdx & 0xFF) << 8), 0);
Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | ((entry->channelIdx & 0xFF) << 8), 0);
}
if (entry->state != SFX_STATE_EMPTY) {
Audio_RemoveSoundBankEntry(SFX_BANK(sfxId), entryIndex);
@ -715,7 +716,7 @@ void Audio_StepUnusedBankLerp(u8 bankId) {
void func_800F8F88(void) {
u8 bankId;
if (IS_SEQUENCE_CHANNEL_VALID(gAudioContext.seqPlayers[2].channels[0])) {
if (IS_SEQUENCE_CHANNEL_VALID(gAudioContext.seqPlayers[SEQ_PLAYER_SFX].channels[0])) {
sCurSfxPlayerChannelIdx = 0;
for (bankId = 0; bankId < ARRAY_COUNT(gSoundBanks); bankId++) {
Audio_ChooseActiveSounds(bankId);