mirror of
https://github.com/crskycode/GARbro.git
synced 2025-01-12 04:49:32 +08:00
(PlayFile): don't dispose stream on successful open.
This commit is contained in:
parent
6b1f971160
commit
7b4b755e17
@ -924,7 +924,8 @@ namespace GARbro.GUI
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
SetBusyState();
|
SetBusyState();
|
||||||
using (var input = VFS.OpenBinaryStream (entry))
|
var input = VFS.OpenBinaryStream (entry);
|
||||||
|
try
|
||||||
{
|
{
|
||||||
FormatCatalog.Instance.LastError = null;
|
FormatCatalog.Instance.LastError = null;
|
||||||
sound = AudioFormat.Read (input);
|
sound = AudioFormat.Read (input);
|
||||||
@ -945,11 +946,17 @@ namespace GARbro.GUI
|
|||||||
AudioDevice.Init (CurrentAudio);
|
AudioDevice.Init (CurrentAudio);
|
||||||
AudioDevice.PlaybackStopped += OnPlaybackStopped;
|
AudioDevice.PlaybackStopped += OnPlaybackStopped;
|
||||||
AudioDevice.Play();
|
AudioDevice.Play();
|
||||||
|
input = null;
|
||||||
var fmt = CurrentAudio.WaveFormat;
|
var fmt = CurrentAudio.WaveFormat;
|
||||||
SetResourceText (string.Format (guiStrings.MsgPlaying, entry.Name,
|
SetResourceText (string.Format (guiStrings.MsgPlaying, entry.Name,
|
||||||
fmt.SampleRate, sound.SourceBitrate / 1000,
|
fmt.SampleRate, sound.SourceBitrate / 1000,
|
||||||
CurrentAudio.TotalTime.ToString ("m':'ss")));
|
CurrentAudio.TotalTime.ToString ("m':'ss")));
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (input != null)
|
||||||
|
input.Dispose();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception X)
|
catch (Exception X)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user