From 835bd6eff8452372bbc593bcfbc06ef364d89ca7 Mon Sep 17 00:00:00 2001 From: ike709 Date: Sat, 8 Feb 2025 11:25:57 -0600 Subject: [PATCH] floating away --- OpenDreamClient/Audio/DreamSoundEngine.cs | 2 +- OpenDreamClient/Audio/IDreamSoundEngine.cs | 2 +- OpenDreamRuntime/DreamConnection.cs | 2 +- OpenDreamShared/Network/Messages/MsgSound.cs | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/OpenDreamClient/Audio/DreamSoundEngine.cs b/OpenDreamClient/Audio/DreamSoundEngine.cs index a2c5f6faea..9178caa914 100644 --- a/OpenDreamClient/Audio/DreamSoundEngine.cs +++ b/OpenDreamClient/Audio/DreamSoundEngine.cs @@ -30,7 +30,7 @@ public void Initialize() { _netManager.Disconnect += DisconnectedFromServer; } - public void PlaySound(int channel, MsgSound.FormatType format, ResourceSound sound, float volume, int offset) { + public void PlaySound(int channel, MsgSound.FormatType format, ResourceSound sound, float volume, float offset) { if (_audioSystem == null) _entitySystemManager.Resolve(ref _audioSystem); diff --git a/OpenDreamClient/Audio/IDreamSoundEngine.cs b/OpenDreamClient/Audio/IDreamSoundEngine.cs index 6d44be8809..953b5cc6d1 100644 --- a/OpenDreamClient/Audio/IDreamSoundEngine.cs +++ b/OpenDreamClient/Audio/IDreamSoundEngine.cs @@ -5,7 +5,7 @@ namespace OpenDreamClient.Audio; public interface IDreamSoundEngine { void Initialize(); - void PlaySound(int channel, MsgSound.FormatType format, ResourceSound sound, float volume, int offset); + void PlaySound(int channel, MsgSound.FormatType format, ResourceSound sound, float volume, float offset); void StopChannel(int channel); void StopAllChannels(); } diff --git a/OpenDreamRuntime/DreamConnection.cs b/OpenDreamRuntime/DreamConnection.cs index 6f6be1ec3e..9183aa44b0 100644 --- a/OpenDreamRuntime/DreamConnection.cs +++ b/OpenDreamRuntime/DreamConnection.cs @@ -212,7 +212,7 @@ public void OutputDreamValue(DreamValue value) { if (value.TryGetValueAsDreamObject(out var outputObject)) { ushort channel = (ushort)outputObject.GetVariable("channel").GetValueAsInteger(); ushort volume = (ushort)outputObject.GetVariable("volume").GetValueAsInteger(); - int offset = (int)outputObject.GetVariable("offset").UnsafeGetValueAsFloat(); + float offset = outputObject.GetVariable("offset").UnsafeGetValueAsFloat(); DreamValue file = outputObject.GetVariable("file"); var msg = new MsgSound() { diff --git a/OpenDreamShared/Network/Messages/MsgSound.cs b/OpenDreamShared/Network/Messages/MsgSound.cs index 68de1e54df..b2e4f05c7b 100644 --- a/OpenDreamShared/Network/Messages/MsgSound.cs +++ b/OpenDreamShared/Network/Messages/MsgSound.cs @@ -14,7 +14,7 @@ public enum FormatType : byte { public ushort Channel; public ushort Volume; - public int Offset; + public float Offset; public int? ResourceId; public FormatType? Format; // TODO: This should probably be sent along with the sound resource instead somehow //TODO: Frequency and friends @@ -22,7 +22,7 @@ public enum FormatType : byte { public override void ReadFromBuffer(NetIncomingMessage buffer, IRobustSerializer serializer) { Channel = buffer.ReadUInt16(); Volume = buffer.ReadUInt16(); - Offset = buffer.ReadInt32(); + Offset = buffer.ReadFloat(); if (buffer.ReadBoolean()) { ResourceId = buffer.ReadInt32();