Exemple #1
0
        /// <summary>
        ///     Alle Aufnahmegeräte anzeigen
        /// </summary>
        /// <returns></returns>
        public static List <string> GetRecordingNames()
        {
            //Ergebnis
            var list      = new List <string>();
            var waveInCap = new Win32.WAVEINCAPS();

            //Anzahl Devices
            var num = Win32.waveInGetNumDevs();

            for (var i = 0; i < num; i++)
            {
                var hr = Win32.waveInGetDevCaps(i, ref waveInCap, Marshal.SizeOf(typeof(Win32.WAVEINCAPS)));
                if (hr == (int)Win32.HRESULT.S_OK)
                {
                    list.Add(waveInCap.szPname);
                }
            }

            //Fertig
            return(list);
        }
Exemple #2
0
        /// <summary>
        ///     GetWaveInDeviceIdByName
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static int GetWaveInDeviceIdByName(string name)
        {
            //Anzahl Devices
            var num = Win32.waveInGetNumDevs();

            //WaveIn Struktur
            var caps = new Win32.WAVEINCAPS();

            for (var i = 0; i < num; i++)
            {
                var hr = (Win32.HRESULT)Win32.waveInGetDevCaps(i, ref caps, Marshal.SizeOf(typeof(Win32.WAVEINCAPS)));
                if (hr == Win32.HRESULT.S_OK)
                {
                    if (caps.szPname == name)
                    {
                        return(i);
                    }
                }
            }

            //Nicht gefunden
            return(Win32.WAVE_MAPPER);
        }