#pragma once #include #include #include #include #include typedef std::function WASAPINotifyDefaultDeviceChangedCallback; class NotificationClient; class WASAPINotify { public: WASAPINotify(); ~WASAPINotify(); void AddDefaultDeviceChangedCallback( void *handle, WASAPINotifyDefaultDeviceChangedCallback cb); void RemoveDefaultDeviceChangedCallback(void *handle); private: void OnDefaultDeviceChanged(EDataFlow flow, ERole role, LPCWSTR id); std::mutex mutex; ComPtr enumerator; ComPtr notificationClient; std::unordered_map defaultDeviceChangedCallbacks; };