Link voice pitch v0 (#2430)

* Link voice pitch v0

* Using a new variable instead

* Move voice pitch slider to Options tab

* fallback to original behavior if freqMultiplier is set to 1

* Move reset button to Options tab with its slider

* Fix voice pitch slider width in Options tab

* [Review] Always use freqMultiplier
This commit is contained in:
RaelCappra 2023-04-07 16:54:26 -03:00 committed by GitHub
parent 196de9d05d
commit 0f6147f41d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 1 deletions

View File

@ -371,6 +371,18 @@ void DrawSfxEditor(bool& open) {
"gSeqNameOverlayDuration", 1, 10, "", 5);
ImGui::PopItemWidth();
ImGui::NewLine();
ImGui::PopItemWidth();
UIWidgets::EnhancementSliderFloat("Link's voice pitch multiplier: %f", "##linkVoiceFreqMultiplier",
"gLinkVoiceFreqMultiplier", 0.4, 2.5, "", 1.0, false, false);
ImGui::SameLine();
const std::string resetButton = "Reset##linkVoiceFreqMultiplier";
if (ImGui::Button(resetButton.c_str())) {
CVarSetFloat("gLinkVoiceFreqMultiplier", 1.0f);
SohImGui::RequestCvarSaveOnNextTick();
}
ImGui::NewLine();
ImGui::PushItemWidth(-FLT_MIN);
UIWidgets::PaddedSeparator();
UIWidgets::PaddedText("The following options are experimental and may cause music\nto sound odd or have other undesireable effects.");
UIWidgets::EnhancementCheckbox("Lower Octaves of Unplayable High Notes", "gExperimentalOctaveDrop");

View File

@ -82,6 +82,9 @@ static s32 sCurCeilingBgId;
// Used for animating the ice trap on the "Get Item" model.
f32 iceTrapScale;
// For Link's voice pitch SFX modifier
static f32 freqMultiplier = 1;
void ActorShape_Init(ActorShape* shape, f32 yOffset, ActorShadowFunc shadowDraw, f32 shadowScale) {
shape->yOffset = yOffset;
shape->shadowDraw = shadowDraw;
@ -2185,7 +2188,17 @@ void func_8002F7A0(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4)
}
void func_8002F7DC(Actor* actor, u16 sfxId) {
Audio_PlaySoundGeneral(sfxId, &actor->projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8);
if (actor->id != ACTOR_PLAYER || sfxId < NA_SE_VO_LI_SWORD_N || sfxId > NA_SE_VO_LI_ELECTRIC_SHOCK_LV_KID) {
Audio_PlaySoundGeneral(sfxId, &actor->projectedPos, 4, &D_801333E0 , &D_801333E0, &D_801333E8);
} else {
freqMultiplier = CVarGetFloat("gLinkVoiceFreqMultiplier", 1.0);
if (freqMultiplier <= 0) {
freqMultiplier = 1;
}
// Authentic behavior uses D_801333E0 for both freqScale and a4
// Audio_PlaySoundGeneral(sfxId, &actor->projectedPos, 4, &D_801333E0 , &D_801333E0, &D_801333E8);
Audio_PlaySoundGeneral(sfxId, &actor->projectedPos, 4, &freqMultiplier, &D_801333E0, &D_801333E8);
}
}
void Audio_PlayActorSound2(Actor* actor, u16 sfxId) {