Skip to content

Commit

Permalink
Mark DirectSoundOut as Windows-only
Browse files Browse the repository at this point in the history
  • Loading branch information
ds5678 committed Sep 4, 2023
1 parent c455f89 commit 17079c0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 9 additions & 0 deletions NAudio.Core/NAudio.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>Latest</LangVersion>
<Authors>Mark Heath</Authors>
<Version>2.2.0</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
Expand All @@ -15,6 +16,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>naudio-icon.png</PackageIcon>
<PolySharpIncludeRuntimeSupportedAttributes>true</PolySharpIncludeRuntimeSupportedAttributes>
</PropertyGroup>

<ItemGroup>
Expand All @@ -24,5 +26,12 @@
</None>
</ItemGroup>

<ItemGroup>
<PackageReference Include="PolySharp" Version="1.13.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>


</Project>
3 changes: 2 additions & 1 deletion NAudio.Core/Wave/WaveOutputs/DirectSoundOut.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace NAudio.Wave
/// Contact author: Alexandre Mutel - alexandre_mutel at yahoo.fr
/// Modified by: Graham "Gee" Plumb
/// </summary>
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public class DirectSoundOut : IWavePlayer
{
/// <summary>
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 17079c0

Please sign in to comment.