Пример #1
0
        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;
        }
Пример #2
0
        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;
        }
Пример #3
0
		public void EndCapture ()
		{
			CheckState();
			OpenALRunner.RemoveUser();

			if (!this.isOpened)
				return;

			IsCapturing = false;
			OpenALRunner.RemoveCaptureProvider (this);

			if (this.device.IsOpen)
				this.device.StopCapture();
		}
Пример #4
0
		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();
		}