diff options
| author | Glought <Glought@users.noreply.github.com> | 2025-11-20 10:31:41 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-20 13:31:41 -0500 |
| commit | ddee25d7ece8a1cd87cb33c321dac202a4daa4e3 (patch) | |
| tree | bf6dc9cddabeade3d961770c23f462db7c5fe783 /mm/src | |
| parent | 02d9170d141c9f9f8e6a14568efc7678f0d87236 (diff) | |
[Audio Editor] Port Audio Options from SoH Audio Editor (#1325)
* Ported Audio Options from SoH Audio Editor
*Moved "Mute Low HP Alarm" to Audio Editor -> Audio Options
Changed Cvar
From: "gEnhancements.Sfx.LowHpAlarm"
To: "gAudioEditor.LowHpAlarm"
*Moved "Mute Carpenter Sounds" to Audio Editor -> Audio Options
Changed Cvar
From: "gEnhancements.Sfx.MuteCarpenterSfx"
To: "gAudioEditor.MuteCarpenterSfx"
*Moved "Mute Crying Goron Child" to Audio Editor -> Audio Options
Changed Cvar
From: "gEnhancements.Sfx.ChildGoronCry"
To: "gAudioEditor.ChildGoronCry"
*Added "Disable Tatle Call Audio"
*Added "Disable Enemy Proximity Music"
*Added "Randomize All Music and Sound Effects on New Scene"
*Added "Randomize All Music and Sound Effects on Randomizer Generation"
*Added "Display Sequence Name on Overlay" and "Overlay Duration" Slider
*Added "Link's Voice Pitch Multiplier" Slider
* *Ported "AddSearchWidget" Functionally
Enabled for Audio Editor -> Audio Options
* Cleaned up some code I missed and ran clang format.
* Renamed "OnScene" Hook to "OnSceneChange"
* Made it so "Link's Voice Pitch Multiplier" slider only effects Link's voice.
* Forgot the "AudioHook.cpp" file its needed for the
"Display Sequence Name on Overlay" option.
* Moved the "Sfx" folder to the "Audio" folder.
* Removed extra line breaks between sections in "RegisterAudioWidgets()".
* Renamed "OnGenerationCompletion" hook to "OnRandoSeedGeneration"
* Changed "gAudioEditor.*" to use "CVAR_AUDIO("*") in "AudioEditor.cpp"
* Added "AddAudioSearchWidget" function
Changed all "BenGui::mBenMenu->AddSearchWidget lines to use
"AddAudioSearchWidget".
* Changed the "OnSeqPlayerInit" hook parameters type to use the "s32" Macro.
* Update BenMenu/BenGui include paths: Replaced "../../" with "2s2h/".
* Ran Clang Format.
* Added "DisableEnemyProximityMusic.cpp"
Added "VB_PLAY_ENEMY_PROXIMITY_MUSIC" enum to "GIVanillaBehavior" in
"GameInteractor.h"
"Audio_UpdateEnemyBgmVolume" is now wrapped in a "GameInteractor_Should"
* Added "DisableTatlCallAudio.cpp"
Added "VB_PLAY_TATL_CALL_AUDIO" enum to "GIVanillaBehavior" in
"GameInteractor.h"
"Audio_PlaySfx(NA_SE_VO_NAVY_CALL)" is now wrapped in a "GameInteractor_Should"
* Added "LinksVoicePitchMultiplier.cpp"
Added "Enable Link's Voice Pitch Multiplier" checkbox to Audio Editor
The "Link's Voice Pitch Multiplier" slider is now disabled when
"Enable Link's Voice Pitch Multiplier" is not enabled.
Added "VB_LINK_VOICE_PITCH_MULTIPLIER" enum to "GIVanillaBehavior" in
"GameInteractor.h"
"AudioSfx_PlaySfx" in the file "z_actor.c" in function "Player_PlaySfx"
is now wrapped in a "GameInteractor_Should".
* Removed "OnSceneChange" Hook.
Removed "GameInteractor_ExecuteOnSceneChange".
Removed "GameInteractor_ExecuteOnSceneChange(play->sceneId);" from
"z_play_2SH.cpp:OTRPlay_SpawnScene" function
Renamed "AudioEditorRegisterOnSceneChangeHook" to
AudioEditorRegisterOnRoomInitHook".
* Made Changes requested by Eblo to "LinksVoicePitchMultiplier.cpp" and
"z_actor.c"
* WIP Randomize On New Scene
Diffstat (limited to 'mm/src')
| -rw-r--r-- | mm/src/audio/lib/load.c | 4 | ||||
| -rw-r--r-- | mm/src/code/z_actor.c | 6 | ||||
| -rw-r--r-- | mm/src/code/z_parameter.c | 13 | ||||
| -rw-r--r-- | mm/src/overlays/actors/ovl_player_actor/z_player.c | 6 |
4 files changed, 20 insertions, 9 deletions
diff --git a/mm/src/audio/lib/load.c b/mm/src/audio/lib/load.c index 55b41c06e..6e3b1b9ec 100644 --- a/mm/src/audio/lib/load.c +++ b/mm/src/audio/lib/load.c @@ -17,6 +17,7 @@ #include <stdlib.h> #include "2s2h/Enhancements/Audio/AudioCollection.h" #include "2s2h/Enhancements/Audio/AudioEditor.h" +#include "2s2h/GameInteractor/GameInteractor.h" #include "BenPort.h" #include <libultraship/log/luslog.h> // Windows deprecated the use of `strdup` it uses _strdup. Linux/Unix doesn't have _strdup. @@ -658,6 +659,9 @@ s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIndex, s32 seqId, s32 arg2) { seqPlayer->delay = 0; seqPlayer->finished = false; seqPlayer->playerIndex = playerIndex; + + GameInteractor_ExecuteOnSeqPlayerInit(playerIndex, seqId); + return 1; //! @bug missing return (but the return value is not used so it's not UB) } diff --git a/mm/src/code/z_actor.c b/mm/src/code/z_actor.c index 8c86e337e..6fed8a875 100644 --- a/mm/src/code/z_actor.c +++ b/mm/src/code/z_actor.c @@ -2486,8 +2486,10 @@ void Player_PlaySfx(Player* player, u16 sfxId) { if (player->currentMask == PLAYER_MASK_GIANT) { Audio_PlaySfx_AtPosWithPresetLowFreqAndHighReverb(&player->actor.projectedPos, sfxId); } else { - AudioSfx_PlaySfx(sfxId, &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, - &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); + if (GameInteractor_Should(VB_LINK_VOICE_PITCH_MULTIPLIER, true, &sfxId)) { + AudioSfx_PlaySfx(sfxId, &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, + &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); + } } } diff --git a/mm/src/code/z_parameter.c b/mm/src/code/z_parameter.c index f18287569..9cea7ffce 100644 --- a/mm/src/code/z_parameter.c +++ b/mm/src/code/z_parameter.c @@ -5091,12 +5091,15 @@ void Interface_SetTatlCall(PlayState* play, u16 tatlCallState) { if (((tatlCallState == TATL_STATE_2A) || (tatlCallState == TATL_STATE_2B)) && !interfaceCtx->tatlCalling && (play->csCtx.state == CS_STATE_IDLE)) { - if (tatlCallState == TATL_STATE_2B) { - Audio_PlaySfx(NA_SE_VO_NAVY_CALL); - } - if (tatlCallState == TATL_STATE_2A) { - Audio_PlaySfx_AtPosWithReverb(&gSfxDefaultPos, NA_SE_VO_NA_HELLO_2, 0x20); + if (GameInteractor_Should(VB_PLAY_TATL_CALL_AUDIO, true)) { + if (tatlCallState == TATL_STATE_2B) { + Audio_PlaySfx(NA_SE_VO_NAVY_CALL); + } + if (tatlCallState == TATL_STATE_2A) { + Audio_PlaySfx_AtPosWithReverb(&gSfxDefaultPos, NA_SE_VO_NA_HELLO_2, 0x20); + } } + interfaceCtx->tatlCalling = true; sCUpInvisible = 0; sCUpTimer = 10; diff --git a/mm/src/overlays/actors/ovl_player_actor/z_player.c b/mm/src/overlays/actors/ovl_player_actor/z_player.c index 129ba3dd6..426262461 100644 --- a/mm/src/overlays/actors/ovl_player_actor/z_player.c +++ b/mm/src/overlays/actors/ovl_player_actor/z_player.c @@ -12208,8 +12208,10 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) { } if (play->actorCtx.attention.bgmEnemy != NULL) { - seqMode = SEQ_MODE_ENEMY; - Audio_UpdateEnemyBgmVolume(sqrtf(play->actorCtx.attention.bgmEnemy->xyzDistToPlayerSq)); + if (GameInteractor_Should(VB_PLAY_ENEMY_PROXIMITY_MUSIC, true)) { + seqMode = SEQ_MODE_ENEMY; + Audio_UpdateEnemyBgmVolume(sqrtf(play->actorCtx.attention.bgmEnemy->xyzDistToPlayerSq)); + } } Audio_SetSequenceMode(seqMode); |
