From f1a8db5b47d5a05808562a18b75a105a731c7ce7 Mon Sep 17 00:00:00 2001 From: Juan Pablo Arce Date: Wed, 8 Aug 2018 20:57:00 -0300 Subject: [PATCH] Fixed stereo sound loading I had already fixed this on the dev branch, backporting because it's gonna take a while until it's released --- Barotrauma/BarotraumaClient/Source/Sounds/OggSound.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Barotrauma/BarotraumaClient/Source/Sounds/OggSound.cs b/Barotrauma/BarotraumaClient/Source/Sounds/OggSound.cs index 172ce99b2..9e112658b 100644 --- a/Barotrauma/BarotraumaClient/Source/Sounds/OggSound.cs +++ b/Barotrauma/BarotraumaClient/Source/Sounds/OggSound.cs @@ -39,7 +39,7 @@ namespace Barotrauma.Sounds using (VorbisReader reader = new VorbisReader(oggFile)) { - int bufferSize = (int)reader.TotalSamples; + int bufferSize = (int)reader.TotalSamples * reader.Channels; float[] buffer = new float[bufferSize]; sound.castBuffer = new short[bufferSize]; @@ -52,6 +52,8 @@ namespace Barotrauma.Sounds sound.format = reader.Channels == 1 ? ALFormat.Mono16 : ALFormat.Stereo16; sound.sampleRate = reader.SampleRate; + ALHelper.Check(); + //alSourceId = AL.GenSource(); AL.BufferData(sound.alBufferId, reader.Channels == 1 ? ALFormat.Mono16 : ALFormat.Stereo16, sound.castBuffer, readSamples * sizeof(short), reader.SampleRate);