Richard0610

Hello,

There's GetDefaultAudioEndpoint

But I need to Set it

Have a function doing that

Tks.


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

Richard0610

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

HRESULT SelectCaptureDevice(IMMDevice *pEndptDev);
http://msdn.microsoft.com/library/default.asp 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);
EXIT_ON_ERROR(hr)

if (flow != Out)
// if (flow != Out)
{
// Error -- this is a rendering device.
EXIT_ON_ERROR(hr = AUDCLNT_E_WRONG_ENDPOINT_TYPE)
}

http://msdn.microsoft.com/library/default.asp url=/library/en-us/CoreAud/htm/devicetopologies.asp
http://msdn2.microsoft.com/en-gb/library/ms678713.aspx

The parameter were opposite between the two links
WOW!!

Seems I can trust the "Out" sample first







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

Richard0610

http://msdn.microsoft.com/library/default.asp 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);
EXIT_ON_ERROR(hr)

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