Example #1
0
        private void ReleaseUnmanagedResources()
        {
            if (_disposed)
            {
                return;
            }

            ALC10.alcMakeContextCurrent(MainContext.Handle);
            for (var i = 0; i < _buffers.Count; i++)
            {
                var buf = _buffers[i];
                AL10.alDeleteBuffers(_buffers.Count, ref buf);
            }
            _buffers.Clear();

            ALC10.alcMakeContextCurrent(IntPtr.Zero);
            foreach (var ctx in _contexts)
            {
                ctx.Destroy();
            }

            ALC10.alcCloseDevice(_handle);

            _disposed = true;
        }
Example #2
0
        public override void Dispose()
        {
            if (!IsDisposed)
            {
                base.Dispose();                 // Will call Stop(true);

                // Delete all known buffer objects
                uint qBuffer;
                while (queuedBuffers.Count > 0)
                {
                    qBuffer = queuedBuffers.Dequeue();
                    AL10.alDeleteBuffers((IntPtr)1, ref qBuffer);
                }
                queuedBuffers = null;
                while (availableBuffers.Count > 0)
                {
                    qBuffer = availableBuffers.Dequeue();
                    AL10.alDeleteBuffers((IntPtr)1, ref qBuffer);
                }
                availableBuffers = null;
                while (buffersToQueue.Count > 0)
                {
                    qBuffer = buffersToQueue.Dequeue();
                    AL10.alDeleteBuffers((IntPtr)1, ref qBuffer);
                }
                buffersToQueue = null;

                IsDisposed = true;
            }
        }
Example #3
0
 public void Dispose()
 {
     if (!IsDisposed)
     {
         AL10.alDeleteBuffers((IntPtr)1, ref INTERNAL_buffer);
         IsDisposed = true;
     }
 }
Example #4
0
 protected virtual void Dispose(bool disposing)
 {
     if (!disposed)
     {
         AL10.alDeleteBuffers(1, ref buffer);
         disposed = true;
     }
 }
Example #5
0
        public void DeleteBuffer(IALBuffer buffer)
        {
            uint handle = (buffer as OpenALBuffer).Handle;

            AL10.alDeleteBuffers(1, ref handle);
#if VERBOSE_AL_DEBUGGING
            CheckALError();
#endif
        }
Example #6
0
 protected override void Dispose(bool disposeManagedResources)
 {
     if (_handle > 0)
     {
         AL10.alDeleteBuffers(1, ref _handle);
         AudioSystem.alCheckError();
         _handle = 0;
     }
     base.Dispose(disposeManagedResources);
 }
Example #7
0
        protected virtual void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            AL10.alDeleteBuffers(1, new[] { Buffer });
            Check();
            _disposed = true;
        }
Example #8
0
        /// <summary>
        /// Delete a buffer.
        /// </summary>
        /// <param name="name">Name of the buffer.</param>
        /// <exception cref="InvalidOperationException">If the buffer is not owned by this device.</exception>
        public void DeleteBuffer(uint name)
        {
            CheckDisposed();

            if (!_buffers.Remove(name))
            {
                throw new InvalidOperationException("Device does not own given buffer.");
            }

            ALC10.alcMakeContextCurrent(MainContext.Handle);
            AL10.alDeleteBuffers(1, ref name);
            AlHelper.AlCheckError("alDeleteBuffers call failed.");
        }
Example #9
0
 private void dispose(bool disposing)
 {
     if (!_isDisposed)
     {
         if (_handle != 0 && !AudioEngine.IsShutdown)
         {
             AL10.alDeleteBuffers(1, ref _handle);
             ALUtils.CheckALError("unable to destroy sound buffer");
             _handle = 0;
         }
         _isDisposed = true;
     }
 }
Example #10
0
        /// <summary>
        /// Delete a collection of buffers.
        /// </summary>
        /// <param name="buffers">Array to delete buffers from, starting at index 0.</param>
        /// <param name="n">Number of buffers to delete.</param>
        /// <remarks>
        /// Buffers that are not owned by this device are ignored.
        /// </remarks>
        /// <exception cref="IndexOutOfRangeException">
        /// If <paramref name="n"/> is larger than or equal to <code>buffers.Length</code>.
        /// </exception>
        public void DeleteBuffers(uint[] buffers, int n)
        {
            CheckDisposed();
            ALC10.alcMakeContextCurrent(MainContext.Handle);

            for (var i = 0; i < n; i++)
            {
                var buffer = buffers[i];
                if (_buffers.Remove(buffer))
                {
                    AL10.alDeleteBuffers(1, ref buffer);
                }
            }
            AlHelper.AlCheckError("alDeleteBuffers call failed.");
        }
Example #11
0
        public void DeleteBuffer(IALBuffer buffer)
        {
            uint handle = (buffer as OpenALBuffer).Handle;

            AL10.alDeleteBuffers((IntPtr)1, ref handle);
        }