Unstable v0.1300.0.0 (February 19th 2021)
This commit is contained in:
@@ -561,13 +561,13 @@ namespace Barotrauma.Sounds
|
||||
}
|
||||
}
|
||||
|
||||
public void SetCategoryMuffle(string category,bool muffle)
|
||||
public void SetCategoryMuffle(string category, bool muffle)
|
||||
{
|
||||
if (Disabled) { return; }
|
||||
|
||||
category = category.ToLower();
|
||||
|
||||
if (categoryModifiers == null) categoryModifiers = new Dictionary<string, CategoryModifier>();
|
||||
if (categoryModifiers == null) { categoryModifiers = new Dictionary<string, CategoryModifier>(); }
|
||||
if (!categoryModifiers.ContainsKey(category))
|
||||
{
|
||||
categoryModifiers.Add(category, new CategoryModifier(0, 1.0f, muffle));
|
||||
@@ -585,7 +585,7 @@ namespace Barotrauma.Sounds
|
||||
{
|
||||
if (playingChannels[i][j] != null && playingChannels[i][j].IsPlaying)
|
||||
{
|
||||
if (playingChannels[i][j].Category.ToLower() == category) playingChannels[i][j].Muffled = muffle;
|
||||
if (playingChannels[i][j]?.Category.ToLower() == category) { playingChannels[i][j].Muffled = muffle; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -597,7 +597,7 @@ namespace Barotrauma.Sounds
|
||||
if (Disabled) { return false; }
|
||||
|
||||
category = category.ToLower();
|
||||
if (categoryModifiers == null || !categoryModifiers.ContainsKey(category)) return false;
|
||||
if (categoryModifiers == null || !categoryModifiers.ContainsKey(category)) { return false; }
|
||||
return categoryModifiers[category].Muffle;
|
||||
}
|
||||
|
||||
@@ -706,9 +706,11 @@ namespace Barotrauma.Sounds
|
||||
}
|
||||
|
||||
bool areStreamsPlaying = false;
|
||||
ManualResetEvent streamMre = null;
|
||||
|
||||
void UpdateStreaming()
|
||||
{
|
||||
streamMre = new ManualResetEvent(false);
|
||||
bool killThread = false;
|
||||
while (!killThread)
|
||||
{
|
||||
@@ -745,14 +747,20 @@ namespace Barotrauma.Sounds
|
||||
}
|
||||
}
|
||||
}
|
||||
streamMre.WaitOne(10);
|
||||
streamMre.Reset();
|
||||
lock (threadDeathMutex)
|
||||
{
|
||||
areStreamsPlaying = !killThread;
|
||||
}
|
||||
Thread.Sleep(10); //TODO: use a separate thread for network audio?
|
||||
}
|
||||
}
|
||||
|
||||
public void ForceStreamUpdate()
|
||||
{
|
||||
streamMre?.Set();
|
||||
}
|
||||
|
||||
private void ReloadSounds()
|
||||
{
|
||||
for (int i = loadedSounds.Count - 1; i >= 0; i--)
|
||||
|
||||
Reference in New Issue
Block a user