public void InitMixer() { Mixer.Close(); //Assert.IsFalse(Mixer.IsInitialized); Mixer.Initialize(); //Assert.IsTrue(Mixer.IsInitialized); Mixer.Close(); }
/// <summary> /// 关闭并释放资源 /// </summary> public void Close() { if (m_pWaveIn != null) { m_pWaveIn.Stop(); m_pWaveIn.Dispose(); } trackBarIn.Dispose(); trackBarIn = null; trackBarOut.Dispose(); trackBarOut = null; mixerF.Close(); mixerF = null; if (outdtl != null) { outdtl = null; } if (indtl != null) { indtl = null; } }
/// <summary> /// Close the audio file /// </summary> public void Close() { if (!IsDisposed()) { try { Stop(); } catch { } m_pReader.Close(); // Wait for the reader to deliver a WMT_CLOSED event to the OnStatus // callback. m_hAsyncEvent.WaitOne(); } // // Close the wave output device. // if (m_hWaveOut != IntPtr.Zero) { for (int x = 0; x < MAXBUFFERS; x++) { if (m_InsBuf[x] != null) { m_InsBuf[x].Release(m_hWaveOut); } } waveOut.Restart(m_hWaveOut); // ignore error waveOut.Close(m_hWaveOut); // ignore error m_hWaveOut = IntPtr.Zero; } // Close the mixer if (m_hMixer != IntPtr.Zero) { Mixer.Close(m_hMixer); m_hMixer = IntPtr.Zero; } }
/// <summary> /// /// </summary> public void Go() { string filePath = Path.Combine("..", ".."); string fileDirectory = "Data"; string fileName = "test.mpg"; if (File.Exists(fileName)) { filePath = ""; fileDirectory = ""; } else if (File.Exists(Path.Combine(fileDirectory, fileName))) { filePath = ""; } string file = Path.Combine(Path.Combine(filePath, fileDirectory), fileName); int width = 352; int height = 240; Events.KeyboardDown += new EventHandler <KeyboardEventArgs>(this.KeyboardDown); Events.Tick += new EventHandler <TickEventArgs>(this.Tick); Events.Quit += new EventHandler <QuitEventArgs>(this.Quit); Video.WindowIcon(); Video.WindowCaption = "SDL.NET - Movie Player"; screen = Video.SetVideoMode(width, height); Mixer.Close(); movie = new Movie(file); Console.WriteLine("Time: " + movie.Length); Console.WriteLine("Width: " + movie.Size.Width); Console.WriteLine("Height: " + movie.Size.Height); Console.WriteLine("HasAudio: " + movie.HasAudio); Console.WriteLine("HasVideo: " + movie.HasVideo); movie.Display(screen); movie.Play(); Events.Run(); }
public void Dispose() { try { Close(); } catch { } if (!IsDisposed()) { Marshal.ReleaseComObject(m_pReader); m_pReader = null; m_pHeaderInfo = null; } if (IntPtr.Zero != m_hWaveOut) { waveOut.Close(m_hWaveOut); // Ignore return m_hWaveOut = IntPtr.Zero; } if (IntPtr.Zero != m_hMixer) { Mixer.Close(m_hMixer); m_hMixer = IntPtr.Zero; } if (null != m_hAsyncEvent) { m_hAsyncEvent.Close(); m_hAsyncEvent = null; } m_pWfx = null; #if SUPPORT_DRM objDRM.Dispose(); m_pwszURL = null; #endif }