Mmdevapi - Audioendpoints [best]

class CNotificationClient : public IMMNotificationClient public: STDMETHODIMP OnDeviceStateChanged(LPCWSTR pwstrDeviceId, DWORD dwNewState) if (dwNewState == DEVICE_STATE_UNPLUGGED) // Notify UI to disable output

Identifies the data flow direction.

(Excerpt showing device state change handling) mmdevapi audioendpoints

The MMDevAPI AudioEndpoints feature provides three main capabilities to applications: mmdevapi audioendpoints

Each endpoint has a state: