naudio / NAudio

Audio and MIDI library for .NET
MIT License
5.52k stars 1.1k forks source link

UWP - NAudio dont works with Native tool chain #248

Open Riccsson opened 7 years ago

Riccsson commented 7 years ago

Visual studio 2017, NAudio 1.8.3 for UWP. When enabled Native tool chain and started the demo sample and clicked play:

Output log: Exception thrown: 'System.PlatformNotSupportedException' in System.Private.Interop.dll An exception of type 'System.PlatformNotSupportedException' occurred in System.Private.Interop.dll but was not handled in user code Operation is not supported on this platform.

Callstack: at System.Runtime.InteropServices.Marshal.GetExceptionForHR(Int32 errorCode, IntPtr errorInfo) in f:\dd\ndp\fxcore\CoreRT\src\System.Private.Interop\src\System\Runtime\InteropServices\Marshal.cs:line 613 at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) in f:\dd\ndp\fxcore\CoreRT\src\System.Private.Interop\src\System\Runtime\InteropServices\Marshal.cs:line 643 at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode) in f:\dd\ndp\fxcore\CoreRT\src\System.Private.Interop\src\System\Runtime\InteropServices\Marshal.cs:line 631 at NAudio.CoreAudioApi.AudioClient.Initialize(AudioClientShareMode shareMode, AudioClientStreamFlags streamFlags, Int64 bufferDuration, Int64 periodicity, WaveFormat waveFormat, Guid audioSessionGuid) in C:\Repositories\Zquence Studio 2016\Zquence Studio 3\Vendors\Win10\NAudio-master\NAudio\CoreAudioApi\AudioClient.cs:line 65 at NAudio.Win8.Wave.WaveOutputs.WasapiOutRT.Init() in C:\Repositories\Zquence Studio 2016\Zquence Studio 3\Vendors\Win10\NAudio-master\NAudio.Win8\Wave\WaveOutputs\WasapiOutRT.cs:line 413 at NAudio.Win8.Wave.WaveOutputs.WasapiOutRT.d__25.MoveNext() in C:\Repositories\Zquence Studio 2016\Zquence Studio 3\Vendors\Win10\NAudio-master\NAudio.Win8\Wave\WaveOutputs\WasapiOutRT.cs:line 143

markheath commented 6 years ago

Yes, this is a known issue. I'm afraid I haven't been actively working on any NAudio on UWP projects in recent years so no progress has been made on this front.

xabre commented 6 years ago

@markheath Any hint on how we should approach this? My experience with the .NET native and Win32 API's is limited but I would like to give it a try.