简体   繁体   中英

How can I select an audio input device and capture audio in directshow

I am using DirectShow to develop a program in windows embedded ce 6.0. I write the program in C/C++.

the program needs to deal with multiple audio input devices .

I am able to get available audio input devices in directshow, but don't know how to specify an input device and capture audio from it.

is there any way to do it? Thanks!

// firstly, using following code to create audio filter

IBaseFilter * pDevice = NULL;  
CoCreateInstance(CLSID_AudioCapture, NULL, CLSCTX_INPROC,IID_IBaseFilter,   (void**)&pDevice);

// then, enumerate PIN to get input audio name from filter

IEnumPins * pinEnum = NULL;  
IPin * pin = NULL;  
ULONG fetchCount = 0;  
PIN_INFO pinInfo;  
pDevice->EnumPins(&pinEnum);

while (SUCCEEDED(pinEnum->Next(1, &pin, &fetchCount)) && fetchCount)   
{  
    pin->QueryPinInfo(&pinInfo);  
    if (pinInfo.dir == PINDIR_INPUT)  
    {  
        // get name from pinInfo.achName  
    }  
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM