'NAudio WASAPI recording device with more then 2 channels throws unsupported format error
I faced a problem with recording WASAPI loopback device having 6 or 8 channels using NAdio library. E.g. Device has following wave format: 32 bit PCM: 44kHz 6 channels wBitsPerSample:32
public MMDevice Device;
private WasapiCapture _waveIn;
...
_waveIn = IsLoopback ? new WasapiLoopbackCapture(Device) : new WasapiCapture(Device);
_waveIn.DataAvailable += OnDataAvailable;
_waveIn.RecordingStopped += OnRecordingStopped;
_waveIn.StartRecording();
It crashes on StartRecording with "Unsupported Wave Format" error Error is coming from WasapiCapture.InitializeCaptureDevice() while it calls
if (!audioClient.IsFormatSupported(ShareMode, WaveFormat))
throw new ArgumentException("Unsupported Wave Format");
The code works fine if I switch device to 2 channel using windows->control panel_>Sound settings Is there any walk around this problem? Can I somehow change Device mixformat on the fly
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
