From f31e390adbc0ac361c8f3848ba17ec3e4b7e9625 Mon Sep 17 00:00:00 2001 From: Jeremy Pritts Date: Sat, 10 Sep 2022 13:28:21 -0400 Subject: [PATCH] Mark DirectSoundOut as Windows only and add a .NET 6 target --- NAudio.Core/NAudio.Core.csproj | 2 +- NAudio.Core/Wave/WaveOutputs/DirectSoundOut.cs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/NAudio.Core/NAudio.Core.csproj b/NAudio.Core/NAudio.Core.csproj index e122e9e9..c395552f 100644 --- a/NAudio.Core/NAudio.Core.csproj +++ b/NAudio.Core/NAudio.Core.csproj @@ -1,7 +1,7 @@  - netstandard2.0 + netstandard2.0;net6.0 Mark Heath 2.1.0 true diff --git a/NAudio.Core/Wave/WaveOutputs/DirectSoundOut.cs b/NAudio.Core/Wave/WaveOutputs/DirectSoundOut.cs index 0c14e3fa..0eec5000 100644 --- a/NAudio.Core/Wave/WaveOutputs/DirectSoundOut.cs +++ b/NAudio.Core/Wave/WaveOutputs/DirectSoundOut.cs @@ -12,6 +12,9 @@ namespace NAudio.Wave /// Contact author: Alexandre Mutel - alexandre_mutel at yahoo.fr /// Modified by: Graham "Gee" Plumb /// +#if NET5_0_OR_GREATER + [System.Runtime.Versioning.SupportedOSPlatform("windows")] +#endif public class DirectSoundOut : IWavePlayer { /// @@ -69,7 +72,7 @@ private static bool EnumCallback(IntPtr lpGuid, IntPtr lpcstrDescription, IntPtr device.Guid = new Guid(guidBytes); } device.Description = Marshal.PtrToStringAnsi(lpcstrDescription); - if (lpcstrModule != null) + if (lpcstrModule != IntPtr.Zero) { device.ModuleName = Marshal.PtrToStringAnsi(lpcstrModule); }