29 audio_system_win32() : super(), _notification_client(std::make_unique<audio_system_win32_notification_client>(
this))
38 reinterpret_cast<LPVOID *
>(&_device_enumerator)));
39 hi_assert(_device_enumerator);
41 _device_enumerator->RegisterEndpointNotificationCallback(_notification_client.
get());
49 if (_device_enumerator) {
50 _device_enumerator->UnregisterEndpointNotificationCallback(_notification_client.
get());
51 _device_enumerator->Release();
57 for (
auto const& device : _devices) {
63 class audio_system_win32_notification_client :
public IMMNotificationClient {
65 virtual ~audio_system_win32_notification_client() =
default;
67 audio_system_win32_notification_client(
audio_system_win32 *system) : IMMNotificationClient(), _system(system) {}
71 loop::main().wfree_post_function([
this]() {
72 _system->update_device_list();
80 loop::main().wfree_post_function([
this]() {
81 _system->update_device_list();
96 hi_assert_not_null(device_id);
97 loop::main().wfree_post_function([
this]() {
98 _system->update_device_list();
106 loop::main().wfree_post_function([
this]() {
107 _system->update_device_list();
108 _system->_notifier();
115 loop::main().wfree_post_function([
this]() {
116 _system->update_device_list();
117 _system->_notifier();
138 audio_system_win32 *_system;
159 hi_axiom(loop::main().on_thread());
160 hi_log_info(
"Updating audio device list:");
163 if (
FAILED(_device_enumerator->EnumAudioEndpoints(
192 hi_log_error(
"EnumAudioEndpoints()->Item({})->get_device_id failed: {}", i, e.
what());
199 return item->id() == win32_device_id;
209 _devices.
back()->update_state();
227 friend class audio_system_win32_notification_client;
hi_export std::string get_last_error_message()
Get the OS error message from the last error received on this thread.
Definition exception_win32_impl.hpp:30
static audio_system & global() noexcept
Create an audio system object specific for the current operating system.
Definition audio_system_win32.hpp:230