mirror of
https://github.com/zeldaret/oot.git
synced 2024-11-10 19:20:13 +00:00
Introduce Mutebehavior Flags (#1304)
* Add muteBehavior flags * touchup * Adjust comment
This commit is contained in:
parent
f2d4c3b10b
commit
8778bf09b5
5 changed files with 17 additions and 10 deletions
|
@ -12,6 +12,12 @@
|
|||
|
||||
#define MAX_CHANNELS_PER_BANK 3
|
||||
|
||||
#define MUTE_BEHAVIOR_3 (1 << 3) // prevent further noteSubEus from playing
|
||||
#define MUTE_BEHAVIOR_4 (1 << 4) // stop something in seqLayer scripts
|
||||
#define MUTE_BEHAVIOR_SOFTEN (1 << 5) // lower volume, by default to half
|
||||
#define MUTE_BEHAVIOR_STOP_NOTES (1 << 6) // prevent further notes from playing
|
||||
#define MUTE_BEHAVIOR_STOP_SCRIPT (1 << 7) // stop processing sequence/channel scripts
|
||||
|
||||
#define ADSR_DISABLE 0
|
||||
#define ADSR_HANG -1
|
||||
#define ADSR_GOTO -2
|
||||
|
|
|
@ -8,7 +8,7 @@ void Audio_SequenceChannelProcessSound(SequenceChannel* channel, s32 recalculate
|
|||
|
||||
if (channel->changes.s.volume || recalculateVolume) {
|
||||
channelVolume = channel->volume * channel->volumeScale * channel->seqPlayer->appliedFadeVolume;
|
||||
if (channel->seqPlayer->muted && (channel->muteBehavior & 0x20)) {
|
||||
if (channel->seqPlayer->muted && (channel->muteBehavior & MUTE_BEHAVIOR_SOFTEN)) {
|
||||
channelVolume = channel->seqPlayer->muteVolumeScale * channelVolume;
|
||||
}
|
||||
channel->appliedVolume = channelVolume * channelVolume;
|
||||
|
|
|
@ -186,7 +186,7 @@ void Audio_ProcessNotes(void) {
|
|||
playbackState->unk_04 = 1;
|
||||
continue;
|
||||
} else if (playbackState->parentLayer->channel->seqPlayer->muted &&
|
||||
(playbackState->parentLayer->channel->muteBehavior & 0x40)) {
|
||||
(playbackState->parentLayer->channel->muteBehavior & MUTE_BEHAVIOR_STOP_NOTES)) {
|
||||
// do nothing
|
||||
} else {
|
||||
goto out;
|
||||
|
@ -277,7 +277,7 @@ void Audio_ProcessNotes(void) {
|
|||
subAttrs.unk_16 = channel->unk_20;
|
||||
bookOffset = channel->bookOffset & 0x7;
|
||||
|
||||
if (channel->seqPlayer->muted && (channel->muteBehavior & 8)) {
|
||||
if (channel->seqPlayer->muted && (channel->muteBehavior & MUTE_BEHAVIOR_3)) {
|
||||
subAttrs.frequency = 0.0f;
|
||||
subAttrs.velocity = 0.0f;
|
||||
}
|
||||
|
@ -481,7 +481,7 @@ void Audio_SeqLayerDecayRelease(SequenceLayer* layer, s32 target) {
|
|||
|
||||
attrs->unk_6 = chan->unk_20;
|
||||
attrs->unk_4 = chan->unk_0F;
|
||||
if (chan->seqPlayer->muted && (chan->muteBehavior & 8)) {
|
||||
if (chan->seqPlayer->muted && (chan->muteBehavior & MUTE_BEHAVIOR_3)) {
|
||||
note->noteSubEu.bitField0.finished = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1077,7 +1077,8 @@ s32 AudioSeq_SeqLayerProcessScriptStep3(SequenceLayer* layer, s32 cmd) {
|
|||
}
|
||||
}
|
||||
|
||||
if ((seqPlayer->muted && (channel->muteBehavior & (0x40 | 0x10)) != 0) || channel->stopSomething2) {
|
||||
if ((seqPlayer->muted && (channel->muteBehavior & (MUTE_BEHAVIOR_STOP_NOTES | MUTE_BEHAVIOR_4))) ||
|
||||
channel->stopSomething2) {
|
||||
layer->stopSomething = true;
|
||||
return PROCESS_SCRIPT_END;
|
||||
}
|
||||
|
@ -1160,7 +1161,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
|
|||
}
|
||||
|
||||
seqPlayer = channel->seqPlayer;
|
||||
if (seqPlayer->muted && (channel->muteBehavior & 0x80)) {
|
||||
if (seqPlayer->muted && (channel->muteBehavior & MUTE_BEHAVIOR_STOP_SCRIPT)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1737,7 +1738,7 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
|
|||
AudioLoad_SetSeqLoadStatus(seqPlayer->seqId, LOAD_STATUS_COMPLETE);
|
||||
AudioLoad_SetFontLoadStatus(seqPlayer->defaultFont, LOAD_STATUS_COMPLETE);
|
||||
|
||||
if (seqPlayer->muted && (seqPlayer->muteBehavior & 0x80)) {
|
||||
if (seqPlayer->muted && (seqPlayer->muteBehavior & MUTE_BEHAVIOR_STOP_SCRIPT)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2126,7 +2127,7 @@ void AudioSeq_InitSequencePlayer(SequencePlayer* seqPlayer) {
|
|||
seqPlayer->soundScriptIO[j] = -1;
|
||||
}
|
||||
|
||||
seqPlayer->muteBehavior = 0x40 | 0x20;
|
||||
seqPlayer->muteBehavior = MUTE_BEHAVIOR_SOFTEN | MUTE_BEHAVIOR_STOP_NOTES;
|
||||
seqPlayer->fadeVolumeScale = 1.0f;
|
||||
seqPlayer->bend = 1.0f;
|
||||
Audio_InitNoteLists(&seqPlayer->notePool);
|
||||
|
|
|
@ -264,8 +264,8 @@ void func_800E5584(AudioCmd* cmd) {
|
|||
NoteSubEu* subEu = ¬e->noteSubEu;
|
||||
|
||||
if (subEu->bitField0.enabled && note->playbackState.unk_04 == 0) {
|
||||
if (note->playbackState.parentLayer->channel->muteBehavior & 8) {
|
||||
subEu->bitField0.finished = 1;
|
||||
if (note->playbackState.parentLayer->channel->muteBehavior & MUTE_BEHAVIOR_3) {
|
||||
subEu->bitField0.finished = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue