From: Gregg <82627200+Kokoc9n@users.noreply.github.com> Date: Sun, 10 Mar 2024 17:08:05 +0000 (+0200) Subject: fix: ambient music fade in (#25874) (#25969) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=e47f84568eec53efd66fca6e79d8c594a508cf3c;p=space-station-14.git fix: ambient music fade in (#25874) (#25969) --- 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))