// SPDX-FileCopyrightText: Copyright 2026 Gloria Goertz, Mireille Meyer // SPDX-License-Identifier: BSD-2-Clause #include namespace atom::Audio::Implementation { atomMMNotificationClient::atomMMNotificationClient(IMMDeviceEnumerator* enumerator) : m_refCount(1), m_enumerator(enumerator) { const HRESULT result = enumerator->RegisterEndpointNotificationCallback(this); switch (result) { case S_OK: { break; } default: { ATOM_PANIC("IMMDeviceEnumerator::RegisterEndpointNotificationCallback failed"); } } } atomMMNotificationClient::~atomMMNotificationClient() { m_enumerator->Release(); } ULONG atomMMNotificationClient::AddRef() { return InterlockedIncrement(&m_refCount); } ULONG atomMMNotificationClient::Release() { const ULONG newCount = InterlockedDecrement(&m_refCount); if (newCount == 0) { delete this; } return newCount; } HRESULT atomMMNotificationClient::QueryInterface(const IID& id, void** ppvInterface) { if (id == IID_IUnknown) { *ppvInterface = static_cast(this); } else if (id == __uuidof(IMMNotificationClient)) { *ppvInterface = static_cast(this); } else { *ppvInterface = nullptr; return E_NOINTERFACE; } AddRef(); return S_OK; } HRESULT atomMMNotificationClient::OnDefaultDeviceChanged(EDataFlow flow, ERole role, LPCWSTR id) { (void)flow; (void)role; (void)id; // TODO(Gloria): inform renderers of change return S_OK; } HRESULT atomMMNotificationClient::OnDeviceAdded(LPCWSTR id) { (void)id; return S_OK; } HRESULT atomMMNotificationClient::OnDeviceRemoved(LPCWSTR id) { (void)id; return S_OK; } HRESULT atomMMNotificationClient::OnDeviceStateChanged(LPCWSTR id, DWORD state) { (void)id; (void)state; return S_OK; } HRESULT atomMMNotificationClient::OnPropertyValueChanged(LPCWSTR id, const PROPERTYKEY key) { (void)id; (void)key; return S_OK; } }