(PlayFile): don't dispose stream on successful open.

This commit is contained in:
morkt 2016-10-17 11:14:42 +04:00
parent 6b1f971160
commit 7b4b755e17

View File

@ -924,7 +924,8 @@ namespace GARbro.GUI
try
{
SetBusyState();
using (var input = VFS.OpenBinaryStream (entry))
var input = VFS.OpenBinaryStream (entry);
try
{
FormatCatalog.Instance.LastError = null;
sound = AudioFormat.Read (input);
@ -945,11 +946,17 @@ namespace GARbro.GUI
AudioDevice.Init (CurrentAudio);
AudioDevice.PlaybackStopped += OnPlaybackStopped;
AudioDevice.Play();
input = null;
var fmt = CurrentAudio.WaveFormat;
SetResourceText (string.Format (guiStrings.MsgPlaying, entry.Name,
fmt.SampleRate, sound.SourceBitrate / 1000,
CurrentAudio.TotalTime.ToString ("m':'ss")));
}
finally
{
if (input != null)
input.Dispose();
}
}
catch (Exception X)
{