public void Dispose() { Console.WriteLine("Shutdown music."); if (stream != null) { stream.Stop(); stream.Dispose(); stream = null; } }
public SfmlMusic(Config config, string sfPath) { try { Console.Write("Initialize music: "); this.config = config; this.stream = new MusStream(this, config, sfPath); this.current = Bgm.NONE; Console.WriteLine("OK"); } catch (Exception e) { Console.WriteLine("Failed"); this.Dispose(); ExceptionDispatchInfo.Throw(e); } }