feat(audio): add custom sound volume slider

This commit is contained in:
2026-05-22 14:28:22 +02:00
parent ba30b1e742
commit 921dd701c4
7 changed files with 131 additions and 6 deletions
+18
View File
@@ -95,6 +95,24 @@ internal sealed class General : ISettingsTab
{
ImGui.Checkbox(Language.Options_PlaySounds_Name, ref Mutable.PlaySounds);
ImGuiUtil.HelpMarker(Language.Options_PlaySounds_Description);
// Volume is stored as a 0-1 float but shown as 0-100% to match user
// intuition. Full range — unlike opacity there is no unsafe floor.
var customSoundVolumePercent = Mutable.CustomSoundVolume * 100f;
if (
ImGuiUtil.DragFloatVertical(
HellionStrings.Settings_General_CustomSoundVolume_Name,
ref customSoundVolumePercent,
1f,
0f,
100f,
$"{customSoundVolumePercent:N0}%%",
ImGuiSliderFlags.AlwaysClamp
)
)
{
Mutable.CustomSoundVolume = customSoundVolumePercent / 100f;
}
ImGuiUtil.HelpMarker(HellionStrings.Settings_General_CustomSoundVolume_Description);
ImGui.Checkbox(Language.Options_ShowNoviceNetwork_Name, ref Mutable.ShowNoviceNetwork);
ImGuiUtil.HelpMarker(Language.Options_ShowNoviceNetwork_Description);
+1 -1
View File
@@ -234,7 +234,7 @@ internal sealed class Tabs : ISettingsTab
}
else
{
Plugin.CustomAudioPlayer.Play((int)previewId - 16);
Plugin.CustomAudioPlayer.Play((int)previewId - 16, Mutable.CustomSoundVolume);
}
}
}