Example #1
0
        public void BufferData(IntPtr data, int length, int format, int samplerate)
        {
            int buffer;

            lock (buffers)
            {
                // Get a free buffer
                if (buffers.Count == 0)
                {
                    Monitor.Wait(buffers);
                }

                buffer = buffers.Dequeue();
            }

            IntPtr t = Alc.alcGetCurrentContext();

            // Fill buffer
            Al.alBufferData(buffer, format, data, length, samplerate);

            // Queue buffer
            Al.alSourceQueueBuffers(source, 1, ref buffer);
        }