Ejemplo n.º 1
0
        public AudioContext(AudioDevice device, ICollection <AudioContextAttribute> options)
        {
            int[] realOptions = null;

            if (device == null)
            {
                throw new ArgumentNullException("device");
            }
            this.device = device;

            if (options != null)
            {
                int index = 0;
                realOptions = new int[options.Count * 2 + 1];
                foreach (AudioContextAttribute option in options)
                {
                    if (option == null)
                    {
                        throw new ArgumentNullException("option[]");
                    }
                    realOptions[index + 0] = (int)option.Attribute;
                    realOptions[index + 1] = option.BaseValue;
                    index += 2;
                }
                realOptions[index] = 0;
            }

            handle = Alc.CreateContext(device.Handle, realOptions);
            CheckError();
            if (handle == null)
            {
                throw new Exception();
            }

            MakeCurrent();
            extensions = new ReadOnlyCollection <string>(Get(ALGetString.Extensions).Split(' '));
            SetupEffects();

            AL.Listener(ALListenerf.EfxMetersPerUnit, (float)Length.Universal(1).InMetres);
        }
Ejemplo n.º 2
0
 public AudioContext(AudioDevice device, params AudioContextAttribute[] options) : this(device, (ICollection <AudioContextAttribute>)options)
 {
 }
Ejemplo n.º 3
0
 internal AudioCapture(AudioDevice device, IntPtr handle, AudioFormat format)
 {
     this.device = device;
     this.handle = handle;
     this.format = format;
 }