Skip to content

Commit 17079c0

Browse files
committed
Mark DirectSoundOut as Windows-only
1 parent c455f89 commit 17079c0

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

NAudio.Core/NAudio.Core.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
5+
<LangVersion>Latest</LangVersion>
56
<Authors>Mark Heath</Authors>
67
<Version>2.2.0</Version>
78
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
@@ -15,6 +16,7 @@
1516
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1617
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1718
<PackageIcon>naudio-icon.png</PackageIcon>
19+
<PolySharpIncludeRuntimeSupportedAttributes>true</PolySharpIncludeRuntimeSupportedAttributes>
1820
</PropertyGroup>
1921

2022
<ItemGroup>
@@ -24,5 +26,12 @@
2426
</None>
2527
</ItemGroup>
2628

29+
<ItemGroup>
30+
<PackageReference Include="PolySharp" Version="1.13.2">
31+
<PrivateAssets>all</PrivateAssets>
32+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
33+
</PackageReference>
34+
</ItemGroup>
35+
2736

2837
</Project>

NAudio.Core/Wave/WaveOutputs/DirectSoundOut.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ namespace NAudio.Wave
1212
/// Contact author: Alexandre Mutel - alexandre_mutel at yahoo.fr
1313
/// Modified by: Graham "Gee" Plumb
1414
/// </summary>
15+
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
1516
public class DirectSoundOut : IWavePlayer
1617
{
1718
/// <summary>
@@ -69,7 +70,7 @@ private static bool EnumCallback(IntPtr lpGuid, IntPtr lpcstrDescription, IntPtr
6970
device.Guid = new Guid(guidBytes);
7071
}
7172
device.Description = Marshal.PtrToStringAnsi(lpcstrDescription);
72-
if (lpcstrModule != null)
73+
if (lpcstrModule != IntPtr.Zero)
7374
{
7475
device.ModuleName = Marshal.PtrToStringAnsi(lpcstrModule);
7576
}

0 commit comments

Comments
 (0)