This project has moved. For the latest updates, please go here.

WasapiOut High CPU Usage on Windows 10

Aug 2, 2015 at 9:38 PM
I've been using WasapiOut in a VB.NET program on Windows 7, 8 and 8.1 without any problems but since Windows 10, as soon as the stream starts playing, CPU usage goes quite high. Usually it's around 15% but i've seen 30% and 100% also.

This is more or less the code i'm using (I created a test program to make sure it wasn't something else in my main program causing the issue)
Imports NAudio.CoreAudioApi
Imports NAudio.Wave

Public Class Form1
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim WavePlayer As WasapiOut
        Dim DefaultAudioDevice As New MMDeviceEnumerator
        WavePlayer = New WasapiOut(DefaultAudioDevice.GetDefaultAudioEndpoint(DataFlow.Render, Role.Multimedia), AudioClientShareMode.Shared, True, 0)
        WavePlayer.Init(New WaveChannel32(New WaveFileReader("C:\Users\Marc\Documents\Visual Studio 2015\Projects\Wasapi Test\test.wav")))
    End Sub
End Class
Is there a way I can change the implementation of the code, or is there an issue with WasapiOut in Windows 10?

Thanks in advance

Aug 3, 2015 at 5:28 PM
I noticed that in Win 10, get stream latency returns 0, which means that the waits for events will instantly return. Try running it without event based sync, and seeing if that improves performance.
Aug 3, 2015 at 8:58 PM
Thanks Mark, setting that to False and setting the Latency to 2 stops it from using excessive CPU :)
Aug 4, 2015 at 1:13 PM
Great. I've checked in a fix at GitHub that hopefully will resolve the high CPU issue in event mode