HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
audio_system_aggregate.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#include "audio_system.hpp"
6#include "../algorithm.hpp"
7#include <algorithm>
8
9namespace hi::inline v1 {
10
12public:
13 using super = audio_system;
14
15 audio_system_aggregate() = default;
16 virtual ~audio_system_aggregate() {}
17
18 [[nodiscard]] generator<audio_device *> devices() noexcept override
19 {
20 for (auto &child : _children) {
21 for (auto device: child.system->devices()) {
22 co_yield device;
23 }
24 }
25 }
26
27 void add_child(std::unique_ptr<audio_system> new_child)
28 {
29 auto new_cbt = new_child->subscribe([this] {
30 _notifier();
31 });
32
33 _children.emplace_back(std::move(new_child), std::move(new_cbt));
34 }
35
36private:
37 struct child_type {
39 audio_system::callback_token cbt;
40 };
41
43};
44
45} // namespace hi::inline v1
DOXYGEN BUG.
Definition algorithm.hpp:15
Definition audio_system.hpp:18
Definition audio_system_aggregate.hpp:11
generator< audio_device * > devices() noexcept override
The devices that are part of the audio system.
Definition audio_system_aggregate.hpp:18
A return value for a generator-function.
Definition generator.hpp:28
T move(T... args)
T system(T... args)