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#pragma once
6
7#include "audio_system.hpp"
8#include "../algorithm/algorithm.hpp"
9#include "../macros.hpp"
10#include <algorithm>
11#include <coroutine>
12
13hi_export_module(hikogui.audio.audio_system_aggregate);
14
15hi_export namespace hi { inline namespace v1 {
16
17hi_export class audio_system_aggregate : public audio_system {
18public:
19 using super = audio_system;
20
21 audio_system_aggregate() = default;
22 virtual ~audio_system_aggregate() {}
23
24 [[nodiscard]] generator<audio_device &> devices() noexcept override
25 {
26 for (auto &child : _children) {
27 for (auto &device: child.system->devices()) {
28 co_yield device;
29 }
30 }
31 }
32
33 void add_child(std::unique_ptr<audio_system> new_child)
34 {
35 auto new_cbt = new_child->subscribe([this] {
36 _notifier();
37 });
38
39 _children.emplace_back(std::move(new_child), std::move(new_cbt));
40 }
41
42private:
43 struct child_type {
45 callback<void()> cbt;
46 };
47
49};
50
51}} // namespace hi::inline v1
The HikoGUI namespace.
Definition array_generic.hpp:20
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
Definition audio_system.hpp:22
Definition audio_system_aggregate.hpp:17
generator< audio_device & > devices() noexcept override
The devices that are part of the audio system.
Definition audio_system_aggregate.hpp:24
T emplace_back(T... args)
T move(T... args)