using System;
using System.Runtime.InteropServices;
using Microsoft.Win32;
namespace NAudio.Wave
{
///
/// WaveInCapabilities structure (based on WAVEINCAPS2 from mmsystem.h)
/// http://msdn.microsoft.com/en-us/library/ms713726(VS.85).aspx
///
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct WaveInCapabilities
{
///
/// wMid
///
private short manufacturerId;
///
/// wPid
///
private short productId;
///
/// vDriverVersion
///
private int driverVersion;
///
/// Product Name (szPname)
///
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = MaxProductNameLength)]
private string productName;
///
/// Supported formats (bit flags) dwFormats
///
private SupportedWaveFormat supportedFormats;
///
/// Supported channels (1 for mono 2 for stereo) (wChannels)
/// Seems to be set to -1 on a lot of devices
///
private short channels;
///
/// wReserved1
///
private short reserved;
// extra WAVEINCAPS2 members
private Guid manufacturerGuid;
private Guid productGuid;
private Guid nameGuid;
private const int MaxProductNameLength = 32;
///
/// Number of channels supported
///
public int Channels
{
get
{
return channels;
}
}
///
/// The product name
///
public string ProductName
{
get
{
return productName;
}
}
///
/// The device name Guid (if provided)
///
public Guid NameGuid { get { return nameGuid; } }
///
/// The product name Guid (if provided)
///
public Guid ProductGuid { get { return productGuid; } }
///
/// The manufacturer guid (if provided)
///
public Guid ManufacturerGuid { get { return manufacturerGuid; } }
///
/// Checks to see if a given SupportedWaveFormat is supported
///
/// The SupportedWaveFormat
/// true if supported
public bool SupportsWaveFormat(SupportedWaveFormat waveFormat)
{
return (supportedFormats & waveFormat) == waveFormat;
}
}
internal static class WaveCapabilitiesHelpers
{
public static readonly Guid MicrosoftDefaultManufacturerId = new Guid("d5a47fa8-6d98-11d1-a21a-00a0c9223196");
public static readonly Guid DefaultWaveOutGuid = new Guid("E36DC310-6D9A-11D1-A21A-00A0C9223196");
public static readonly Guid DefaultWaveInGuid = new Guid("E36DC311-6D9A-11D1-A21A-00A0C9223196");
}
}