Skip to content

Commit

Permalink
[ISSUE-59] Windows 10 Mobile ole32.dll error when playing
Browse files Browse the repository at this point in the history
  • Loading branch information
kamenlitchev committed Dec 1, 2015
1 parent a996e1b commit 801c068
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 5 deletions.
12 changes: 12 additions & 0 deletions NAudio.Universal/CoreAudioApi/PropVariantNative.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using NAudio.CoreAudioApi.Interfaces;
using System.Runtime.InteropServices;

namespace NAudio.CoreAudioApi.Interfaces
{
class PropVariantNative
{
// Windows 10 requires api-ms-win-core-com-l1-1-1.dll
[DllImport("api-ms-win-core-com-l1-1-1.dll")]
internal static extern int PropVariantClear(ref PropVariant pvar);
}
}
1 change: 1 addition & 0 deletions NAudio.Universal/NAudio.Universal.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,7 @@
<Compile Include="..\NAudio\Wave\WaveStreams\WaveStream.cs">
<Link>Wave\WaveStreams\WaveStream.cs</Link>
</Compile>
<Compile Include="CoreAudioApi\PropVariantNative.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Wave\WaveOutputs\IWavePlayer.cs" />
</ItemGroup>
Expand Down
13 changes: 13 additions & 0 deletions NAudio.Win8/CoreAudioApi/PropVariantNative.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using NAudio.CoreAudioApi.Interfaces;
using System.Runtime.InteropServices;

namespace NAudio.CoreAudioApi.Interfaces
{
class PropVariantNative
{
// For Windows 8 we need to import api-ms-win-core-com-l1-1-0.dll, so we use this since we target 8.0
// TODO Windows 8.1 requires api-ms-win-core-com-l1-1-1.dll for PropVariantClear
[DllImport("api-ms-win-core-com-l1-1-0.dll")]
internal static extern int PropVariantClear(ref PropVariant pvar);
}
}
1 change: 1 addition & 0 deletions NAudio.Win8/NAudio.Win8.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,7 @@
<Compile Include="..\NAudio\Wave\WaveStreams\WaveStream.cs">
<Link>Wave\WaveStreams\WaveStream.cs</Link>
</Compile>
<Compile Include="CoreAudioApi\PropVariantNative.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Wave\WaveInputs\WasapiCaptureRT.cs" />
<Compile Include="Wave\WaveOutputs\IWavePlayer.cs" />
Expand Down
5 changes: 1 addition & 4 deletions NAudio/CoreAudioApi/PropVariant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,7 @@ public object Value
/// </summary>
public void Clear()
{
PropVariantClear(ref this);
PropVariantNative.PropVariantClear(ref this);
}

[DllImport("ole32.dll")]
private static extern int PropVariantClear(ref PropVariant pvar);
}
}
10 changes: 10 additions & 0 deletions NAudio/CoreAudioApi/PropVariantNative.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Runtime.InteropServices;

namespace NAudio.CoreAudioApi.Interfaces
{
class PropVariantNative
{
[DllImport("ole32.dll")]
internal static extern int PropVariantClear(ref PropVariant pvar);
}
}
1 change: 1 addition & 0 deletions NAudio/NAudio.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
<Compile Include="CoreAudioApi\Interfaces\ISimpleAudioVolume.cs" />
<Compile Include="CoreAudioApi\MMDeviceCollection.cs" />
<Compile Include="CoreAudioApi\PropertyKeys.cs" />
<Compile Include="CoreAudioApi\PropVariantNative.cs" />
<Compile Include="CoreAudioApi\SessionCollection.cs" />
<Compile Include="CoreAudioApi\SimpleAudioVolume.cs" />
<Compile Include="Dsp\EnvelopeGenerator.cs" />
Expand Down
2 changes: 1 addition & 1 deletion NAudioUniversalDemo/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</Properties>

<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.10166.0" MaxVersionTested="10.0.10166.0" />
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.10166.0" MaxVersionTested="10.0.10586.0" />
</Dependencies>

<Resources>
Expand Down

0 comments on commit 801c068

Please sign in to comment.