Reverted sound loading changes in 2cb0ee73. I don't think sharing the same Sound objects is necessary, because Sounds using the same audio clip already share the same OggSound object which holds the actual audio data. Also I think these changes would cause removing a sound to break other sounds sharing the same audio clip.

This commit is contained in:
Joonas Rikkonen
2018-01-09 12:16:17 +02:00
parent 4b1b6b6927
commit 855891704d

View File

@@ -87,10 +87,6 @@ namespace Barotrauma
DebugConsole.ThrowError("File \"" + file + "\" not found!");
return null;
}
Sound dupe = Sound.loadedSounds.Find(s => s.filePath == file);
if (dupe != null)
return dupe;
return new Sound(file, destroyOnGameEnd);
}
@@ -104,9 +100,6 @@ namespace Barotrauma
{
newSound.baseVolume = element.GetAttributeFloat("volume", 1.0f);
newSound.range = element.GetAttributeFloat("range", 1000.0f);
Sound dupe = Sound.loadedSounds.Find(s => s.filePath == filePath && s.baseVolume == newSound.baseVolume && s.range == newSound.range);
if (dupe != null)
return dupe;
}
return newSound;