HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
src
hikogui
audio
audio_system_aggregate.hpp
1
// Copyright Take Vos 2020.
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
9
namespace
hi::inline v1 {
10
11
class
audio_system_aggregate
:
public
audio_system
{
12
public
:
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
36
private
:
37
struct
child_type {
38
std::unique_ptr<audio_system>
system
;
39
audio_system::token_type cbt;
40
};
41
42
std::vector<child_type>
_children;
43
};
44
45
}
// namespace hi::inline v1
v1::audio_system
Definition
audio_system.hpp:18
v1::audio_system_aggregate
Definition
audio_system_aggregate.hpp:11
v1::audio_system_aggregate::devices
generator< audio_device * > devices() noexcept override
The devices that are part of the audio system.
Definition
audio_system_aggregate.hpp:18
v1::generator
A return value for a generator-function.
Definition
generator.hpp:28
std::move
T move(T... args)
std::system
T system(T... args)
std::unique_ptr
std::vector
Generated on Mon Apr 22 2024 12:52:39 for HikoGUI by
1.10.0