public static IEnumerable <CaptureDevice> GetCaptureDevices(out CaptureDevice defaultDevice) { //if (!IsCaptureSupported) // throw new NotSupportedException(); OpenAL.Debug("Getting capture devices"); defaultDevice = null; string defaultName = Marshal.PtrToStringAnsi(alcGetString(IntPtr.Zero, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER)); var strings = ReadStringsFromMemory(alcGetString(IntPtr.Zero, ALC_CAPTURE_DEVICE_SPECIFIER)); CaptureDevice[] devices = new CaptureDevice[strings.Length]; for (int i = 0; i < strings.Length; ++i) { string s = strings[i]; devices[i] = new CaptureDevice(s); if (s == defaultName) { defaultDevice = devices[i]; } OpenAL.DebugFormat("Found capture device {0}{1}", s, (s == defaultName) ? " (Default)" : String.Empty); } return(devices); }
public static IEnumerable <PlaybackDevice> GetPlaybackDevices(out PlaybackDevice defaultDevice) { defaultDevice = null; OpenAL.Debug("Getting playback devices"); string defaultName = null; string[] strings = new string[0]; if (GetIsExtensionPresent("ALC_ENUMERATE_ALL_EXT")) { defaultName = Marshal.PtrToStringAnsi(alcGetString(IntPtr.Zero, ALC_DEFAULT_ALL_DEVICES_SPECIFIER)); strings = ReadStringsFromMemory(alcGetString(IntPtr.Zero, ALC_ALL_DEVICES_SPECIFIER)); } else if (GetIsExtensionPresent("ALC_ENUMERATION_EXT")) { defaultName = Marshal.PtrToStringAnsi(alcGetString(IntPtr.Zero, ALC_DEFAULT_DEVICE_SPECIFIER)); strings = ReadStringsFromMemory(alcGetString(IntPtr.Zero, ALC_DEVICE_SPECIFIER)); } PlaybackDevice[] devices = new PlaybackDevice[strings.Length]; for (int i = 0; i < strings.Length; ++i) { string s = strings[i]; devices[i] = new PlaybackDevice(s); if (s == defaultName) { defaultDevice = devices[i]; } OpenAL.DebugFormat("Found playback device {0}{1}", s, (s == defaultName) ? " (Default)" : String.Empty); } return(devices); }