cscore icon indicating copy to clipboard operation
cscore copied to clipboard

CoreAudioApiException when Initializing after using GetDefaultAudioEndpoint

Open christopher-bonitz opened this issue 9 years ago • 3 comments

I've debugged this as far as I can without pulling the source.

My goal is to record a small sound file using the microphone, inside an existing WPF application. There exists two active recording devices, one of them is both communication device and multimedia device. It is not chosen per default, so I'm trying to select it manually.

This is the (somewhat simple) code that should do the trick.

WasapiLoopbackCapture wasapiCapture = new WasapiLoopbackCapture();
wasapiCapture.Device = new MMDeviceEnumerator().GetDefaultAudioEndpoint(DataFlow.Capture, Role.Communications);
wasapiCapture.Initialize();

But alas, no success. Message: IAudioClient::Initialize caused an error: 0x88890003, "Unknown HRESULT".

Relevant stacktrace

   at CSCore.SoundIn.WasapiCapture.InitializeInternal()
   at CSCore.SoundIn.WasapiCapture.Initialize()

Bonus info: The device property of WasapiLoopbackCapture is set correctly, it is the initialization that seems to have a problem here.

I've taken a peak at the source, no dice I'm afraid.

christopher-bonitz avatar Feb 06 '17 15:02 christopher-bonitz

Darn it.

Figured out what went wrong, I built my code from the example in cscore/Samples/RecordToWma/Program.cs This uses the WasapiLoopbackCapture, but in my case that didn't work.

Don't think this is a bug then, but a clarification in the sample would be nice. :)

christopher-bonitz avatar Feb 06 '17 16:02 christopher-bonitz

Glad to hear that. I ll take a look at the sample.

filoe avatar Feb 12 '17 21:02 filoe

I'm sorry for coming back to this so late. What should be clarified?

filoe avatar Oct 21 '17 20:10 filoe