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); }
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); }
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; }
/// <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; }
public DeviceModel(DirectSoundDeviceInfo device) { DirectSoundDeviceInfo = device; Provider = DeviceProvider.DirectSound; }
public OutputDeviceModel(DirectSoundDeviceInfo device) : base(device) { }