(ded4a3e0a) v0.9.0.7

This commit is contained in:
Joonas Rikkonen
2019-06-25 16:00:44 +03:00
parent e5ae622c77
commit 4a51db77b5
1777 changed files with 421528 additions and 917 deletions
@@ -196,7 +196,7 @@ namespace OpenAL
public static IntPtr CaptureOpenDevice(string devicename, uint frequency, int format, int buffersize)
{
byte[] devicenameBytes = Encoding.UTF8.GetBytes(devicename);
byte[] devicenameBytes = Encoding.UTF8.GetBytes(devicename + "\0");
GCHandle devicenameHandle = GCHandle.Alloc(devicenameBytes, GCHandleType.Pinned);
IntPtr retVal = CaptureOpenDevice(devicenameHandle.AddrOfPinnedObject(), frequency, format, buffersize);
devicenameHandle.Free();
@@ -325,7 +325,9 @@ 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);
uint alSource = Sound.Owner.GetSourceFromIndex(Sound.SourcePoolIndex, ALSourceIndex);
if (!Al.IsSource(alSource)) return false;
Al.GetSourcei(alSource, Al.SourceState, out state);
bool playing = state == Al.Playing;
int alError = Al.GetError();
if (alError != Al.NoError)
@@ -174,8 +174,8 @@ namespace Barotrauma.Sounds
sourcePools[(int)SourcePoolIndex.Default] = new SoundSourcePool(SOURCE_COUNT);
playingChannels[(int)SourcePoolIndex.Default] = new SoundChannel[SOURCE_COUNT];
sourcePools[(int)SourcePoolIndex.Voice] = new SoundSourcePool(8);
playingChannels[(int)SourcePoolIndex.Voice] = new SoundChannel[8];
sourcePools[(int)SourcePoolIndex.Voice] = new SoundSourcePool(16);
playingChannels[(int)SourcePoolIndex.Voice] = new SoundChannel[16];
Al.DistanceModel(Al.LinearDistanceClamped);
@@ -202,7 +202,10 @@ namespace Barotrauma.Sounds
}
Sound newSound = new OggSound(this, filename, stream);
loadedSounds.Add(newSound);
lock (loadedSounds)
{
loadedSounds.Add(newSound);
}
return newSound;
}
@@ -225,7 +228,10 @@ namespace Barotrauma.Sounds
newSound.BaseFar = range;
}
loadedSounds.Add(newSound);
lock (loadedSounds)
{
loadedSounds.Add(newSound);
}
return newSound;
}
@@ -352,12 +358,15 @@ namespace Barotrauma.Sounds
public void RemoveSound(Sound sound)
{
for (int i = 0; i < loadedSounds.Count; i++)
lock (loadedSounds)
{
if (loadedSounds[i] == sound)
for (int i = 0; i < loadedSounds.Count; i++)
{
loadedSounds.RemoveAt(i);
return;
if (loadedSounds[i] == sound)
{
loadedSounds.RemoveAt(i);
return;
}
}
}
}