From 9c3c4670463bdda72f7012b0aeb4efa24b890722 Mon Sep 17 00:00:00 2001 From: Ding Yuntian <1491671119@qq.com> Date: Wed, 5 Aug 2026 21:13:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=9D=99=E9=9F=B3=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Scripts/Framework/AudioKit/AudioManager.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Assets/Scripts/Framework/AudioKit/AudioManager.cs b/Assets/Scripts/Framework/AudioKit/AudioManager.cs index e10957eb3..f05d61633 100644 --- a/Assets/Scripts/Framework/AudioKit/AudioManager.cs +++ b/Assets/Scripts/Framework/AudioKit/AudioManager.cs @@ -468,13 +468,19 @@ namespace AibisDream.Kit public void SetVolume(float normalizedVolume) { - // 将 0~1 映射到 minDecibels ~ maxDecibels,再转换为线性幅度 - // 使用对数曲线匹配人耳听觉特性 - float db = Mathf.Lerp(minDecibels, maxDecibels, normalizedVolume); - float linearVolume = Mathf.Pow(10f, db / 20f); + normalizedVolume = Mathf.Clamp01(normalizedVolume); - var masterVca = RuntimeManager.GetBus("bus:/"); - masterVca.setVolume(linearVolume); + // 最低档需要真正静音;有限的最小分贝值仍会保留可听的线性幅度。 + float linearVolume = 0f; + if (normalizedVolume > 0f) + { + // 将非零音量映射到 minDecibels ~ maxDecibels,保留原有的对数听感曲线。 + float db = Mathf.Lerp(minDecibels, maxDecibels, normalizedVolume); + linearVolume = Mathf.Pow(10f, db / 20f); + } + + var masterBus = RuntimeManager.GetBus("bus:/"); + masterBus.setVolume(linearVolume); } #endregion