Exemplo n.º 1
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));
            }
        }
Exemplo n.º 2
0
        public Device(string name)
            : this()
        {
            unsafe
            {
                int   name_length = name == null ? 0 : Encoding.ASCII.GetByteCount(name);
                byte *name_ansi   = stackalloc byte[name_length + 1];
                AlHelper.StringToAnsi(name, name_ansi, name_length);
                name_ansi = name == null ? null : name_ansi;

                Handle = Alc.OpenDevice(name_ansi);
                if (Handle == IntPtr.Zero)
                {
                    throw new OpenALException(string.Format(
                                                  "OpenDevice({0}) failed.", name));
                }
            }
        }
Exemplo n.º 3
0
        public CaptureDevice(string name, uint frequency, Format format, int buffersize)
            : this()
        {
            unsafe
            {
                int   name_length = name == null ? 0 : Encoding.ASCII.GetByteCount(name);
                byte *name_ansi   = stackalloc byte[name_length + 1];
                AlHelper.StringToAnsi(name, name_ansi, name_length);
                name_ansi = name == null ? null : name_ansi;

                Handle = Alc.CaptureOpenDevice(name_ansi, frequency, (int)format, buffersize);
                if (Handle == IntPtr.Zero)
                {
                    throw new OpenALException(string.Format(
                                                  "CaptureOpenDevice({0}, {1}, {2}, {3}) failed.", name, frequency, format, buffersize));
                }
            }
        }
Exemplo n.º 4
0
 public void Stop()
 {
     AlHelper.ThrowNullException(Handle);
     Alc.CaptureStop(Handle);
     AlHelper.GetAlcError(Alc.GetError(Handle));
 }
Exemplo n.º 5
0
 public void Destroy()
 {
     AlHelper.ThrowNullException(Handle);
     Alc.DestroyContext(Handle);
 }
Exemplo n.º 6
0
 public static bool MakeContextCurrent(Context context)
 {
     return(Alc.MakeContextCurrent(context.Handle) != 0);
 }
Exemplo n.º 7
0
 public void Suspend()
 {
     AlHelper.ThrowNullException(Handle);
     Alc.SuspendContext(Handle);
 }
Exemplo n.º 8
0
 public void Process()
 {
     AlHelper.ThrowNullException(Handle);
     Alc.ProcessContext(Handle);
 }