I would like to co_await
the file completed event from the WinRT AudioGraph
API.
Is this possible? It seams like a far superior way to program than using state or recursion.
Yes. You co_await
the resume_on_signal
function.
co_await winrt::resume_on_signal(m_event_handle);
Here's the handle being created
HANDLE m_event_handle;
m_event_handle = CreateEventA(nullptr, false, false, nullptr);
Then subscribe to the event with the following event handler
fileInputNode.FileCompleted([this](auto, auto) { winrt::check_bool(SetEvent(m_event_handle)); });