From 17079c09c186a91b5c089e1e6e5a927cd2c39f35 Mon Sep 17 00:00:00 2001
From: Jeremy Pritts <49847914+ds5678@users.noreply.github.com>
Date: Sun, 3 Sep 2023 21:28:09 -0400
Subject: [PATCH] Mark DirectSoundOut as Windows-only
---
NAudio.Core/NAudio.Core.csproj | 9 +++++++++
NAudio.Core/Wave/WaveOutputs/DirectSoundOut.cs | 3 ++-
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/NAudio.Core/NAudio.Core.csproj b/NAudio.Core/NAudio.Core.csproj
index 016fef7b..44439d24 100644
--- a/NAudio.Core/NAudio.Core.csproj
+++ b/NAudio.Core/NAudio.Core.csproj
@@ -2,6 +2,7 @@
netstandard2.0
+ Latest
Mark Heath
2.2.0
true
@@ -15,6 +16,7 @@
true
MIT
naudio-icon.png
+ true
@@ -24,5 +26,12 @@
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
diff --git a/NAudio.Core/Wave/WaveOutputs/DirectSoundOut.cs b/NAudio.Core/Wave/WaveOutputs/DirectSoundOut.cs
index 0c14e3fa..eaea9606 100644
--- a/NAudio.Core/Wave/WaveOutputs/DirectSoundOut.cs
+++ b/NAudio.Core/Wave/WaveOutputs/DirectSoundOut.cs
@@ -12,6 +12,7 @@ namespace NAudio.Wave
/// Contact author: Alexandre Mutel - alexandre_mutel at yahoo.fr
/// Modified by: Graham "Gee" Plumb
///
+ [System.Runtime.Versioning.SupportedOSPlatform("windows")]
public class DirectSoundOut : IWavePlayer
{
///
@@ -69,7 +70,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);
}