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)); } }
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)); } } }
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)); } } }
public void Stop() { AlHelper.ThrowNullException(Handle); Alc.CaptureStop(Handle); AlHelper.GetAlcError(Alc.GetError(Handle)); }
public void Destroy() { AlHelper.ThrowNullException(Handle); Alc.DestroyContext(Handle); }
public static bool MakeContextCurrent(Context context) { return(Alc.MakeContextCurrent(context.Handle) != 0); }
public void Suspend() { AlHelper.ThrowNullException(Handle); Alc.SuspendContext(Handle); }
public void Process() { AlHelper.ThrowNullException(Handle); Alc.ProcessContext(Handle); }