HRESULT STDMETHODCALLTYPE WASAPINotificationClient::OnDefaultDeviceChanged(EDataFlow flow, ERole role, LPCWSTR pwstrDefaultDevice) { const QString device = QString::fromWCharArray(pwstrDefaultDevice); qWarning() << "WASAPINotificationClient: Default device changed flow=" << flow << "role=" << role << "device" << device; QMutexLocker lock(&listsMutex); if (!usedDefaultDevices.empty() && role == eCommunications) { restartAudio(); } return S_OK; }
HRESULT STDMETHODCALLTYPE WASAPINotificationClient::OnPropertyValueChanged(LPCWSTR pwstrDeviceId, const PROPERTYKEY key) { const QString device = QString::fromWCharArray(pwstrDeviceId); const bool formatChanged = (key == PKEY_AudioEngine_DeviceFormat); const bool channelConfigChanged = (key == PKEY_AudioEndpoint_PhysicalSpeakers); QMutexLocker lock(&listsMutex); if ((formatChanged || channelConfigChanged) && usedDevices.contains(device)) { qWarning() <<"WASAPINotificationClient: Property changed device=" << device << "formatChanged=" << formatChanged << "channelConfigChanged=" << channelConfigChanged; restartAudio(); } return S_OK; }
void DeviceAudioDX11::initialize (void) { restartAudio (); }