public void StopDeviceCapture(IntPtr handle) { ALC11.alcCaptureStop(handle); ALC11.alcCaptureCloseDevice(handle); #if VERBOSE_AL_DEBUGGING if (CheckALCError()) { throw new InvalidOperationException("AL device error!"); } #endif }
static string[] PhysicalDevices() { // Returns all devices under Windows Vista and newer if (ALC11.alcIsExtensionPresent(IntPtr.Zero, "ALC_ENUMERATE_ALL_EXT")) { return(QueryDevices("ALC_ENUMERATE_ALL_EXT", ALC11.ALC_ALL_DEVICES_SPECIFIER)); } if (ALC11.alcIsExtensionPresent(IntPtr.Zero, "ALC_ENUMERATION_EXT")) { return(QueryDevices("ALC_ENUMERATION_EXT", ALC10.ALC_DEVICE_SPECIFIER)); } return(new string[] { }); }
/// <summary> /// Get the available devices. /// </summary> public static IEnumerable <string> GetDevices() { var deviceList = ALC11.alcIsExtensionPresent(IntPtr.Zero, "ALC_ENUMERATE_ALL_EXT") ? ALC10.alcGetString(IntPtr.Zero, ALC11.ALC_ALL_DEVICES_SPECIFIER) : ALC10.alcGetString(IntPtr.Zero, ALC10.ALC_DEVICE_SPECIFIER); var curString = Marshal.PtrToStringAnsi(deviceList); while (!string.IsNullOrEmpty(curString)) { yield return(curString); deviceList += curString.Length + 1; curString = Marshal.PtrToStringAnsi(deviceList); } }
public IntPtr StartDeviceCapture(string name, int sampleRate, int bufSize) { IntPtr result = ALC11.alcCaptureOpenDevice( name, (uint)sampleRate, AL10.AL_FORMAT_MONO16, bufSize ); ALC11.alcCaptureStart(result); #if VERBOSE_AL_DEBUGGING if (CheckALCError()) { throw new InvalidOperationException("AL device error!"); } #endif return(result); }
public int CaptureSamples(IntPtr handle, IntPtr buffer, int count) { int[] samples = new int[1] { 0 }; ALC10.alcGetIntegerv( handle, ALC11.ALC_CAPTURE_SAMPLES, 1, samples ); samples[0] = Math.Min(samples[0], count / 2); if (samples[0] > 0) { ALC11.alcCaptureSamples(handle, buffer, samples[0]); } #if VERBOSE_AL_DEBUGGING if (CheckALCError()) { throw new InvalidOperationException("AL device error!"); } #endif return(samples[0] * 2); }