public static WaveInCaps[] GetCaps() { uint count = (uint)MMInterops.waveInGetNumDevs(); WaveInCaps[] caps = new WaveInCaps[count]; for (uint i = 0; i < count; i++) { WaveInCaps c; var result = MMInterops.waveInGetDevCaps(i, out c, (uint)Marshal.SizeOf(typeof(WaveInCaps))); MmException.Try(result, "waveInGetDevCaps"); caps[i] = c; } return caps; }
/// <summary> /// Initializes a new instance of the <see cref="WaveInDevice"/> class. /// </summary> /// <param name="deviceId">The device identifier.</param> public WaveInDevice(int deviceId) { var caps = new WaveInCaps(); MmException.Try( NativeMethods.waveInGetDevCaps((IntPtr) deviceId, out caps, (uint) Marshal.SizeOf(caps)), "waveInGetDevCaps"); DeviceId = deviceId; Name = caps.Name; DriverVersion = new Version(caps.DriverVersion.HighWord(), caps.DriverVersion.LowWord()); SupportedFormatsFlags = caps.Formats; SupportedFormats = caps.GetSupportedFormats(); }
/// <summary> /// Initializes a new instance of the <see cref="WaveInDevice"/> class. /// </summary> /// <param name="deviceId">The device identifier.</param> public WaveInDevice(int deviceId) { var caps = new WaveInCaps(); MmException.Try( NativeMethods.waveInGetDevCaps((IntPtr)deviceId, out caps, (uint)Marshal.SizeOf(caps)), "waveInGetDevCaps"); DeviceId = deviceId; Name = caps.Name; DriverVersion = new Version(caps.DriverVersion.HighWord(), caps.DriverVersion.LowWord()); SupportedFormatsFlags = caps.Formats; SupportedFormats = caps.GetSupportedFormats(); }
public static WaveInCaps[] GetCaps() { uint count = (uint)MMInterops.waveInGetNumDevs(); WaveInCaps[] caps = new WaveInCaps[count]; for (uint i = 0; i < count; i++) { WaveInCaps c; var result = MMInterops.waveInGetDevCaps(i, out c, (uint)Marshal.SizeOf(typeof(WaveInCaps))); MmException.Try(result, "waveInGetDevCaps"); caps[i] = c; } return(caps); }
private void deviceslist_SelectedIndexChanged(object sender, EventArgs e) { if (deviceslist.SelectedItems.Count > 0) { _selectedDevice = (WaveInCaps)deviceslist.SelectedItems[0].Tag; btnStart.Enabled = true; } else { btnStart.Enabled = false; } }