Dispose some sound streams.

This commit is contained in:
RoosterDragon
2016-12-23 19:37:17 +00:00
parent 53bd29351b
commit 226c0a050a
6 changed files with 32 additions and 16 deletions

View File

@@ -23,7 +23,7 @@ namespace OpenRA
bool TryParseSound(Stream stream, out ISoundFormat sound);
}
public interface ISoundFormat
public interface ISoundFormat : IDisposable
{
int Channels { get; }
int SampleBits { get; }
@@ -67,8 +67,12 @@ namespace OpenRA
{
stream.Position = 0;
if (loader.TryParseSound(stream, out soundFormat))
return soundEngine.AddSoundSourceFromMemory(
{
var source = soundEngine.AddSoundSourceFromMemory(
soundFormat.GetPCMInputStream().ReadAllBytes(), soundFormat.Channels, soundFormat.SampleBits, soundFormat.SampleRate);
soundFormat.Dispose();
return source;
}
}
}