コード例 #1
0
        public IEnumerable <DeviceInfo> EnumerateDevices()
        {
            if (mode == Mode.Record)
            {
                uint count = waveInGetNumDevs();

                for (uint i = 0; i < count; ++i)
                {
                    WAVEINCAPS caps = new WAVEINCAPS();
                    if (waveInGetDevCaps(i, ref caps, 48) == 0)
                    {
                        yield return(new DeviceInfo()
                        {
                            index = (int)i, name = caps.szPname
                        });
                    }
                }
            }
            else if (mode == Mode.Play)
            {
                uint count = waveOutGetNumDevs();

                for (uint i = 0; i < count; ++i)
                {
                    WAVEOUTCAPS caps = new WAVEOUTCAPS();
                    if (waveOutGetDevCaps(i, ref caps, 48) == 0)
                    {
                        yield return(new DeviceInfo()
                        {
                            index = (int)i, name = caps.szPname
                        });
                    }
                }
            }
        }
コード例 #2
0
ファイル: coredll.cs プロジェクト: AMV007/Common_CSharp
        public static WAVEOUTCAPS WaveOutGetDevCaps(uint DeviceID)
        {
            WAVEOUTCAPS Caps = new WAVEOUTCAPS();

            waveOutGetDevCaps(DeviceID, ref Caps, (uint)Marshal.SizeOf(Caps));
            return(Caps);
        }
コード例 #3
0
ファイル: WaveOut.cs プロジェクト: avogelba/PWR
        /// <summary>Get the output device name from device id</summary>
        /// <param name="deviceId">device id</param>
        /// <param name="prodName">returns device name</param>
        /// <returns>MMSYSERR</returns>
        public MMSYSERR GetOutputDeviceName(uint deviceId, ref string prodName)
        {
            WAVEOUTCAPS caps   = new WAVEOUTCAPS();
            MMSYSERR    result = waveOutGetDevCaps(deviceId, out caps, (uint)Marshal.SizeOf(caps));

            if (result != MMSYSERR.NOERROR)
            {
                return(result);
            }
            //WAVEOUTCAPS2 often does not return product name GUID, as it is not
            //a required field, so is most often left blank..
            //The only way to get full string in vista/w7 that I have come across is
            //by enumerating devices with directsound, but that would mean referencing
            //the library, so.. deal with it
            prodName = new string(caps.szPname);
            if (prodName.Contains("(") && !(prodName.Contains(")")))
            {
                prodName = prodName.Substring(0, prodName.IndexOf("("));
            }
            else if (prodName.Contains(")"))
            {
                if (prodName.IndexOf(")") > 8)
                {
                    prodName = prodName.Substring(0, prodName.IndexOf(")") + 1);
                }
            }
            return(MMSYSERR.NOERROR);
        }
コード例 #4
0
 public Native(WAVEOUTCAPS managed)
 {
     wMid           = managed.wMid;
     wPid           = managed.wPid;
     vDriverVersion = managed.vDriverVersion;
     managed.szPname.CopyTo(MemoryMarshal.CreateSpan(ref szPname[0], szPnameLength));
     dwFormats  = managed.dwFormats;
     wChannels  = managed.wChannels;
     wReserved1 = managed.wReserved1;
     dwSupport  = managed.dwSupport;
 }
コード例 #5
0
        public WaveOutDeviceCapabilities(int device)
        {
            this._Capabilities = new WAVEOUTCAPS();

            int result = waveOutGetDevCaps(device, this._Capabilities, Marshal.SizeOf(this._Capabilities));

            if (result != WaveError.MMSYSERR_NOERROR)
            {
                throw new SoundCoreException(WaveError.GetMessage(result), result);
            }
        }
コード例 #6
0
            internal static WAVEOUTCAPS?GetPlaybackDeviceCapabilities(uint device)
            {
                WAVEOUTCAPS caps     = new WAVEOUTCAPS();
                UIntPtr     deviceID = new UIntPtr(device);

                if (waveOutGetDevCaps(deviceID, out caps, (uint)Marshal.SizeOf(caps)) != 0)
                {
                    return(null);
                }

                return(caps);
            }
コード例 #7
0
ファイル: Win32.cs プロジェクト: BenGlasser/AudioSlut
        public static string[] GetSoundDevices()
        {
            uint devices = waveOutGetNumDevs();
            string[] result = new string[devices];
            WAVEOUTCAPS caps = new WAVEOUTCAPS();

            for (uint i = 0; i < devices; i++)
            {
                waveOutGetDevCaps(i, ref caps, (uint)Marshal.SizeOf(caps));
                result[i] = caps.szPname;
            }
            return result;
        }
コード例 #8
0
        public static string[] GetSoundDevices()
        {
            uint devices = waveOutGetNumDevs();

            string[]    result = new string[devices];
            WAVEOUTCAPS caps   = new WAVEOUTCAPS();

            for (uint i = 0; i < devices; i++)
            {
                waveOutGetDevCaps(i, ref caps, (uint)Marshal.SizeOf(caps));
                result[i] = caps.szPname;
            }
            return(result);
        }
コード例 #9
0
        /// <summary>
        /// Get the name of the specified playback device.
        /// </summary>
        /// <param name="deviceId">ID of the device</param>
        /// <param name="prodName">Destination string assigned the name</param>
        /// <returns>MMSYSERR.NOERROR if successful</returns>
        public Wave.MMSYSERR GetDeviceName(uint deviceId, ref string prodName)
        {
            WAVEOUTCAPS caps = new WAVEOUTCAPS();

            Wave.MMSYSERR result = waveOutGetDevCaps(deviceId, caps, caps.Size);
            if (result != Wave.MMSYSERR.NOERROR)
            {
                return(result);
            }

            prodName = caps.szPname;

            return(Wave.MMSYSERR.NOERROR);
        }
コード例 #10
0
                public Native(WAVEOUTCAPS managed)
                {
                    wMid           = managed.wMid;
                    wPid           = managed.wPid;
                    vDriverVersion = managed.vDriverVersion;
                    fixed(char *pszPname = szPname)
                    {
                        managed.szPname.AsSpan().CopyTo(new Span <char>(pszPname, szPnameLength));
                    }

                    dwFormats  = managed.dwFormats;
                    wChannels  = managed.wChannels;
                    wReserved1 = managed.wReserved1;
                    dwSupport  = managed.dwSupport;
                }
コード例 #11
0
ファイル: WaveOut.cs プロジェクト: otac0n/winmm
        /// <summary>
        /// Retrieves the capabilities of a device.
        /// </summary>
        /// <param name="deviceId">The DeviceID for which to retrieve the capabilities.</param>
        /// <returns>The capabilities of the device.</returns>
        private static WaveOutDeviceCaps GetDeviceCaps(int deviceId)
        {
            WAVEOUTCAPS wocaps = new WAVEOUTCAPS();

            NativeMethods.waveOutGetDevCaps(new IntPtr(deviceId), ref wocaps, Marshal.SizeOf(wocaps.GetType()));
            WaveOutDeviceCaps caps = new WaveOutDeviceCaps();

            caps.DeviceId      = (int)deviceId;
            caps.Channels      = wocaps.wChannels;
            caps.DriverVersion = (int)wocaps.vDriverVersion;
            caps.Manufacturer  = GetManufacturer(wocaps.wMid);
            caps.Name          = wocaps.szPname;
            caps.ProductId     = wocaps.wPid;
            caps.Capabilities  = wocaps.dwSupport;

            return(caps);
        }
コード例 #12
0
ファイル: WaveNative.cs プロジェクト: wxsh/axStream
        public static List <string> EnumOutputDevices()
        {
            List <string> OutputDeviceNames   = new List <string>();
            int           waveOutDevicesCount = waveOutGetNumDevs(); //get total

            if (waveOutDevicesCount > 0)
            {
                for (int uDeviceID = 0; uDeviceID < waveOutDevicesCount; uDeviceID++)
                {
                    WAVEOUTCAPS waveOutCaps = new WAVEOUTCAPS();
                    waveOutGetDevCaps(uDeviceID, ref waveOutCaps, Marshal.SizeOf(typeof(WAVEOUTCAPS)));
                    string devnameandid = "Device ID " + uDeviceID + ": " + waveOutCaps.szPname;
                    OutputDeviceNames.Add(devnameandid.Trim());
                }
            }
            return(OutputDeviceNames);
        }
コード例 #13
0
        /// <summary>
        /// Gets the dev caps playback.
        /// </summary>
        /// <returns></returns>
        public static WAVEOUTCAPS[] GetDevCapsPlayback()
        {
            var waveOutDevicesCount = waveOutGetNumDevs();

            if (waveOutDevicesCount > 0)
            {
                var list = new WAVEOUTCAPS[waveOutDevicesCount];
                for (var uDeviceID = 0; uDeviceID < waveOutDevicesCount; uDeviceID++)
                {
                    var waveOutCaps = new WAVEOUTCAPS();
                    waveOutGetDevCaps(uDeviceID, ref waveOutCaps, Marshal.SizeOf(typeof(WAVEOUTCAPS)));
                    list[uDeviceID] = waveOutCaps;
                }
                return(list);
            }
            else
            {
                return(null);
            }
        }
コード例 #14
0
ファイル: Program.cs プロジェクト: desla/AS
        static void Main(string[] args)
        {
            var deviceCount = waveOutGetNumDevs();
            Console.WriteLine("Найдено {0} устаройств вывода: ", deviceCount);
            for (var i = 0; i < deviceCount; ++i) {
                var wOutCaps = new WAVEOUTCAPS();
                waveOutGetDevCaps(new UIntPtr((uint)i), ref wOutCaps, (uint)Marshal.SizeOf(typeof(WAVEOUTCAPS)));
                Console.WriteLine("Имя:\"{0}\" Каналов:{1}", wOutCaps.SzPname, wOutCaps.WChannels);
            }

            Console.WriteLine();

            deviceCount = waveInGetNumDevs();
            Console.WriteLine("Найдено {0} устаройств ввода: ", deviceCount);
            for (var i = 0; i < deviceCount; ++i) {
                var wInCaps = new WAVEINCAPS();
                waveInGetDevCaps(new UIntPtr((uint)i), ref wInCaps, (uint)Marshal.SizeOf(typeof(WAVEOUTCAPS)));
                Console.WriteLine("Имя:\"{0}\" Каналов:{1}", wInCaps.SzPname, wInCaps.WChannels);
            }

            Console.WriteLine("\nДля выхода нажмите Enter.");
            Console.ReadLine();
        }
コード例 #15
0
ファイル: Program.cs プロジェクト: desla/AS
 public static extern uint waveOutGetDevCaps(UIntPtr hWaveOut, ref WAVEOUTCAPS pwoc, uint cbwoc);
コード例 #16
0
ファイル: coredll.cs プロジェクト: AMV007/Common_CSharp
 public static extern uint waveOutGetDevCaps(uint DeviceID, ref WAVEOUTCAPS pwoc, uint cbwoc);
コード例 #17
0
 public static extern int waveOutGetDevCaps(IntPtr hwo, ref WAVEOUTCAPS pwoc, uint cbwoc);
コード例 #18
0
ファイル: WaveOut.cs プロジェクト: jithuin/infogeezer
		/// <summary>
		/// Get the name of the specified playback device.
		/// </summary>
		/// <param name="deviceId">ID of the device</param>
		/// <param name="prodName">Destination string assigned the name</param>
		/// <returns>MMSYSERR.NOERROR if successful</returns>
		public Wave.MMSYSERR GetDeviceName(uint deviceId, ref string prodName)
		{
			WAVEOUTCAPS caps = new WAVEOUTCAPS();
			Wave.MMSYSERR result = waveOutGetDevCaps(deviceId, caps, caps.Size);
			if (result != Wave.MMSYSERR.NOERROR)
				return result;

			prodName = caps.szPname;

			return Wave.MMSYSERR.NOERROR;
		}
コード例 #19
0
ファイル: _WaveIn.cs プロジェクト: pikoslav/Lumisoft.Net
 private static extern uint waveInGetDevCaps(uint hwo, ref WAVEOUTCAPS pwoc, int cbwoc);
コード例 #20
0
ファイル: AudioOut.cs プロジェクト: cheehwasun/ourmsg
 public static extern uint waveOutGetDevCaps(uint hwo,ref WAVEOUTCAPS pwoc,int cbwoc);
コード例 #21
0
ファイル: AudioIn.cs プロジェクト: dioptre/nkd
 private static extern uint waveInGetDevCaps(uint hwo,ref WAVEOUTCAPS pwoc,int cbwoc);
コード例 #22
0
ファイル: WinMM_WaveOut.cs プロジェクト: Wiladams/NewTOAPIA
 public static extern MMSYSERROR waveOutGetDevCaps(IntPtr uDeviceID, ref WAVEOUTCAPS pwoc,  int cbwoc);
コード例 #23
0
 public static extern int waveOutGetDevCaps(IntPtr uDeviceID, out WAVEOUTCAPS pwoc, int cbwoc);
コード例 #24
0
ファイル: WaveOut.cs プロジェクト: avogelba/PWR
 private static extern MMSYSERR waveOutGetDevCaps(uint uDeviceID, out WAVEOUTCAPS pwoc, uint cbwoc);
コード例 #25
0
 public static Native ConvertToUnmanaged(WAVEOUTCAPS managed) => new(managed);
コード例 #26
0
ファイル: WaveNative.cs プロジェクト: llytvynenko/axStream
 public static extern uint waveOutGetDevCaps(int uDeviceID, ref WAVEOUTCAPS pwoc, int cbwoc);
コード例 #27
0
        public static AudioCapabilities CreateForOutput(WAVEOUTCAPS caps)
        {
            AudioCapabilities aud = new AudioCapabilities(true, (short)caps.wMid, (short)caps.wPid, (short)caps.vDriverVersion, caps.szPname, (int)caps.dwFormats, (short)caps.wChannels, (int)caps.dwSupport);

            return aud;
        }
コード例 #28
0
 private static extern int waveOutGetDevCaps(int device, WAVEOUTCAPS caps, int size);
コード例 #29
0
 private static extern uint waveOutGetDevCaps(int hwo, ref WAVEOUTCAPS pwoc, /*uint*/ int cbwoc);
コード例 #30
0
 static extern int waveOutGetDevCaps(UIntPtr uDeviceID, out WAVEOUTCAPS waveOutCaps, uint sizeOfwaveOutCaps);
コード例 #31
0
ファイル: WaveOutputPort.cs プロジェクト: Wiladams/NewTOAPIA
        public static WAVEOUTCAPS[] GetWaveOutCapabilities()
        {
            int numDevices = GetNumberOfWaveOutDevices();
            WAVEOUTCAPS[] caps = new WAVEOUTCAPS[numDevices];

            for (int i = 0; i < numDevices; i++)
            {
                WAVEOUTCAPS newCaps = new WAVEOUTCAPS();
                IntPtr devID = new IntPtr(i);

                winmm.waveOutGetDevCaps(devID, ref newCaps, Marshal.SizeOf(newCaps));

                caps[i] = newCaps;
            }

            return caps;
        }
コード例 #32
0
 private static extern uint waveOutGetDevCaps(uint uDeviceID, ref WAVEOUTCAPS pwic, uint cbwic);
コード例 #33
0
 public static extern uint waveOutGetDevCaps(int index, ref WAVEOUTCAPS pwoc, int cbwoc);
コード例 #34
0
 internal static extern MMSYSERR waveOutGetDevCaps(IntPtr uDeviceID, ref WAVEOUTCAPS caps, int cbwoc);
コード例 #35
0
ファイル: WaveNative.cs プロジェクト: llytvynenko/axStream
 public static List<string> EnumOutputDevices()
 {
     List<string> OutputDeviceNames = new List<string>();
     int waveOutDevicesCount = waveOutGetNumDevs(); //get total
     if (waveOutDevicesCount > 0)
     {
         for (int uDeviceID = 0; uDeviceID < waveOutDevicesCount; uDeviceID++)
         {
             WAVEOUTCAPS waveOutCaps = new WAVEOUTCAPS();
             waveOutGetDevCaps(uDeviceID, ref waveOutCaps, Marshal.SizeOf(typeof(WAVEOUTCAPS)));
             string devnameandid = "Device ID " + uDeviceID + ": " + waveOutCaps.szPname;
             OutputDeviceNames.Add(devnameandid.Trim());
         }
     }
     return OutputDeviceNames;
 }