]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
fix: ambient music fade in (#25874) (#25969)
authorGregg <82627200+Kokoc9n@users.noreply.github.com>
Sun, 10 Mar 2024 17:08:05 +0000 (19:08 +0200)
committerGitHub <noreply@github.com>
Sun, 10 Mar 2024 17:08:05 +0000 (04:08 +1100)
Content.Client/Audio/ContentAudioSystem.cs

index c7fc7bcf73987fcf0a6697a9b132d18e117d2a61..f62b34b492cc080c9e0db55d755da95bba129a5d 100644 (file)
@@ -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))