Пример #1
0
        public Context(Device device, Dictionary <int, int> attributes)
            : this()
        {
            if (device == Device.Null)
            {
                throw new ArgumentNullException("device");
            }

            unsafe
            {
                var  attribs_length = attributes == null ? 0 : attributes.Count * 2;
                int *attribs        = stackalloc int[attribs_length + 1];

                if (attributes != null)
                {
                    int index = 0;
                    foreach (var pair in attributes)
                    {
                        attribs[index++] = pair.Key;
                        attribs[index++] = pair.Value;
                    }
                    attribs[attribs_length] = 0;
                }
                else
                {
                    attribs = null;
                }

                Handle = Alc.CreateContext(device.Handle, attribs);
                AlHelper.GetAlcError(Alc.GetError(device.Handle));
            }
        }
Пример #2
0
 public void Read(IntPtr buffer, int samples)
 {
     AlHelper.ThrowNullException(Handle);
     unsafe
     {
         Alc.CaptureSamples(Handle, buffer.ToPointer(), samples);
         AlHelper.GetAlcError(Alc.GetError(Handle));
     }
 }
Пример #3
0
 public void Read(byte[] buffer, int samples)
 {
     AlHelper.ThrowNullException(Handle);
     unsafe
     {
         fixed(byte *pointer = buffer)
         {
             Alc.CaptureSamples(Handle, pointer, samples);
             AlHelper.GetAlcError(Alc.GetError(Handle));
         }
     }
 }
Пример #4
0
        public Context(Device device)
            : this()
        {
            if (device == Device.Null)
            {
                throw new ArgumentNullException("device");
            }

            unsafe
            {
                Handle = Alc.CreateContext(device.Handle, null);
                AlHelper.GetAlcError(Alc.GetError(device.Handle));
            }
        }
Пример #5
0
 public void Stop()
 {
     AlHelper.ThrowNullException(Handle);
     Alc.CaptureStop(Handle);
     AlHelper.GetAlcError(Alc.GetError(Handle));
 }