3

I am trying to capture audio from the mic using the windows core audio APIs

The relevant lines of code are

const CLSID CLSID_MMDeviceEnumerator = __uuidof(MMDeviceEnumerator);  
const IID IID_IMMDeviceEnumerator = __uuidof(IMMDeviceEnumerator);
IMMDeviceEnumerator *pEnumerator = NULL;  
hr = CoCreateInstance(CLSID_MMDeviceEnumerator,NULL,CLSCTX_ALL,IID_IMMDeviceEnumerator,   (void**)&pEnumerator);

hr returns the following value-

0x800401f0 : CoInitialize has not been called.

I have adapted the sample program from the msdn page - Capturing an audio stream

What could be wrong? Also I don't understand what the error means - from the descriptions I got from Google search and all.

I am using Visual studio 2012 express on Win7 Home Pro x64.

1 Answer 1

3

Isn't the error message clear enough? You need to call CoInitialize before calling CoCreateInstance (or using COM in any other way).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.