Skip to content

Commit

Permalink
fixed WASAPI helper threads not being background
Browse files Browse the repository at this point in the history
  • Loading branch information
lostmsu committed Mar 31, 2023
1 parent fdaf3c7 commit c93fe80
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion NAudio.Wasapi/WasapiCapture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,10 @@ public void StartRecording()
}
captureState = CaptureState.Starting;
InitializeCaptureDevice();
captureThread = new Thread(() => CaptureThread(audioClient));
captureThread = new Thread(() => CaptureThread(audioClient))
{
IsBackground = true,
};
captureThread.Start();
}

Expand Down
5 changes: 4 additions & 1 deletion NAudio.Wasapi/WasapiOut.cs
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,10 @@ public void Play()
{
if (playbackState == PlaybackState.Stopped)
{
playThread = new Thread(PlayThread);
playThread = new Thread(PlayThread)
{
IsBackground = true,
};
playbackState = PlaybackState.Playing;
playThread.Start();
}
Expand Down

0 comments on commit c93fe80

Please sign in to comment.