From e47f84568eec53efd66fca6e79d8c594a508cf3c Mon Sep 17 00:00:00 2001 From: Gregg <82627200+Kokoc9n@users.noreply.github.com> Date: Sun, 10 Mar 2024 19:08:05 +0200 Subject: [PATCH] fix: ambient music fade in (#25874) (#25969) --- Content.Client/Audio/ContentAudioSystem.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Content.Client/Audio/ContentAudioSystem.cs b/Content.Client/Audio/ContentAudioSystem.cs index c7fc7bcf73..f62b34b492 100644 --- a/Content.Client/Audio/ContentAudioSystem.cs +++ b/Content.Client/Audio/ContentAudioSystem.cs @@ -107,7 +107,7 @@ public sealed partial class ContentAudioSystem : SharedContentAudioSystem _fadingOut.Remove(stream.Value); var curVolume = component.Volume; - var change = (curVolume - MinVolume) / duration; + var change = (MinVolume - curVolume) / duration; _fadingIn.Add(stream.Value, (change, component.Volume)); component.Volume = MinVolume; } @@ -151,8 +151,8 @@ public sealed partial class ContentAudioSystem : SharedContentAudioSystem continue; } - var volume = component.Volume + change * frameTime; - volume = MathF.Max(target, volume); + var volume = component.Volume - change * frameTime; + volume = MathF.Min(target, volume); _audio.SetVolume(stream, volume, component); if (component.Volume.Equals(target))