protected void Dispose(bool disposing) { if (this.isDisposed) { return; } OpenAL.DebugFormat("Freeing OpenALPlaybackProvider. Disposing: ", disposing); if (disposing) { this.pool.Dispose(); if (this.device != null) { this.device.Dispose(); } } SourceBuffer.Clear(); OpenALRunner.RemoveUser(); OpenALRunner.RemovePlaybackProvider(this); this.pool = null; this.device = null; this.isDisposed = true; }
public void Open() { if (this.isDisposed) { throw new ObjectDisposedException("OpenALPlaybackProvider"); } if (this.device == null) { throw new InvalidOperationException("Device is not set"); } if (this.isOpen) { throw new InvalidOperationException("Already open"); } OpenALRunner.AddUser(); OpenALRunner.AddPlaybackProvider(this); if (!this.device.IsOpen) { this.device.Open(); } if (Context.CurrentContext == null || Context.CurrentContext.Device != this.device) { Context.CreateAndActivate(this.device); } isOpen = true; }
public void EndCapture () { CheckState(); OpenALRunner.RemoveUser(); if (!this.isOpened) return; IsCapturing = false; OpenALRunner.RemoveCaptureProvider (this); if (this.device.IsOpen) this.device.StopCapture(); }
public void BeginCapture (AudioFormat format, int captureFrameSize) { CheckState(); OpenALRunner.AddUser(); if (!this.isOpened) { this.device.Open ((uint)format.SampleRate, format.ToOpenALFormat()); this.isOpened = true; } if (!this.device.IsOpen) return; this.format = format; this.frameSize = captureFrameSize; OpenALRunner.AddCaptureProvider (this); IsCapturing = true; this.device.StartCapture(); }