/// <summary> /// GetWaveOutDeviceIdByName /// </summary> /// <param name="name"></param> /// <returns></returns> public static List <string> GetWaveOutDeviceNames() { uint num = Win32.waveOutGetNumDevs(); List <string> names = new List <string>(); Win32.WAVEOUTCAPS caps = new Win32.WAVEOUTCAPS(); for (int i = 0; i < num; i++) { Win32.HRESULT hr = (Win32.HRESULT)Win32.waveOutGetDevCaps(i, ref caps, Marshal.SizeOf(typeof(Win32.WAVEOUTCAPS))); if (hr == Win32.HRESULT.S_OK) { names.Add(caps.szPname); } } return(names); }
/// <summary> /// GetWaveOutDeviceIdByName /// </summary> /// <param name="name"></param> /// <returns></returns> public static int GetWaveOutDeviceIdByName(string name) { uint num = Win32.waveOutGetNumDevs(); Win32.WAVEOUTCAPS caps = new Win32.WAVEOUTCAPS(); for (int i = 0; i < num; i++) { Win32.HRESULT hr = (Win32.HRESULT)Win32.waveOutGetDevCaps(i, ref caps, Marshal.SizeOf(typeof(Win32.WAVEOUTCAPS))); if (hr == Win32.HRESULT.S_OK) { if (caps.szPname == name) { return(i); } } } return(Win32.WAVE_MAPPER); }
/// <summary> /// GetWaveInDeviceIdByName /// </summary> /// <param name="name"></param> /// <returns></returns> public static int GetWaveInDeviceIdByName(string name) { //Anzahl Devices uint num = Win32.waveInGetNumDevs(); //WaveIn Struktur Win32.WAVEINCAPS caps = new Win32.WAVEINCAPS(); for (int i = 0; i < num; i++) { Win32.HRESULT hr = (Win32.HRESULT)Win32.waveInGetDevCaps(i, ref caps, Marshal.SizeOf(typeof(Win32.WAVEINCAPS))); if (hr == Win32.HRESULT.S_OK) { if (caps.szPname == name) { //Gefunden return(i); } } } //Nicht gefunden return(Win32.WAVE_MAPPER); }