HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
audio_device.hpp
1// Copyright Take Vos 2019-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#pragma once
6
7#include "../bigint.hpp"
8#include "audio_device_delegate.hpp"
9#include "audio_stream_config.hpp"
10#include "../label.hpp"
11#include <string>
12#include <memory>
13#include <ostream>
14
15namespace tt {
16
17enum class audio_device_state {
18 active,
19 disabled,
20 not_present,
21 unplugged
22};
23
24[[nodiscard]] constexpr char const *to_const_string(audio_device_state const &rhs) noexcept
25{
26 switch (rhs) {
27 case audio_device_state::active: return "active";
28 case audio_device_state::disabled: return "disabled";
29 case audio_device_state::not_present: return "not_present";
30 case audio_device_state::unplugged: return "unplugged";
31 default: tt_no_default();
32 }
33}
34
35enum class audio_device_flow_direction {
36 input,
37 output,
38 bidirectional
39};
40
41[[nodiscard]] inline std::string to_string(audio_device_state const &rhs) noexcept
42{
43 return {to_const_string(rhs)};
44}
45
46inline std::ostream &operator<<(std::ostream &lhs, audio_device_state const &rhs)
47{
48 return lhs << to_const_string(rhs);
49}
50
60public:
61 audio_device() noexcept = default;
62 virtual ~audio_device() = default;
63
66 virtual std::string id() const noexcept = 0;
67
72 virtual std::string name() const noexcept = 0;
73
78 virtual label label() const noexcept = 0;
79
82 virtual audio_device_state state() const noexcept = 0;
83
84 virtual audio_device_flow_direction direction() const noexcept = 0;
85
89 //virtual bool isConfigSupported(AudiostreamConfig config) const noexcept = 0;
90
107 //virtual void startSession(uuid sessionId, std::string name, AudiostreamConfig config) = 0;
108
112 //virtual void stopSession() noexcept = 0;
113
114private:
115 std::shared_ptr<audio_device_delegate> delegate = {};
116};
117
118}
STL namespace.
A set of audio channels which can be rendered and/or captures at the same time.
Definition audio_device.hpp:59
virtual audio_device_state state() const noexcept=0
Get the current state of the audio device.
virtual std::string name() const noexcept=0
Get a user friendly name of the audio device.
virtual std::string id() const noexcept=0
The nonephemeral unique id that for an audio device on the system.
Definition audio_device_delegate.hpp:11
A localized text + icon label.
Definition label.hpp:76
T to_string(T... args)