HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
audio_system.hpp
1// Copyright Take Vos 2020-2022.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5#pragma once
6
7#include "audio_device.hpp"
8#include "../unfair_recursive_mutex.hpp"
9#include "../generator.hpp"
10#include <vector>
11#include <memory>
12
13namespace hi::inline v1 {
14
19public:
21 using callback_token = notifier_type::callback_token;
22 using callback_proto = notifier_type::callback_proto;
23
26 [[nodiscard]] static std::unique_ptr<audio_system> make_unique() noexcept;
27
28 audio_system() = default;
29 virtual ~audio_system() = default;
30 audio_system(audio_system const&) = delete;
31 audio_system(audio_system&&) = delete;
32 audio_system& operator=(audio_system const&) = delete;
33 audio_system& operator=(audio_system&&) = delete;
34
42 [[nodiscard]] virtual generator<audio_device *> devices() noexcept = 0;
43
48 callback_token subscribe(forward_of<callback_proto> auto&& func, callback_flags flags = callback_flags::synchronous) noexcept
49 {
50 return _notifier.subscribe(hi_forward(func), flags);
51 }
52
53 auto operator co_await() noexcept
54 {
55 return _notifier.operator co_await();
56 }
57
58protected:
59 notifier_type _notifier;
60};
61
62} // namespace hi::inline v1
#define hi_forward(x)
Forward a value, based on the decltype of the value.
Definition utility.hpp:29
DOXYGEN BUG.
Definition algorithm.hpp:15
callback_flags
Definition callback_flags.hpp:12
A set of audio channels which can be rendered and/or captures at the same time.
Definition audio_device.hpp:31
Definition audio_system.hpp:18
static std::unique_ptr< audio_system > make_unique() noexcept
Create an audio system object specific for the current operating system.
A return value for a generator-function.
Definition generator.hpp:28
A notifier which can be used to call a set of registered callbacks.
Definition notifier.hpp:24
True if T is a forwarded type of Forward.
Definition concepts.hpp:130