Unrevert audio (#21330)
Co-authored-by: Pieter-Jan Briers <pieterjan.briers@gmail.com>
This commit is contained in:
@@ -9,6 +9,7 @@ using Robust.Client.Player;
|
||||
using Robust.Client.ResourceManagement;
|
||||
using Robust.Client.State;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Audio.Systems;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Prototypes;
|
||||
@@ -39,7 +40,7 @@ public sealed partial class ContentAudioSystem
|
||||
// Don't need to worry about this being serializable or pauseable as it doesn't affect the sim.
|
||||
private TimeSpan _nextAudio;
|
||||
|
||||
private AudioSystem.PlayingStream? _ambientMusicStream;
|
||||
private EntityUid? _ambientMusicStream;
|
||||
private AmbientMusicPrototype? _musicProto;
|
||||
|
||||
/// <summary>
|
||||
@@ -83,7 +84,7 @@ public sealed partial class ContentAudioSystem
|
||||
|
||||
if (_ambientMusicStream != null && _musicProto != null)
|
||||
{
|
||||
_ambientMusicStream.Volume = _musicProto.Sound.Params.Volume + _volumeSlider;
|
||||
_audio.SetVolume(_ambientMusicStream, _musicProto.Sound.Params.Volume + _volumeSlider);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +93,7 @@ public sealed partial class ContentAudioSystem
|
||||
_configManager.UnsubValueChanged(CCVars.AmbientMusicVolume, AmbienceCVarChanged);
|
||||
_proto.PrototypesReloaded -= OnProtoReload;
|
||||
_state.OnStateChanged -= OnStateChange;
|
||||
_ambientMusicStream?.Stop();
|
||||
_ambientMusicStream = _audio.Stop(_ambientMusicStream);
|
||||
}
|
||||
|
||||
private void OnProtoReload(PrototypesReloadedEventArgs obj)
|
||||
@@ -129,8 +130,7 @@ public sealed partial class ContentAudioSystem
|
||||
private void OnRoundEndMessage(RoundEndMessageEvent ev)
|
||||
{
|
||||
// If scoreboard shows then just stop the music
|
||||
_ambientMusicStream?.Stop();
|
||||
_ambientMusicStream = null;
|
||||
_ambientMusicStream = _audio.Stop(_ambientMusicStream);
|
||||
_nextAudio = TimeSpan.FromMinutes(3);
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ public sealed partial class ContentAudioSystem
|
||||
return;
|
||||
}
|
||||
|
||||
var isDone = _ambientMusicStream?.Done;
|
||||
var isDone = !Exists(_ambientMusicStream);
|
||||
|
||||
if (_interruptable)
|
||||
{
|
||||
@@ -178,7 +178,7 @@ public sealed partial class ContentAudioSystem
|
||||
|
||||
if (player == null || _musicProto == null || !_rules.IsTrue(player.Value, _proto.Index<RulesPrototype>(_musicProto.Rules)))
|
||||
{
|
||||
FadeOut(_ambientMusicStream, AmbientMusicFadeTime);
|
||||
FadeOut(_ambientMusicStream, duration: AmbientMusicFadeTime);
|
||||
_musicProto = null;
|
||||
_interruptable = false;
|
||||
isDone = true;
|
||||
@@ -221,14 +221,11 @@ public sealed partial class ContentAudioSystem
|
||||
false,
|
||||
AudioParams.Default.WithVolume(_musicProto.Sound.Params.Volume + _volumeSlider));
|
||||
|
||||
if (strim != null)
|
||||
{
|
||||
_ambientMusicStream = (AudioSystem.PlayingStream) strim;
|
||||
_ambientMusicStream = strim.Value.Entity;
|
||||
|
||||
if (_musicProto.FadeIn)
|
||||
{
|
||||
FadeIn(_ambientMusicStream, AmbientMusicFadeTime);
|
||||
}
|
||||
if (_musicProto.FadeIn)
|
||||
{
|
||||
FadeIn(_ambientMusicStream, strim.Value.Component, AmbientMusicFadeTime);
|
||||
}
|
||||
|
||||
// Refresh the list
|
||||
|
||||
Reference in New Issue
Block a user