There's GetDefaultAudioEndpoint

But I need to Set it

Have a function doing that


Re: Windows SDK There's GetDefaultAudioEndpoint,but no SetDefaultAudioEndpoint


I found a sample file but I can't run it well.

HRESULT SelectCaptureDevice(IMMDevice *pEndptDev); url=/library/en-us/CoreAud/htm/devicetopologies.asp

See it's remark:
// The input argument to this function is a pointer to the
// IMMDevice interface for a capture endpoint device. The
// function traverses the data path that extends from the
// endpoint device to the system bus (for example, PCI)
// or external bus (USB). If the function discovers a MUX
// (input selector) in the path, it selects the MUX input
// that connects to the stream from the endpoint device.

The first problem is here
  // Make sure that this is a capture device.
hr = pConnFrom->GetDataFlow(&flow);

if (flow != Out)
// if (flow != Out)
// Error -- this is a rendering device.
} url=/library/en-us/CoreAud/htm/devicetopologies.asp

The parameter were opposite between the two links

Seems I can trust the "Out" sample first

Re: Windows SDK There's GetDefaultAudioEndpoint,but no SetDefaultAudioEndpoint

Richard0610 url=/library/en-us/CoreAud/htm/devicetopologies.asp
HRESULT SelectCaptureDevice(IMMDevice *pEndptDev);

the sample can't work here:
  // Follow downstream link to next part.
hr = pPartPrev->EnumPartsOutgoing(&pParts);

this part we want to get the outgoing parts list
first time enter the loop it will work
then it found a Connecter

if (parttype == Connector)

break,and trace into loop again

the EnumPartsOutgoing(&pParts)
will return Element not found
so we can't select an Endpoint by AudioInputSelector!!

any one make it work