// How many pins are in the input pin list?
int nPins = m_ListInputPins.GetCount();
int nActivePin = m_ListInputPins.GetCurSel();
// Activate the selected input pin and deactivate all others
for (int i=0; i<nPins; i++)
{
// Get this pin's interface
hr = GetPin(m_pInputDevice, PINDIR_INPUT, i, &pPin);
if (SUCCEEDED(hr))
{
hr = pPin->QueryInterface(IID_IAMAudioInputMixer, (void **)&pPinMixer);
if (SUCCEEDED(hr))
{
// If this is our selected pin, enable it
if (i == nActivePin)
{
// Set any other audio properties on this pin
hr = SetInputPinProperties(pPinMixer);
// If there is only one input pin, this method
// might return E_NOTIMPL.
hr = pPinMixer->put_Enable(TRUE);
}
// Otherwise, disable it
else
{
hr = pPinMixer->put_Enable(FALSE);
}