Class for enumerating DirectSound devices
Example #1
0
        private static bool EnumCallback(IntPtr lpGuid, IntPtr lpcstrDescription, IntPtr lpcstrModule, IntPtr lpContext)
        {
            DirectSoundDeviceInfo directSoundDeviceInfo = new DirectSoundDeviceInfo();

            if (lpGuid == IntPtr.Zero)
            {
                directSoundDeviceInfo.Guid = Guid.Empty;
            }
            else
            {
                byte[] array = new byte[16];
                Marshal.Copy(lpGuid, array, 0, 16);
                directSoundDeviceInfo.Guid = new Guid(array);
            }
            directSoundDeviceInfo.Description = Marshal.PtrToStringAnsi(lpcstrDescription);
            directSoundDeviceInfo.ModuleName  = Marshal.PtrToStringAnsi(lpcstrModule);
            DirectSoundOut.devices.Add(directSoundDeviceInfo);
            return(true);
        }
Example #2
0
        private static bool EnumCallback(IntPtr lpGuid, IntPtr lpcstrDescription, IntPtr lpcstrModule, IntPtr lpContext)
        {
            var device = new DirectSoundDeviceInfo();

            if (lpGuid == IntPtr.Zero)
            {
                device.Guid = Guid.Empty;
            }
            else
            {
                byte[] guidBytes = new byte[16];
                Marshal.Copy(lpGuid, guidBytes, 0, 16);
                device.Guid = new Guid(guidBytes);
            }
            device.Description = Marshal.PtrToStringAnsi(lpcstrDescription);
            device.ModuleName  = Marshal.PtrToStringAnsi(lpcstrModule);
            devices.Add(device);
            return(true);
        }
Example #3
0
 private static bool EnumCallback(IntPtr lpGuid, IntPtr lpcstrDescription, IntPtr lpcstrModule, IntPtr lpContext)
 {
     var device = new DirectSoundDeviceInfo();
     if (lpGuid == IntPtr.Zero)
     {
         device.Guid = Guid.Empty;
     }
     else
     {
         byte[] guidBytes = new byte[16];
         Marshal.Copy(lpGuid, guidBytes, 0, 16);
         device.Guid = new Guid(guidBytes);
     }
     device.Description =  Marshal.PtrToStringAnsi(lpcstrDescription);
     if (lpcstrModule != null)
     {
         device.ModuleName = Marshal.PtrToStringAnsi(lpcstrModule);
     }
     devices.Add(device);
     return true;
 }
Example #4
0
 /// <summary>
 /// DirectSoundデバイス情報
 /// </summary>
 /// <param name="deviceInfo">デバイス情報</param>
 public DirectSoundDeviceInfo(NAudio.Wave.DirectSoundDeviceInfo deviceInfo)
 {
     this.Guid            = deviceInfo.Guid;
     this.IsSystemDefault = (this.Guid == default);
     this.Name            = this.IsSystemDefault ? "システム規定" : deviceInfo.Description;
 }
Example #5
0
 public DeviceModel(DirectSoundDeviceInfo device)
 {
     DirectSoundDeviceInfo = device;
     Provider = DeviceProvider.DirectSound;
 }
Example #6
0
 public OutputDeviceModel(DirectSoundDeviceInfo device)
     : base(device)
 {
 }