diff --git a/Barotrauma/BarotraumaClient/ClientCode.projitems b/Barotrauma/BarotraumaClient/ClientCode.projitems
index b514f2e99..96e169d05 100644
--- a/Barotrauma/BarotraumaClient/ClientCode.projitems
+++ b/Barotrauma/BarotraumaClient/ClientCode.projitems
@@ -202,8 +202,6 @@
-
-
diff --git a/Barotrauma/BarotraumaClient/LinuxClient.csproj b/Barotrauma/BarotraumaClient/LinuxClient.csproj
index a96474014..c96a76c05 100644
--- a/Barotrauma/BarotraumaClient/LinuxClient.csproj
+++ b/Barotrauma/BarotraumaClient/LinuxClient.csproj
@@ -118,6 +118,9 @@
PreserveNewest
+
+ PreserveNewest
+
PreserveNewest
@@ -347,7 +350,7 @@
-
+
@@ -365,9 +368,8 @@
-
+
-
-
+
\ No newline at end of file
diff --git a/Barotrauma/BarotraumaClient/MacClient.csproj b/Barotrauma/BarotraumaClient/MacClient.csproj
index 82c7835d0..b57d6b7cc 100644
--- a/Barotrauma/BarotraumaClient/MacClient.csproj
+++ b/Barotrauma/BarotraumaClient/MacClient.csproj
@@ -117,6 +117,9 @@
PreserveNewest
+
+ PreserveNewest
+
PreserveNewest
diff --git a/Barotrauma/BarotraumaClient/OpenAL32.dll b/Barotrauma/BarotraumaClient/OpenAL32.dll
new file mode 100644
index 000000000..f903a0c63
Binary files /dev/null and b/Barotrauma/BarotraumaClient/OpenAL32.dll differ
diff --git a/Barotrauma/BarotraumaClient/OpenTK.dll.config b/Barotrauma/BarotraumaClient/OpenTK.dll.config
new file mode 100644
index 000000000..140d56665
--- /dev/null
+++ b/Barotrauma/BarotraumaClient/OpenTK.dll.config
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Barotrauma/BarotraumaClient/Properties/AssemblyInfo.cs b/Barotrauma/BarotraumaClient/Properties/AssemblyInfo.cs
index 9e79711f3..b9666c162 100644
--- a/Barotrauma/BarotraumaClient/Properties/AssemblyInfo.cs
+++ b/Barotrauma/BarotraumaClient/Properties/AssemblyInfo.cs
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.9.0.3")]
-[assembly: AssemblyFileVersion("0.9.0.3")]
+[assembly: AssemblyVersion("0.9.0.4")]
+[assembly: AssemblyFileVersion("0.9.0.4")]
diff --git a/Barotrauma/BarotraumaClient/Source/GameMain.cs b/Barotrauma/BarotraumaClient/Source/GameMain.cs
index a055efc07..6f1f43694 100644
--- a/Barotrauma/BarotraumaClient/Source/GameMain.cs
+++ b/Barotrauma/BarotraumaClient/Source/GameMain.cs
@@ -92,9 +92,6 @@ namespace Barotrauma
public static GameSettings Config;
- public static int DisplayWidth { get; private set; }
- public static int DisplayHeight { get; private set; }
-
private CoroutineHandle loadingCoroutine;
private bool hasLoaded;
@@ -123,7 +120,7 @@ namespace Barotrauma
get;
private set;
}
-
+
public static int GraphicsWidth
{
get;
@@ -195,35 +192,8 @@ namespace Barotrauma
FarseerPhysics.Settings.PositionIterations = 1;
}
- public void RequestGraphicsSettings()
+ public void ApplyGraphicsSettings()
{
-#if WINDOWS
- if (WindowActive)
- {
-#endif
- ApplyGraphicsSettings();
-#if WINDOWS
- }
-#endif
- }
-
- private void ApplyGraphicsSettings()
- {
-#if !OSX
- if (Config.WindowMode == WindowMode.Fullscreen &&
- GraphicsDeviceManager.IsFullScreen && !GraphicsDeviceManager.HardwareModeSwitch &&
- (GraphicsDeviceManager.PreferredBackBufferWidth != Config.GraphicsWidth ||
- GraphicsDeviceManager.PreferredBackBufferHeight != Config.GraphicsHeight))
- {
- DisplayMode minMode = GraphicsAdapter.DefaultAdapter.SupportedDisplayModes.First(m => m.Format == SurfaceFormat.Color);
- GraphicsDeviceManager.PreferredBackBufferWidth = minMode.Width;
- GraphicsDeviceManager.PreferredBackBufferHeight = minMode.Height;
- GraphicsDeviceManager.IsFullScreen = false;
- GraphicsDeviceManager.ApplyChanges();
- Thread.Sleep(100);
- }
-#endif
-
GraphicsWidth = Config.GraphicsWidth;
GraphicsHeight = Config.GraphicsHeight;
if (Config.WindowMode == WindowMode.BorderlessWindowed)
@@ -238,14 +208,13 @@ namespace Barotrauma
GraphicsDeviceManager.PreferredBackBufferWidth = GraphicsWidth;
GraphicsDeviceManager.PreferredBackBufferHeight = GraphicsHeight;
SetWindowMode(Config.WindowMode);
- GraphicsDeviceManager.ApplyChanges();
defaultViewport = GraphicsDevice.Viewport;
OnResolutionChanged?.Invoke();
}
- private void SetWindowMode(WindowMode windowMode)
+ public void SetWindowMode(WindowMode windowMode)
{
WindowMode = windowMode;
GraphicsDeviceManager.HardwareModeSwitch = Config.WindowMode != WindowMode.BorderlessWindowed;
diff --git a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs
index c2e36d361..392301a01 100644
--- a/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs
+++ b/Barotrauma/BarotraumaClient/Source/GameSession/CrewManager.cs
@@ -8,7 +8,6 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
-using Barotrauma.Extensions;
namespace Barotrauma
{
diff --git a/Barotrauma/BarotraumaClient/Source/GameSettings.cs b/Barotrauma/BarotraumaClient/Source/GameSettings.cs
index 56787b488..a19e7fce8 100644
--- a/Barotrauma/BarotraumaClient/Source/GameSettings.cs
+++ b/Barotrauma/BarotraumaClient/Source/GameSettings.cs
@@ -3,7 +3,7 @@ using Barotrauma.Networking;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
-using OpenAL;
+using OpenTK.Audio.OpenAL;
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -242,16 +242,6 @@ namespace Barotrauma
#endif
displayModeDD.OnSelected = (guiComponent, obj) =>
{
- displayModeDD.SelectItem(WindowMode.Fullscreen);
- }
- else
- {
- displayModeDD.SelectItem(GameMain.Config.WindowMode);
- }
-#endif
- displayModeDD.OnSelected = (guiComponent, obj) =>
- {
- PauseOnFocusLost = tickBox.Selected;
UnsavedSettings = true;
GameMain.Config.WindowMode = (WindowMode)guiComponent.UserData;
#if !LINUX
@@ -465,7 +455,7 @@ namespace Barotrauma
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), audioSliders.RectTransform), TextManager.Get("VoiceChat"));
- IList deviceNames = Alc.GetStringList((IntPtr)null, Alc.CaptureDeviceSpecifier);
+ IList deviceNames = Alc.GetString((IntPtr)null, AlcGetStringList.CaptureDeviceSpecifier);
foreach (string name in deviceNames)
{
DebugConsole.NewMessage(name + " " + name.Length.ToString(), Color.Lime);
@@ -484,10 +474,10 @@ namespace Barotrauma
if (string.IsNullOrWhiteSpace(VoiceCaptureDevice)) VoiceCaptureDevice = deviceNames[0];
#if (!OSX)
- var deviceList = new GUIDropDown(new RectTransform(new Vector2(1.0f, 0.05f), audioSliders.RectTransform), VoiceCaptureDevice, deviceNames.Count);
+ var deviceList = new GUIDropDown(new RectTransform(new Vector2(1.0f, 0.05f), audioSliders.RectTransform), TextManager.EnsureUTF8(VoiceCaptureDevice), deviceNames.Count);
foreach (string name in deviceNames)
{
- deviceList.AddItem(name, name);
+ deviceList.AddItem(TextManager.EnsureUTF8(name), name);
}
deviceList.OnSelected = (GUIComponent selected, object obj) =>
{
@@ -499,7 +489,7 @@ namespace Barotrauma
};
#else
var suavemente = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), audioSliders.RectTransform),
- TextManager.AddPunctuation(':', TextManager.Get("CurrentDevice"), VoiceCaptureDevice))
+ TextManager.AddPunctuation(':', TextManager.Get("CurrentDevice"), TextManager.EnsureUTF8(VoiceCaptureDevice)))
{
ToolTip = TextManager.Get("CurrentDeviceToolTip.OSX"),
TextAlignment = Alignment.CenterX
@@ -514,7 +504,7 @@ namespace Barotrauma
if (VoiceCaptureDevice == deviceNames[0]) return true;
VoipCapture.ChangeCaptureDevice(deviceNames[0]);
- suavemente.Text = TextManager.AddPunctuation(':', TextManager.Get("CurrentDevice"), VoiceCaptureDevice);
+ suavemente.Text = TextManager.AddPunctuation(':', TextManager.Get("CurrentDevice"), TextManager.EnsureUTF8(VoiceCaptureDevice));
suavemente.Flash(Color.Blue);
return true;
diff --git a/Barotrauma/BarotraumaClient/Source/Items/Item.cs b/Barotrauma/BarotraumaClient/Source/Items/Item.cs
index 71260001a..83476d546 100644
--- a/Barotrauma/BarotraumaClient/Source/Items/Item.cs
+++ b/Barotrauma/BarotraumaClient/Source/Items/Item.cs
@@ -51,7 +51,7 @@ namespace Barotrauma
{
itemInUseWarning = new GUITextBlock(new RectTransform(new Point(10), GUI.Canvas), "",
textColor: Color.Orange, color: Color.Black,
- textAlignment:Alignment.Center, style: "OuterGlow");
+ textAlignment: Alignment.Center, style: "OuterGlow");
}
return itemInUseWarning;
}
@@ -662,7 +662,7 @@ namespace Barotrauma
new Rectangle(
20, 20,
GameMain.GraphicsWidth - 40,
- HUDLayoutSettings.InventoryTopY > 0 ? HUDLayoutSettings.InventoryTopY - 20 : GameMain.GraphicsHeight - 80));
+ HUDLayoutSettings.InventoryTopY > 0 ? HUDLayoutSettings.InventoryTopY - 40 : GameMain.GraphicsHeight - 80));
foreach (ItemComponent ic in activeHUDs)
{
@@ -740,9 +740,9 @@ namespace Barotrauma
}
}
- if (itemInUseWarning != null && mergedHUDRect != Rectangle.Empty)
+ if (mergedHUDRect != Rectangle.Empty)
{
- itemInUseWarning.Visible = false;
+ if (itemInUseWarning != null) { itemInUseWarning.Visible = false; }
foreach (Character otherCharacter in Character.CharacterList)
{
if (otherCharacter != character &&
diff --git a/Barotrauma/BarotraumaClient/Source/Networking/Voip/VoipCapture.cs b/Barotrauma/BarotraumaClient/Source/Networking/Voip/VoipCapture.cs
index 0bf9152ad..cd0d3352e 100644
--- a/Barotrauma/BarotraumaClient/Source/Networking/Voip/VoipCapture.cs
+++ b/Barotrauma/BarotraumaClient/Source/Networking/Voip/VoipCapture.cs
@@ -1,6 +1,6 @@
using Lidgren.Network;
using Microsoft.Xna.Framework;
-using OpenAL;
+using OpenTK.Audio.OpenAL;
using System;
using System.Linq;
using System.Runtime.InteropServices;
@@ -69,7 +69,7 @@ namespace Barotrauma.Networking
VoipConfig.SetupEncoding();
//set up capture device
- captureDevice = Alc.CaptureOpenDevice(deviceName, VoipConfig.FREQUENCY, Al.FormatMono16, VoipConfig.BUFFER_SIZE * 5);
+ captureDevice = Alc.CaptureOpenDevice(deviceName, VoipConfig.FREQUENCY, ALFormat.Mono16, VoipConfig.BUFFER_SIZE * 5);
if (captureDevice == IntPtr.Zero)
{
@@ -88,20 +88,20 @@ namespace Barotrauma.Networking
return;
}
- int alError = Al.GetError();
- int alcError = Alc.GetError(captureDevice);
- if (alcError != Alc.NoError)
+ ALError alError = AL.GetError();
+ AlcError alcError = Alc.GetError(captureDevice);
+ if (alcError != AlcError.NoError)
{
throw new Exception("Failed to open capture device: " + alcError.ToString() + " (ALC)");
}
- if (alError != Al.NoError)
+ if (alError != ALError.NoError)
{
throw new Exception("Failed to open capture device: " + alError.ToString() + " (AL)");
}
Alc.CaptureStart(captureDevice);
alcError = Alc.GetError(captureDevice);
- if (alcError != Alc.NoError)
+ if (alcError != AlcError.NoError)
{
throw new Exception("Failed to start capturing: " + alcError.ToString());
}
@@ -132,11 +132,11 @@ namespace Barotrauma.Networking
short[] uncompressedBuffer = new short[VoipConfig.BUFFER_SIZE];
while (capturing)
{
- int alcError;
- Alc.GetInteger(captureDevice, Alc.EnumCaptureSamples, out int sampleCount);
+ AlcError alcError;
+ Alc.GetInteger(captureDevice, AlcGetInteger.CaptureSamples, 1, out int sampleCount);
alcError = Alc.GetError(captureDevice);
- if (alcError != Alc.NoError)
+ if (alcError != AlcError.NoError)
{
throw new Exception("Failed to determine sample count: " + alcError.ToString());
}
@@ -160,7 +160,7 @@ namespace Barotrauma.Networking
}
alcError = Alc.GetError(captureDevice);
- if (alcError != Alc.NoError)
+ if (alcError != AlcError.NoError)
{
throw new Exception("Failed to capture samples: " + alcError.ToString());
}
diff --git a/Barotrauma/BarotraumaClient/Source/Program.cs b/Barotrauma/BarotraumaClient/Source/Program.cs
index 020fcc4c2..b6315f7f1 100644
--- a/Barotrauma/BarotraumaClient/Source/Program.cs
+++ b/Barotrauma/BarotraumaClient/Source/Program.cs
@@ -138,7 +138,7 @@ namespace Barotrauma
DebugConsole.NewMessage("Display size set to " + GameMain.Config.GraphicsWidth + "x" + GameMain.Config.GraphicsHeight, Microsoft.Xna.Framework.Color.Red);
- game.RequestGraphicsSettings();
+ game.ApplyGraphicsSettings();
return true;
default:
diff --git a/Barotrauma/BarotraumaClient/Source/Sounds/OggSound.cs b/Barotrauma/BarotraumaClient/Source/Sounds/OggSound.cs
index 7f59ebd1e..dacc02b24 100644
--- a/Barotrauma/BarotraumaClient/Source/Sounds/OggSound.cs
+++ b/Barotrauma/BarotraumaClient/Source/Sounds/OggSound.cs
@@ -1,5 +1,5 @@
using System;
-using OpenAL;
+using OpenTK.Audio.OpenAL;
using NVorbis;
using System.Collections.Generic;
@@ -21,7 +21,7 @@ namespace Barotrauma.Sounds
reader = new VorbisReader(filename);
- ALFormat = reader.Channels == 1 ? Al.FormatMono16 : Al.FormatStereo16;
+ ALFormat = reader.Channels == 1 ? ALFormat.Mono16 : ALFormat.Stereo16;
SampleRate = reader.SampleRate;
if (!stream)
@@ -35,26 +35,26 @@ namespace Barotrauma.Sounds
CastBuffer(floatBuffer, shortBuffer, readSamples);
- Al.BufferData(ALBuffer, ALFormat, shortBuffer,
+ AL.BufferData((int)ALBuffer, ALFormat, shortBuffer,
readSamples * sizeof(short), SampleRate);
- int alError = Al.GetError();
- if (alError != Al.NoError)
+ ALError alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to set buffer data for non-streamed audio! "+Al.GetErrorString(alError));
+ throw new Exception("Failed to set buffer data for non-streamed audio! "+AL.GetErrorString(alError));
}
MuffleBuffer(floatBuffer, SampleRate, reader.Channels);
CastBuffer(floatBuffer, shortBuffer, readSamples);
- Al.BufferData(ALMuffledBuffer, ALFormat, shortBuffer,
+ AL.BufferData((int)ALMuffledBuffer, ALFormat, shortBuffer,
readSamples * sizeof(short), SampleRate);
- alError = Al.GetError();
- if (alError != Al.NoError)
+ alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to set buffer data for non-streamed audio! " + Al.GetErrorString(alError));
+ throw new Exception("Failed to set buffer data for non-streamed audio! " + AL.GetErrorString(alError));
}
reader.Dispose();
@@ -98,4 +98,4 @@ namespace Barotrauma.Sounds
base.Dispose();
}
}
-}
+}
\ No newline at end of file
diff --git a/Barotrauma/BarotraumaClient/Source/Sounds/Sound.cs b/Barotrauma/BarotraumaClient/Source/Sounds/Sound.cs
index a5685cbd1..c3b0a474b 100644
--- a/Barotrauma/BarotraumaClient/Source/Sounds/Sound.cs
+++ b/Barotrauma/BarotraumaClient/Source/Sounds/Sound.cs
@@ -1,5 +1,5 @@
using System;
-using OpenAL;
+using OpenTK.Audio.OpenAL;
using Microsoft.Xna.Framework;
using System.IO;
@@ -57,7 +57,7 @@ namespace Barotrauma.Sounds
get { return !Stream ? alMuffledBuffer : 0; }
}
- public int ALFormat
+ public ALFormat ALFormat
{
get;
protected set;
@@ -91,26 +91,26 @@ namespace Barotrauma.Sounds
if (!stream)
{
- Al.GenBuffer(out alBuffer);
- int alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.GenBuffer(out alBuffer);
+ ALError alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to create OpenAL buffer for non-streamed sound: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to create OpenAL buffer for non-streamed sound: " + AL.GetErrorString(alError));
}
- if (!Al.IsBuffer(alBuffer))
+ if (!AL.IsBuffer(alBuffer))
{
throw new Exception("Generated OpenAL buffer is invalid!");
}
- Al.GenBuffer(out alMuffledBuffer);
- alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.GenBuffer(out alMuffledBuffer);
+ alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to create OpenAL buffer for non-streamed sound: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to create OpenAL buffer for non-streamed sound: " + AL.GetErrorString(alError));
}
- if (!Al.IsBuffer(alMuffledBuffer))
+ if (!AL.IsBuffer(alMuffledBuffer))
{
throw new Exception("Generated OpenAL buffer is invalid!");
}
@@ -186,32 +186,32 @@ namespace Barotrauma.Sounds
Owner.KillChannels(this);
if (alBuffer != 0)
{
- if (!Al.IsBuffer(alBuffer))
+ if (!AL.IsBuffer(alBuffer))
{
throw new Exception("Buffer to delete is invalid!");
}
- Al.DeleteBuffer(alBuffer); alBuffer = 0;
+ AL.DeleteBuffer(ref alBuffer); alBuffer = 0;
- int alError = Al.GetError();
- if (alError != Al.NoError)
+ ALError alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to delete OpenAL buffer for non-streamed sound: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to delete OpenAL buffer for non-streamed sound: " + AL.GetErrorString(alError));
}
}
if (alMuffledBuffer != 0)
{
- if (!Al.IsBuffer(alMuffledBuffer))
+ if (!AL.IsBuffer(alMuffledBuffer))
{
throw new Exception("Buffer to delete is invalid!");
}
- Al.DeleteBuffer(alMuffledBuffer); alMuffledBuffer = 0;
+ AL.DeleteBuffer(ref alMuffledBuffer); alMuffledBuffer = 0;
- int alError = Al.GetError();
- if (alError != Al.NoError)
+ ALError alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to delete OpenAL buffer for non-streamed sound: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to delete OpenAL buffer for non-streamed sound: " + AL.GetErrorString(alError));
}
}
diff --git a/Barotrauma/BarotraumaClient/Source/Sounds/SoundChannel.cs b/Barotrauma/BarotraumaClient/Source/Sounds/SoundChannel.cs
index a69f4b102..e939f97bd 100644
--- a/Barotrauma/BarotraumaClient/Source/Sounds/SoundChannel.cs
+++ b/Barotrauma/BarotraumaClient/Source/Sounds/SoundChannel.cs
@@ -1,5 +1,5 @@
using System;
-using OpenAL;
+using OpenTK.Audio.OpenAL;
using Microsoft.Xna.Framework;
using System.Collections.Generic;
@@ -15,49 +15,49 @@ namespace Barotrauma.Sounds
public SoundSourcePool(int sourceCount = SoundManager.SOURCE_COUNT)
{
- int alError = Al.NoError;
+ ALError alError = ALError.NoError;
ALSources = new uint[sourceCount];
for (int i = 0; i < sourceCount; i++)
{
- Al.GenSource(out ALSources[i]);
- alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.GenSource(out ALSources[i]);
+ alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Error generating alSource[" + i.ToString() + "]: " + Al.GetErrorString(alError));
+ throw new Exception("Error generating alSource[" + i.ToString() + "]: " + AL.GetErrorString(alError));
}
- if (!Al.IsSource(ALSources[i]))
+ if (!AL.IsSource(ALSources[i]))
{
throw new Exception("Generated alSource[" + i.ToString() + "] is invalid!");
}
- Al.SourceStop(ALSources[i]);
- alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.SourceStop(ALSources[i]);
+ alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Error stopping newly generated alSource[" + i.ToString() + "]: " + Al.GetErrorString(alError));
+ throw new Exception("Error stopping newly generated alSource[" + i.ToString() + "]: " + AL.GetErrorString(alError));
}
- Al.Sourcef(ALSources[i], Al.MinGain, 0.0f);
- alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.Source(ALSources[i], ALSourcef.MinGain, 0.0f);
+ alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Error setting min gain: " + Al.GetErrorString(alError));
+ throw new Exception("Error setting min gain: " + AL.GetErrorString(alError));
}
- Al.Sourcef(ALSources[i], Al.MaxGain, 1.0f);
- alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.Source(ALSources[i], ALSourcef.MaxGain, 1.0f);
+ alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Error setting max gain: " + Al.GetErrorString(alError));
+ throw new Exception("Error setting max gain: " + AL.GetErrorString(alError));
}
- Al.Sourcef(ALSources[i], Al.RolloffFactor, 1.0f);
- alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.Source(ALSources[i], ALSourcef.RolloffFactor, 1.0f);
+ alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Error setting rolloff factor: " + Al.GetErrorString(alError));
+ throw new Exception("Error setting rolloff factor: " + AL.GetErrorString(alError));
}
}
}
@@ -66,11 +66,11 @@ namespace Barotrauma.Sounds
{
for (int i = 0; i < ALSources.Length; i++)
{
- Al.DeleteSource(ALSources[i]);
- int alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.DeleteSource(ref ALSources[i]);
+ ALError alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to delete ALSources[" + i.ToString() + "]: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to delete ALSources[" + i.ToString() + "]: " + AL.GetErrorString(alError));
}
}
ALSources = null;
@@ -95,35 +95,35 @@ namespace Barotrauma.Sounds
if (position != null)
{
uint alSource = Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex);
- Al.Sourcei(alSource, Al.SourceRelative, Al.False);
- int alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.Source(alSource, ALSourceb.SourceRelative, false);
+ ALError alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to enable source's relative flag: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to enable source's relative flag: " + AL.GetErrorString(alError));
}
- Al.Source3f(alSource, Al.Position, position.Value.X, position.Value.Y, position.Value.Z);
- alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.Source(alSource, ALSource3f.Position, position.Value.X, position.Value.Y, position.Value.Z);
+ alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to set source's position: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to set source's position: " + AL.GetErrorString(alError));
}
}
else
{
uint alSource = Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex);
- Al.Sourcei(alSource, Al.SourceRelative, Al.True);
- int alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.Source(alSource, ALSourceb.SourceRelative, true);
+ ALError alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to disable source's relative flag: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to disable source's relative flag: " + AL.GetErrorString(alError));
}
- Al.Source3f(alSource, Al.Position, 0.0f, 0.0f, 0.0f);
- alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.Source(alSource, ALSource3f.Position, 0.0f, 0.0f, 0.0f);
+ alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to reset source's position: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to reset source's position: " + AL.GetErrorString(alError));
}
}
}
@@ -140,12 +140,12 @@ namespace Barotrauma.Sounds
if (ALSourceIndex < 0) return;
uint alSource = Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex);
- Al.Sourcef(alSource, Al.ReferenceDistance, near);
+ AL.Source(alSource, ALSourcef.ReferenceDistance, near);
- int alError = Al.GetError();
- if (alError != Al.NoError)
+ ALError alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to set source's reference distance: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to set source's reference distance: " + AL.GetErrorString(alError));
}
}
}
@@ -161,11 +161,11 @@ namespace Barotrauma.Sounds
if (ALSourceIndex < 0) return;
uint alSource = Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex);
- Al.Sourcef(alSource, Al.MaxDistance, far);
- int alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.Source(alSource, ALSourcef.MaxDistance, far);
+ ALError alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to set source's max distance: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to set source's max distance: " + AL.GetErrorString(alError));
}
}
}
@@ -185,11 +185,11 @@ namespace Barotrauma.Sounds
float effectiveGain = gain;
if (category != null) effectiveGain *= Sound.Owner.GetCategoryGainMultiplier(category);
- Al.Sourcef(alSource, Al.Gain, effectiveGain);
- int alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.Source(alSource, ALSourcef.Gain, effectiveGain);
+ ALError alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to set source's gain: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to set source's gain: " + AL.GetErrorString(alError));
}
}
}
@@ -207,11 +207,11 @@ namespace Barotrauma.Sounds
if (!IsStream)
{
uint alSource = Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex);
- Al.Sourcei(alSource, Al.Looping, looping ? Al.True : Al.False);
- int alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.Source(alSource, ALSourceb.Looping, looping);
+ ALError alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to set source's looping state: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to set source's looping state: " + AL.GetErrorString(alError));
}
}
}
@@ -242,41 +242,41 @@ namespace Barotrauma.Sounds
if (!IsStream)
{
uint alSource = Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex);
- int playbackPos; Al.GetSourcei(alSource, Al.SampleOffset, out playbackPos);
- int alError = Al.GetError();
- if (alError != Al.NoError)
+ int playbackPos; AL.GetSource(alSource, ALGetSourcei.SampleOffset, out playbackPos);
+ ALError alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to get source's playback position: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to get source's playback position: " + AL.GetErrorString(alError));
}
- Al.SourceStop(alSource);
+ AL.SourceStop(alSource);
- alError = Al.GetError();
- if (alError != Al.NoError)
+ alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to stop source: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to stop source: " + AL.GetErrorString(alError));
}
- Al.Sourcei(alSource, Al.Buffer, muffled ? (int)Sound.ALMuffledBuffer : (int)Sound.ALBuffer);
+ AL.BindBufferToSource(alSource,(uint)(muffled ? Sound.ALMuffledBuffer : Sound.ALBuffer));
- alError = Al.GetError();
- if (alError != Al.NoError)
+ alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to bind buffer to source: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to bind buffer to source: " + AL.GetErrorString(alError));
}
- Al.SourcePlay(alSource);
- alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.SourcePlay(alSource);
+ alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to replay source: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to replay source: " + AL.GetErrorString(alError));
}
- Al.Sourcei(alSource, Al.SampleOffset, playbackPos);
- alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.Source(alSource, ALSourcei.SampleOffset, playbackPos);
+ alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to reset playback position: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to reset playback position: " + AL.GetErrorString(alError));
}
}
}
@@ -324,13 +324,11 @@ namespace Barotrauma.Sounds
{
if (ALSourceIndex < 0) return false;
if (IsStream && !reachedEndSample) return true;
- int state;
- Al.GetSourcei(Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex), Al.SourceState, out state);
- bool playing = state == Al.Playing;
- int alError = Al.GetError();
- if (alError != Al.NoError)
+ bool playing = AL.GetSourceState(Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex)) == ALSourceState.Playing;
+ ALError alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to determine playing state from source: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to determine playing state from source: " + AL.GetErrorString(alError));
}
return playing;
}
@@ -359,47 +357,47 @@ namespace Barotrauma.Sounds
{
if (!IsStream)
{
- Al.Sourcei(sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex), Al.Buffer, 0);
- int alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.BindBufferToSource(sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex), 0);
+ ALError alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to reset source buffer: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to reset source buffer: " + AL.GetErrorString(alError));
}
- if (!Al.IsBuffer(sound.ALBuffer))
+ if (!AL.IsBuffer(sound.ALBuffer))
{
throw new Exception(sound.Filename + " has an invalid buffer!");
}
uint alBuffer = sound.Owner.GetCategoryMuffle(category) || muffle ? sound.ALMuffledBuffer : sound.ALBuffer;
- Al.Sourcei(sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex), Al.Buffer, (int)alBuffer);
- alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.BindBufferToSource(sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex), alBuffer);
+ alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to bind buffer to source (" + ALSourceIndex.ToString() + ":" + sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex) + "," + sound.ALBuffer.ToString() + "): " + Al.GetErrorString(alError));
+ throw new Exception("Failed to bind buffer to source (" + ALSourceIndex.ToString() + ":" + sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex) + "," + sound.ALBuffer.ToString() + "): " + AL.GetErrorString(alError));
}
- Al.SourcePlay(sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex));
- alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.SourcePlay(sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex));
+ alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to play source: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to play source: " + AL.GetErrorString(alError));
}
}
else
{
- Al.Sourcei(sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex), Al.Buffer, (int)sound.ALBuffer);
- int alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.BindBufferToSource(sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex), (uint)sound.ALBuffer);
+ ALError alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to reset source buffer: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to reset source buffer: " + AL.GetErrorString(alError));
}
- Al.Sourcei(sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex), Al.Looping, Al.False);
- alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.Source(sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex), ALSourceb.Looping, false);
+ alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to set stream looping state: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to set stream looping state: " + AL.GetErrorString(alError));
}
streamShortBuffer = new short[STREAM_BUFFER_SIZE];
@@ -408,15 +406,15 @@ namespace Barotrauma.Sounds
emptyBuffers = new List();
for (int i = 0; i < 4; i++)
{
- Al.GenBuffer(out streamBuffers[i]);
+ AL.GenBuffer(out streamBuffers[i]);
- alError = Al.GetError();
- if (alError != Al.NoError)
+ alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to generate stream buffers: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to generate stream buffers: " + AL.GetErrorString(alError));
}
- if (!Al.IsBuffer(streamBuffers[i]))
+ if (!AL.IsBuffer(streamBuffers[i]))
{
throw new Exception("Generated streamBuffer[" + i.ToString() + "] is invalid!");
}
@@ -447,57 +445,57 @@ namespace Barotrauma.Sounds
{
if (ALSourceIndex >= 0)
{
- Al.SourceStop(Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex));
- int alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.SourceStop(Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex));
+ ALError alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to stop source: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to stop source: " + AL.GetErrorString(alError));
}
if (IsStream)
{
uint alSource = Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex);
- Al.SourceStop(alSource);
- alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.SourceStop(alSource);
+ alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to stop streamed source: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to stop streamed source: " + AL.GetErrorString(alError));
}
int buffersToUnqueue = 0;
- uint[] unqueuedBuffers = null;
+ int[] unqueuedBuffers = null;
buffersToUnqueue = 0;
- Al.GetSourcei(alSource, Al.BuffersProcessed, out buffersToUnqueue);
- alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.GetSource(alSource, ALGetSourcei.BuffersProcessed, out buffersToUnqueue);
+ alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to determine processed buffers from streamed source: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to determine processed buffers from streamed source: " + AL.GetErrorString(alError));
}
- unqueuedBuffers = new uint[buffersToUnqueue];
- Al.SourceUnqueueBuffers(alSource, buffersToUnqueue, unqueuedBuffers);
- alError = Al.GetError();
- if (alError != Al.NoError)
+ unqueuedBuffers = new int[buffersToUnqueue];
+ AL.SourceUnqueueBuffers((int)alSource, buffersToUnqueue, unqueuedBuffers);
+ alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to unqueue buffers from streamed source: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to unqueue buffers from streamed source: " + AL.GetErrorString(alError));
}
-
- Al.Sourcei(alSource, Al.Buffer, 0);
- alError = Al.GetError();
- if (alError != Al.NoError)
+
+ AL.BindBufferToSource(alSource, 0);
+ alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to reset buffer for streamed source: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to reset buffer for streamed source: " + AL.GetErrorString(alError));
}
for (int i = 0; i < 4; i++)
{
- Al.DeleteBuffer(streamBuffers[i]);
- alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.DeleteBuffer(ref streamBuffers[i]);
+ alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to delete streamBuffers[" + i.ToString() + "] ("+streamBuffers[i].ToString()+"): " + Al.GetErrorString(alError));
+ throw new Exception("Failed to delete streamBuffers[" + i.ToString() + "] ("+streamBuffers[i].ToString()+"): " + AL.GetErrorString(alError));
}
}
@@ -505,11 +503,11 @@ namespace Barotrauma.Sounds
}
else
{
- Al.Sourcei(Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex), Al.Buffer, 0);
- alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.BindBufferToSource(Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex), 0);
+ alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to unbind buffer to non-streamed source: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to unbind buffer to non-streamed source: " + AL.GetErrorString(alError));
}
}
@@ -528,49 +526,47 @@ namespace Barotrauma.Sounds
{
uint alSource = Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex);
- int state;
- Al.GetSourcei(Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex), Al.SourceState, out state);
- bool playing = state == Al.Playing;
- int alError = Al.GetError();
- if (alError != Al.NoError)
+ bool playing = AL.GetSourceState(alSource) == ALSourceState.Playing;
+ ALError alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to determine playing state from streamed source: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to determine playing state from streamed source: " + AL.GetErrorString(alError));
}
int buffersToUnqueue = 0;
- uint[] unqueuedBuffers = null;
+ int[] unqueuedBuffers = null;
if (!startedPlaying)
{
buffersToUnqueue = 0;
- Al.GetSourcei(alSource, Al.BuffersProcessed, out buffersToUnqueue);
- alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.GetSource(alSource, ALGetSourcei.BuffersProcessed, out buffersToUnqueue);
+ alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to determine processed buffers from streamed source: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to determine processed buffers from streamed source: " + AL.GetErrorString(alError));
}
- unqueuedBuffers = new uint[buffersToUnqueue+emptyBuffers.Count];
- Al.SourceUnqueueBuffers(alSource, buffersToUnqueue, unqueuedBuffers);
+ unqueuedBuffers = new int[buffersToUnqueue+emptyBuffers.Count];
+ AL.SourceUnqueueBuffers((int)alSource, buffersToUnqueue, unqueuedBuffers);
for (int i = 0; i < emptyBuffers.Count; i++)
{
- unqueuedBuffers[buffersToUnqueue + i] = emptyBuffers[i];
+ unqueuedBuffers[buffersToUnqueue + i] = (int)emptyBuffers[i];
}
buffersToUnqueue += emptyBuffers.Count;
emptyBuffers.Clear();
- alError = Al.GetError();
- if (alError != Al.NoError)
+ alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to unqueue buffers from streamed source: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to unqueue buffers from streamed source: " + AL.GetErrorString(alError));
}
}
else
{
startedPlaying = false;
buffersToUnqueue = 4;
- unqueuedBuffers = new uint[4];
+ unqueuedBuffers = new int[4];
for (int i = 0; i < 4; i++)
{
- unqueuedBuffers[i] = streamBuffers[i];
+ unqueuedBuffers[i] = (int)streamBuffers[i];
}
}
@@ -616,20 +612,20 @@ namespace Barotrauma.Sounds
if (readSamples > 0)
{
- Al.BufferData(unqueuedBuffers[i], Sound.ALFormat, buffer, readSamples, Sound.SampleRate);
+ AL.BufferData(unqueuedBuffers[i], Sound.ALFormat, buffer, readSamples, Sound.SampleRate);
- alError = Al.GetError();
- if (alError != Al.NoError)
+ alError = AL.GetError();
+ if (alError != ALError.NoError)
{
throw new Exception("Failed to assign data to stream buffer: " +
- Al.GetErrorString(alError) + ": " + unqueuedBuffers[i].ToString() + "/" + unqueuedBuffers.Length + ", readSamples: " + readSamples);
+ AL.GetErrorString(alError) + ": " + unqueuedBuffers[i].ToString() + "/" + unqueuedBuffers.Length + ", readSamples: " + readSamples);
}
- Al.SourceQueueBuffer(alSource, unqueuedBuffers[i]);
- alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.SourceQueueBuffer((int)alSource, unqueuedBuffers[i]);
+ alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to queue buffer[" + i.ToString() + "] to stream: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to queue buffer[" + i.ToString() + "] to stream: " + AL.GetErrorString(alError));
}
}
else if (readSamples < 0)
@@ -641,11 +637,10 @@ namespace Barotrauma.Sounds
emptyBuffers.Add((uint)unqueuedBuffers[i]);
}
}
-
- Al.GetSourcei(alSource, Al.SourceState, out state);
- if (state != Al.Playing)
+
+ if (AL.GetSourceState(alSource) != ALSourceState.Playing)
{
- Al.SourcePlay(alSource);
+ AL.SourcePlay(alSource);
}
}
}
diff --git a/Barotrauma/BarotraumaClient/Source/Sounds/SoundManager.cs b/Barotrauma/BarotraumaClient/Source/Sounds/SoundManager.cs
index 2d9c74ffa..14807564c 100644
--- a/Barotrauma/BarotraumaClient/Source/Sounds/SoundManager.cs
+++ b/Barotrauma/BarotraumaClient/Source/Sounds/SoundManager.cs
@@ -2,7 +2,7 @@
using System.Threading;
using System.Collections.Generic;
using System.Xml.Linq;
-using OpenAL;
+using OpenTK.Audio.OpenAL;
using Microsoft.Xna.Framework;
using System.Linq;
using System.IO;
@@ -20,7 +20,7 @@ namespace Barotrauma.Sounds
}
private IntPtr alcDevice;
- private IntPtr alcContext;
+ private OpenTK.ContextHandle alcContext;
public enum SourcePoolIndex
{
@@ -42,11 +42,11 @@ namespace Barotrauma.Sounds
{
if (Disabled) { return; }
listenerPosition = value;
- Al.Listener3f(Al.Position,value.X,value.Y,value.Z);
- int alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.Listener(ALListener3f.Position,value.X,value.Y,value.Z);
+ ALError alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to set listener position: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to set listener position: " + AL.GetErrorString(alError));
}
}
}
@@ -59,11 +59,11 @@ namespace Barotrauma.Sounds
{
if (Disabled) { return; }
listenerOrientation[0] = value.X; listenerOrientation[1] = value.Y; listenerOrientation[2] = value.Z;
- Al.Listenerfv(Al.Orientation, listenerOrientation);
- int alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.Listener(ALListenerfv.Orientation, ref listenerOrientation);
+ ALError alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to set listener target vector: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to set listener target vector: " + AL.GetErrorString(alError));
}
}
}
@@ -74,11 +74,11 @@ namespace Barotrauma.Sounds
{
if (Disabled) { return; }
listenerOrientation[3] = value.X; listenerOrientation[4] = value.Y; listenerOrientation[5] = value.Z;
- Al.Listenerfv(Al.Orientation, listenerOrientation);
- int alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.Listener(ALListenerfv.Orientation, ref listenerOrientation);
+ ALError alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to set listener up vector: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to set listener up vector: " + AL.GetErrorString(alError));
}
}
}
@@ -92,11 +92,11 @@ namespace Barotrauma.Sounds
if (Disabled) { return; }
if (Math.Abs(ListenerGain - value) < 0.001f) { return; }
listenerGain = value;
- Al.Listenerf(Al.Gain, listenerGain);
- int alError = Al.GetError();
- if (alError != Al.NoError)
+ AL.Listener(ALListenerf.Gain, listenerGain);
+ ALError alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- throw new Exception("Failed to set listener gain: " + Al.GetErrorString(alError));
+ throw new Exception("Failed to set listener gain: " + AL.GetErrorString(alError));
}
}
}
@@ -126,8 +126,8 @@ namespace Barotrauma.Sounds
return;
}
- int alcError = Alc.GetError(alcDevice);
- if (alcError != Alc.NoError)
+ AlcError alcError = Alc.GetError(alcDevice);
+ if (alcError != AlcError.NoError)
{
//The audio device probably wasn't ready, this happens quite often
//Just wait a while and try again
@@ -136,7 +136,7 @@ namespace Barotrauma.Sounds
alcDevice = Alc.OpenDevice(null);
alcError = Alc.GetError(alcDevice);
- if (alcError != Alc.NoError)
+ if (alcError != AlcError.NoError)
{
DebugConsole.ThrowError("Error initializing ALC device: " + alcError.ToString() + ". Disabling audio playback...");
Disabled = true;
@@ -161,14 +161,14 @@ namespace Barotrauma.Sounds
}
alcError = Alc.GetError(alcDevice);
- if (alcError != Alc.NoError)
+ if (alcError != AlcError.NoError)
{
DebugConsole.ThrowError("Error after assigning ALC context: " + alcError.ToString() + ". Disabling audio playback...");
Disabled = true;
return;
}
- int alError = Al.NoError;
+ ALError alError = ALError.NoError;
sourcePools = new SoundSourcePool[2];
sourcePools[(int)SourcePoolIndex.Default] = new SoundSourcePool(SOURCE_COUNT);
@@ -177,12 +177,12 @@ namespace Barotrauma.Sounds
sourcePools[(int)SourcePoolIndex.Voice] = new SoundSourcePool(8);
playingChannels[(int)SourcePoolIndex.Voice] = new SoundChannel[8];
- Al.DistanceModel(Al.LinearDistanceClamped);
+ AL.DistanceModel(ALDistanceModel.LinearDistanceClamped);
- alError = Al.GetError();
- if (alError != Al.NoError)
+ alError = AL.GetError();
+ if (alError != ALError.NoError)
{
- DebugConsole.ThrowError("Error setting distance model: " + Al.GetErrorString(alError) + ". Disabling audio playback...");
+ DebugConsole.ThrowError("Error setting distance model: " + AL.GetErrorString(alError) + ". Disabling audio playback...");
Disabled = true;
return;
}
@@ -239,7 +239,7 @@ namespace Barotrauma.Sounds
{
if (Disabled || srcInd < 0 || srcInd >= sourcePools[(int)poolIndex].ALSources.Length) return 0;
- if (!Al.IsSource(sourcePools[(int)poolIndex].ALSources[srcInd]))
+ if (!AL.IsSource(sourcePools[(int)poolIndex].ALSources[srcInd]))
{
throw new Exception("alSources[" + srcInd.ToString() + "] is invalid!");
}
@@ -276,8 +276,8 @@ namespace Barotrauma.Sounds
{
for (int i = 0; i < sourcePools[0].ALSources.Length; i++)
{
- Al.Sourcef(sourcePools[0].ALSources[i], Al.MaxGain, i == ind ? 1.0f : 0.0f);
- Al.Sourcef(sourcePools[0].ALSources[i], Al.MinGain, 0.0f);
+ AL.Source(sourcePools[0].ALSources[i], ALSourcef.MaxGain, i == ind ? 1.0f : 0.0f);
+ AL.Source(sourcePools[0].ALSources[i], ALSourcef.MinGain, 0.0f);
}
}
#endif
@@ -514,7 +514,7 @@ namespace Barotrauma.Sounds
sourcePools[(int)SourcePoolIndex.Default]?.Dispose();
sourcePools[(int)SourcePoolIndex.Voice]?.Dispose();
- if (!Alc.MakeContextCurrent(IntPtr.Zero))
+ if (!Alc.MakeContextCurrent(OpenTK.ContextHandle.Zero))
{
throw new Exception("Failed to detach the current ALC context! (error code: " + Alc.GetError(alcDevice).ToString() + ")");
}
diff --git a/Barotrauma/BarotraumaClient/Source/Sounds/VideoSound.cs b/Barotrauma/BarotraumaClient/Source/Sounds/VideoSound.cs
index 011d557ab..ff877c8a0 100644
--- a/Barotrauma/BarotraumaClient/Source/Sounds/VideoSound.cs
+++ b/Barotrauma/BarotraumaClient/Source/Sounds/VideoSound.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using OpenAL;
+using OpenTK.Audio.OpenAL;
using Microsoft.Xna.Framework;
using System.Runtime.InteropServices;
using System.Threading;
@@ -21,7 +21,7 @@ namespace Barotrauma.Sounds
public VideoSound(SoundManager owner, string filename, int sampleRate, Video vid) : base(owner, filename, true, false)
{
- ALFormat = Al.FormatStereo16;
+ ALFormat = ALFormat.Stereo16;
SampleRate = sampleRate;
sampleQueue = new Queue();
@@ -110,4 +110,4 @@ namespace Barotrauma.Sounds
}
}
}
-}
+}
\ No newline at end of file
diff --git a/Barotrauma/BarotraumaClient/Source/Sounds/VoipSound.cs b/Barotrauma/BarotraumaClient/Source/Sounds/VoipSound.cs
index 5eb8ad951..18126a8ba 100644
--- a/Barotrauma/BarotraumaClient/Source/Sounds/VoipSound.cs
+++ b/Barotrauma/BarotraumaClient/Source/Sounds/VoipSound.cs
@@ -1,6 +1,6 @@
using Barotrauma.Networking;
using Microsoft.Xna.Framework;
-using OpenAL;
+using OpenTK.Audio.OpenAL;
using System;
using System.Collections.Generic;
@@ -58,7 +58,7 @@ namespace Barotrauma.Sounds
{
VoipConfig.SetupEncoding();
- ALFormat = Al.FormatMono16;
+ ALFormat = ALFormat.Mono16;
SampleRate = VoipConfig.FREQUENCY;
queue = q;
diff --git a/Barotrauma/BarotraumaClient/WindowsClient.csproj b/Barotrauma/BarotraumaClient/WindowsClient.csproj
index 151864bcf..dc6b33c63 100644
--- a/Barotrauma/BarotraumaClient/WindowsClient.csproj
+++ b/Barotrauma/BarotraumaClient/WindowsClient.csproj
@@ -31,7 +31,7 @@
true
- .pdb
+ .pdb
..\BarotraumaShared\Icon.ico
@@ -39,7 +39,7 @@
true
..\bin\ReleaseWindows\
- TRACE;WINDOWS;CLIENT;X64
+ TRACE;WINDOWS;CLIENT
true
pdbonly
x64
@@ -49,7 +49,7 @@
true
..\bin\DebugWindows\
- TRACE;DEBUG;WINDOWS;CLIENT;X64
+ TRACE;WINDOWS;CLIENT;DEBUG
full
x64
MinimumRecommendedRules.ruleset
@@ -60,7 +60,7 @@
true
..\bin\x86\ReleaseWindows\
- TRACE;WINDOWS;CLIENT;X86
+ TRACE;WINDOWS;CLIENT
true
pdbonly
x86
@@ -70,7 +70,7 @@
true
..\bin\x86\DebugWindows\
- TRACE;DEBUG;WINDOWS;CLIENT;X86
+ TRACE;WINDOWS;CLIENT;DEBUG
full
x86
MinimumRecommendedRules.ruleset
@@ -95,6 +95,9 @@
..\..\Libraries\NuGet\NVorbis.0.8.6\lib\net35\NVorbis.dll
+
+ ..\..\Libraries\NuGet\OpenTK.3.0.1\lib\net20\OpenTK.dll
+
..\..\Libraries\NuGet\RestSharp.105.2.3\lib\net45\RestSharp.dll
@@ -212,18 +215,18 @@
+
+ PreserveNewest
+
PreserveNewest
+
+ PreserveNewest
+
PreserveNewest
-
- PreserveNewest
-
-
- PreserveNewest
-
@@ -303,7 +306,7 @@
-
+
diff --git a/Barotrauma/BarotraumaClient/packages.config b/Barotrauma/BarotraumaClient/packages.config
index 72a6ec439..e593ce09a 100644
--- a/Barotrauma/BarotraumaClient/packages.config
+++ b/Barotrauma/BarotraumaClient/packages.config
@@ -8,6 +8,7 @@
+
diff --git a/Barotrauma/BarotraumaClient/wrap_oal.dll b/Barotrauma/BarotraumaClient/wrap_oal.dll
new file mode 100644
index 000000000..2713dae65
Binary files /dev/null and b/Barotrauma/BarotraumaClient/wrap_oal.dll differ
diff --git a/Barotrauma/BarotraumaShared/Source/GameSession/GameSession.cs b/Barotrauma/BarotraumaShared/Source/GameSession/GameSession.cs
index 7a47bff0e..32e255691 100644
--- a/Barotrauma/BarotraumaShared/Source/GameSession/GameSession.cs
+++ b/Barotrauma/BarotraumaShared/Source/GameSession/GameSession.cs
@@ -159,14 +159,8 @@ namespace Barotrauma
public void StartRound(Level level, bool reloadSub = true, bool loadSecondSub = false, bool mirrorLevel = false)
{
#if CLIENT
- if (GameMain.Client == null)
- {
- GameMain.LightManager.LosMode = GameMain.Config.LosMode;
- }
- else
- {
- GameMain.LightManager.LosEnabled = GameMain.Client.CharacterInfo != null;
- }
+ GameMain.LightManager.LosEnabled = GameMain.Client == null || GameMain.Client.CharacterInfo != null;
+ if (GameMain.Client == null) GameMain.LightManager.LosMode = GameMain.Config.LosMode;
#endif
this.Level = level;
diff --git a/Barotrauma/BarotraumaShared/Submarines/Orca.sub b/Barotrauma/BarotraumaShared/Submarines/Orca.sub
index 311edf3e7..c77d6144d 100644
Binary files a/Barotrauma/BarotraumaShared/Submarines/Orca.sub and b/Barotrauma/BarotraumaShared/Submarines/Orca.sub differ
diff --git a/Barotrauma/BarotraumaShared/Submarines/Remora.sub b/Barotrauma/BarotraumaShared/Submarines/Remora.sub
index 26d37bd22..6f29eb586 100644
Binary files a/Barotrauma/BarotraumaShared/Submarines/Remora.sub and b/Barotrauma/BarotraumaShared/Submarines/Remora.sub differ
diff --git a/Barotrauma/BarotraumaShared/changelog.txt b/Barotrauma/BarotraumaShared/changelog.txt
index 66313a114..745a25aea 100644
--- a/Barotrauma/BarotraumaShared/changelog.txt
+++ b/Barotrauma/BarotraumaShared/changelog.txt
@@ -1,3 +1,35 @@
+---------------------------------------------------------------------------------------------------------
+v0.9.0.4
+---------------------------------------------------------------------------------------------------------
+
+- Fixed "Steam authentication failed" errors when trying to reconnect to a server after cancelling the
+connection.
+- Fixed clients occasionally failing to spawn items when playing using a different language than the server,
+which caused them to get kicked.
+- Fixed extra cargo failing to spawn in multiplayer when playing using a different language than the server.
+- Fixed legacy items failing to load if a sub is saved with a language other than English and the language
+then changed to something else.
+- Fixed excessively small password input box when connecting to servers.
+- Fixed a bug that occasionally caused items to drop from the inventory when moving items between
+inventory slots in the multiplayer.
+- Prevent junction boxes from getting damaged due to overvoltage in the engineering tutorial.
+- Fixed structures getting scaled incorrectly when cloning a structure with a non-default scale in the
+submarine editor.
+- Fixed occasional crashes when leaving a multiplayer session while the "cinematic" at the end of the round
+is still playing.
+- Fixed items not being moved to the humanhusk's inventory when a huskified player dies (= clothes and
+other gear seemed to magically disappear when the character "resurrected" as an AI husk).
+- Fixed clients not seeing turrets rotating at their end when another client is operating the turret.
+- Fixed hitscan projectiles (revolver rounds) going through walls if the weapon is fired while its
+barrel is partially inside the wall.
+- Fixed welding tools being able to weld doors and burn characters through walls.
+- Fixed bots reporting leaks when there are holes in the interior walls.
+- Fixes to the colliders of some of the shuttle wall pieces.
+- Fixed Linux version crashing when attempting to browse for files in the Steam Workshop menu.
+- Fixed credits not resizing when resolution is changed.
+- Added an upper limit to impact damage done to ragdolls, preventing characters from getting instakilled if
+a Moloch or another large monster smashes against the sub hard enough.
+
---------------------------------------------------------------------------------------------------------
v0.9.0.3
---------------------------------------------------------------------------------------------------------