7#include "audio_device.hpp"
8#include "../utility/utility.hpp"
9#include "../coroutine/module.hpp"
10#include "../macros.hpp"
15hi_export_module(hikogui.audio.audio_system);
17namespace hi {
inline namespace v1 {
25 using callback_token = notifier_type::callback_token;
26 using callback_proto = notifier_type::callback_proto;
54 return _notifier.subscribe(hi_forward(
func), flags);
57 auto operator co_await()
noexcept
59 return _notifier.operator
co_await();
65 notifier_type _notifier;
68template<
typename Context>
69concept audio_device_filter = std::same_as<Context, audio_device_state>
or std::same_as<Context, audio_direction>;
71[[
nodiscard]]
constexpr bool match_audio_device(audio_device
const &device)
noexcept
79 if constexpr (std::same_as<FirstFilter, audio_device_state>) {
83 }
else if constexpr (std::same_as<FirstFilter, audio_direction>) {
88 hi_static_no_default();
91 return match_audio_device(device, std::forward<Filters>(
filters)...);
101template<audio_device_filter...
Filters>
105 if (match_audio_device(device, std::forward<Filters>(
filters)...)) {
DOXYGEN BUG.
Definition algorithm.hpp:16
geometry/margins.hpp
Definition lookahead_iterator.hpp:5
generator< audio_device & > audio_devices(Filters &&...filters) noexcept
Get audio devices matching the filter arguments.
Definition audio_system.hpp:102
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:377
A set of audio channels which can be rendered and/or captures at the same time.
Definition audio_device.hpp:34
Definition audio_system.hpp:22
static audio_system & global() noexcept
Create an audio system object specific for the current operating system.
Definition audio_system_win32.hpp:229
callback_token subscribe(forward_of< callback_proto > auto &&func, callback_flags flags=callback_flags::synchronous) noexcept
Subscribe a function to be called when the device list changes.
Definition audio_system.hpp:52
virtual generator< audio_device & > devices() noexcept=0
The devices that are part of the audio system.
Definition audio_system.hpp:69
True if T is a forwarded type of Forward.
Definition concepts.hpp:131