Exemple #1
0
        public static List <string> GetWaveInDeviceNames()
        {
            uint num = Win32.waveInGetNumDevs();

            List <string> names = new List <string>();

            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)
                {
                    names.Add(caps.szPname);
                }
            }
            return(names);
        }
Exemple #2
0
        public static int GetWaveInDeviceIdByName(string deviceName)
        {
            uint num = Win32.waveInGetNumDevs();

            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 == deviceName)
                    {
                        return(i);
                    }
                }
            }
            return(Win32.WAVE_MAPPER);
        }