Added something (a workaround?) to prevent problems with fake 7.1 drivers

This commit is contained in:
Darth Affe 2017-09-30 22:05:06 +02:00
parent 51213e31c2
commit 1af8bb67c3

View File

@ -1,4 +1,5 @@
using CSCore;
using CSCore.CoreAudioAPI;
using CSCore.SoundIn;
using CSCore.Streams;
@ -28,7 +29,11 @@ namespace KeyboardAudioVisualizer.AudioCapture
public void Initialize()
{
_capture = new WasapiLoopbackCapture();
MMDevice captureDevice = MMDeviceEnumerator.DefaultAudioEndpoint(DataFlow.Render, Role.Console);
WaveFormat deviceFormat = captureDevice.DeviceFormat;
_capture = new WasapiLoopbackCapture(100, new WaveFormat(deviceFormat.SampleRate, deviceFormat.BitsPerSample, deviceFormat.Channels <= 2 ? deviceFormat.Channels : 2));
//_capture = new WasapiLoopbackCapture();
_capture.Initialize();
_soundInSource = new SoundInSource(_capture) { FillWithZeros = false };