Reset stream position after TryParseSound failures

This commit is contained in:
Matthias Mailänder
2016-01-13 15:03:27 +01:00
parent d578ea4094
commit 047f71e5ec
4 changed files with 16 additions and 3 deletions

View File

@@ -63,11 +63,8 @@ namespace OpenRA
int sampleBits;
int sampleRate;
foreach (var loader in Game.ModData.SoundLoaders)
{
stream.Position = 0;
if (loader.TryParseSound(stream, filename, out rawData, out channels, out sampleBits, out sampleRate))
return soundEngine.AddSoundSourceFromMemory(rawData, channels, sampleBits, sampleRate);
}
throw new InvalidDataException(filename + " is not a valid sound file!");
}