7#include "speaker_mapping.hpp"
8#include "../font/font.hpp"
9#include "../utility/utility.hpp"
10#include "../l10n/l10n.hpp"
11#include "../macros.hpp"
15hi_export_module(hikogui.audio.surround_mode);
17hi_export
namespace hi {
inline namespace v1 {
19hi_export
enum class surround_mode : uint64_t {
21 mono_1_0 = uint64_t{1} << 0,
22 stereo_2_0 = uint64_t{1} << 1,
25 stereo_2_1 = uint64_t{1} << 2,
26 stereo_3_0 = uint64_t{1} << 3,
27 stereo_3_1 = uint64_t{1} << 4,
28 quad_4_0 = uint64_t{1} << 5,
29 quad_side_4_0 = uint64_t{1} << 6,
30 hexagonal_6_0 = uint64_t{1} << 7,
31 hexagonal_6_1 = uint64_t{1} << 8,
32 octagonal_8_0 = uint64_t{1} << 9,
35 surround_3_0 = uint64_t{1} << 10,
36 surround_4_0 = uint64_t{1} << 11,
37 surround_4_1 = uint64_t{1} << 12,
38 surround_5_0 = uint64_t{1} << 13,
39 surround_5_1 = uint64_t{1} << 14,
40 surround_7_0 = uint64_t{1} << 15,
41 surround_7_1 = uint64_t{1} << 16,
42 surround_9_0 = uint64_t{1} << 17,
43 surround_9_1 = uint64_t{1} << 18,
44 surround_11_0 = uint64_t{1} << 19,
45 surround_11_1 = uint64_t{1} << 20,
48 surround_side_5_0 = uint64_t{1} << 21,
49 surround_side_5_1 = uint64_t{1} << 22,
50 surround_side_6_0 = uint64_t{1} << 23,
51 surround_side_6_1 = uint64_t{1} << 24,
52 surround_side_7_0 = uint64_t{1} << 25,
53 surround_side_7_1 = uint64_t{1} << 26,
56 surround_wide_6_0 = uint64_t{1} << 27,
57 surround_wide_6_1 = uint64_t{1} << 28,
58 surround_wide_7_0 = uint64_t{1} << 29,
59 surround_wide_7_1 = uint64_t{1} << 30,
62 surround_atmos_5_1_4 = uint64_t{1} << 31,
63 surround_atmos_7_1_4 = uint64_t{1} << 32,
67hi_export
constexpr auto surround_mode_icons = enum_metadata{
68 surround_mode::none, hikogui_icon::none_0_0,
69 surround_mode::mono_1_0, hikogui_icon::mono_1_0,
70 surround_mode::stereo_2_0, hikogui_icon::stereo_2_0,
71 surround_mode::stereo_2_1, hikogui_icon::stereo_2_1,
72 surround_mode::stereo_3_0, hikogui_icon::stereo_3_0,
73 surround_mode::stereo_3_1, hikogui_icon::stereo_3_1,
74 surround_mode::quad_4_0, hikogui_icon::quad_4_0,
75 surround_mode::quad_side_4_0, hikogui_icon::quad_side_4_0,
76 surround_mode::hexagonal_6_0, hikogui_icon::hexagonal_6_0,
77 surround_mode::hexagonal_6_1, hikogui_icon::hexagonal_6_1,
78 surround_mode::octagonal_8_0, hikogui_icon::octagonal_8_0,
79 surround_mode::surround_3_0, hikogui_icon::surround_3_0,
80 surround_mode::surround_4_0, hikogui_icon::surround_4_0,
81 surround_mode::surround_4_1, hikogui_icon::surround_4_1,
82 surround_mode::surround_5_0, hikogui_icon::surround_5_0,
83 surround_mode::surround_5_1, hikogui_icon::surround_5_1,
84 surround_mode::surround_7_0, hikogui_icon::surround_7_0,
85 surround_mode::surround_7_1, hikogui_icon::surround_7_1,
86 surround_mode::surround_9_0, hikogui_icon::surround_9_0,
87 surround_mode::surround_9_1, hikogui_icon::surround_9_1,
88 surround_mode::surround_11_0, hikogui_icon::surround_11_0,
89 surround_mode::surround_11_1, hikogui_icon::surround_11_1,
90 surround_mode::surround_side_5_0, hikogui_icon::surround_side_5_0,
91 surround_mode::surround_side_5_1, hikogui_icon::surround_side_5_1,
92 surround_mode::surround_side_6_0, hikogui_icon::surround_side_6_0,
93 surround_mode::surround_side_6_1, hikogui_icon::surround_side_6_1,
94 surround_mode::surround_side_7_0, hikogui_icon::surround_side_7_0,
95 surround_mode::surround_side_7_1, hikogui_icon::surround_side_7_1,
96 surround_mode::surround_wide_6_0, hikogui_icon::surround_wide_6_0,
97 surround_mode::surround_wide_6_1, hikogui_icon::surround_wide_6_1,
98 surround_mode::surround_wide_7_0, hikogui_icon::surround_wide_7_0,
99 surround_mode::surround_wide_7_1, hikogui_icon::surround_wide_7_1,
100 surround_mode::surround_atmos_5_1_4, hikogui_icon::surround_atmos_5_1_4,
101 surround_mode::surround_atmos_7_1_4, hikogui_icon::surround_atmos_7_1_4,
104hi_export
constexpr auto surround_mode_names = enum_metadata{
105 surround_mode::none,
"none",
106 surround_mode::mono_1_0,
"mono",
107 surround_mode::stereo_2_0,
"stereo",
108 surround_mode::stereo_2_1,
"stereo 2.1",
109 surround_mode::stereo_3_0,
"stereo 3.0",
110 surround_mode::stereo_3_1,
"stereo 3.1",
111 surround_mode::quad_4_0,
"quad",
112 surround_mode::quad_side_4_0,
"quad-side",
113 surround_mode::hexagonal_6_0,
"hexagonal",
114 surround_mode::hexagonal_6_1,
"hexagonal 6.1",
115 surround_mode::octagonal_8_0,
"octagonal",
116 surround_mode::surround_3_0,
"surround 3.0",
117 surround_mode::surround_4_0,
"surround 4.0",
118 surround_mode::surround_4_1,
"surround 4.1",
119 surround_mode::surround_5_0,
"surround 5.0",
120 surround_mode::surround_5_1,
"surround 5.1",
121 surround_mode::surround_7_0,
"surround 7.0",
122 surround_mode::surround_7_1,
"surround 7.1",
123 surround_mode::surround_9_0,
"surround 9.0",
124 surround_mode::surround_9_1,
"surround 9.1",
125 surround_mode::surround_11_0,
"surround 11.0",
126 surround_mode::surround_11_1,
"surround 11.1",
127 surround_mode::surround_side_5_0,
"surround-side 5.0",
128 surround_mode::surround_side_5_1,
"surround-side 5.1",
129 surround_mode::surround_side_6_0,
"surround-side 6.0",
130 surround_mode::surround_side_6_1,
"surround-side 6.1",
131 surround_mode::surround_side_7_0,
"surround-side 7.0",
132 surround_mode::surround_side_7_1,
"surround-side 7.1",
133 surround_mode::surround_wide_6_0,
"surround-wide 6.0",
134 surround_mode::surround_wide_6_1,
"surround-wide 6.1",
135 surround_mode::surround_wide_7_0,
"surround-wide 7.0",
136 surround_mode::surround_wide_7_1,
"surround-wide 7.1",
137 surround_mode::surround_atmos_5_1_4,
"surround-atmos 5.1.4",
138 surround_mode::surround_atmos_7_1_4,
"surround-atmos 7.1.4",
141hi_export
constexpr auto surround_mode_short_names = enum_metadata{
142 surround_mode::none,
"0.0",
143 surround_mode::mono_1_0,
"1.0",
144 surround_mode::stereo_2_0,
"2.0",
145 surround_mode::stereo_2_1,
"2.1",
146 surround_mode::stereo_3_0,
"3.0m",
147 surround_mode::stereo_3_1,
"3.1m",
148 surround_mode::quad_4_0,
"4.0m",
149 surround_mode::quad_side_4_0,
"4.0s",
150 surround_mode::hexagonal_6_0,
"6.0m",
151 surround_mode::hexagonal_6_1,
"6.1m",
152 surround_mode::octagonal_8_0,
"8.0m",
153 surround_mode::surround_3_0,
"3.0",
154 surround_mode::surround_4_0,
"4.0",
155 surround_mode::surround_4_1,
"4.1",
156 surround_mode::surround_5_0,
"5.0",
157 surround_mode::surround_5_1,
"5.1",
158 surround_mode::surround_7_0,
"7.0",
159 surround_mode::surround_7_1,
"7.1",
160 surround_mode::surround_9_0,
"9.0",
161 surround_mode::surround_9_1,
"9.1",
162 surround_mode::surround_11_0,
"11.0",
163 surround_mode::surround_11_1,
"11.1",
164 surround_mode::surround_side_5_0,
"5.0s",
165 surround_mode::surround_side_5_1,
"5.1s",
166 surround_mode::surround_side_6_0,
"6.0s",
167 surround_mode::surround_side_6_1,
"6.1s",
168 surround_mode::surround_side_7_0,
"7.0s",
169 surround_mode::surround_side_7_1,
"7.1s",
170 surround_mode::surround_wide_6_0,
"6.0w",
171 surround_mode::surround_wide_6_1,
"6.1w",
172 surround_mode::surround_wide_7_0,
"7.0w",
173 surround_mode::surround_wide_7_1,
"7.1w",
174 surround_mode::surround_atmos_5_1_4,
"5.1.4",
175 surround_mode::surround_atmos_7_1_4,
"7.1.4",
178hi_export
constexpr auto surround_mode_speaker_mappings = enum_metadata{
179 surround_mode::mono_1_0, speaker_mapping::mono_1_0,
180 surround_mode::stereo_2_0, speaker_mapping::stereo_2_0,
181 surround_mode::stereo_2_1, speaker_mapping::stereo_2_1,
182 surround_mode::stereo_3_0, speaker_mapping::stereo_3_0,
183 surround_mode::stereo_3_1, speaker_mapping::stereo_3_1,
184 surround_mode::quad_4_0, speaker_mapping::quad_4_0,
185 surround_mode::quad_side_4_0, speaker_mapping::quad_side_4_0,
186 surround_mode::hexagonal_6_0, speaker_mapping::hexagonal_6_0,
187 surround_mode::hexagonal_6_1, speaker_mapping::hexagonal_6_1,
188 surround_mode::octagonal_8_0, speaker_mapping::octagonal_8_0,
189 surround_mode::surround_3_0, speaker_mapping::surround_3_0,
190 surround_mode::surround_4_0, speaker_mapping::surround_4_0,
191 surround_mode::surround_4_1, speaker_mapping::surround_4_1,
192 surround_mode::surround_5_0, speaker_mapping::surround_5_0,
193 surround_mode::surround_5_1, speaker_mapping::surround_5_1,
194 surround_mode::surround_7_0, speaker_mapping::surround_7_0,
195 surround_mode::surround_7_1, speaker_mapping::surround_7_1,
196 surround_mode::surround_9_0, speaker_mapping::surround_9_0,
197 surround_mode::surround_9_1, speaker_mapping::surround_9_1,
198 surround_mode::surround_11_0, speaker_mapping::surround_11_0,
199 surround_mode::surround_11_1, speaker_mapping::surround_11_1,
200 surround_mode::surround_side_5_0, speaker_mapping::surround_side_5_0,
201 surround_mode::surround_side_5_1, speaker_mapping::surround_side_5_1,
202 surround_mode::surround_side_6_0, speaker_mapping::surround_side_6_0,
203 surround_mode::surround_side_6_1, speaker_mapping::surround_side_6_1,
204 surround_mode::surround_side_7_0, speaker_mapping::surround_side_7_0,
205 surround_mode::surround_side_7_1, speaker_mapping::surround_side_7_1,
206 surround_mode::surround_wide_6_0, speaker_mapping::surround_wide_6_0,
207 surround_mode::surround_wide_6_1, speaker_mapping::surround_wide_6_1,
208 surround_mode::surround_wide_7_0, speaker_mapping::surround_wide_7_0,
209 surround_mode::surround_wide_7_1, speaker_mapping::surround_wide_7_1,
210 surround_mode::surround_atmos_5_1_4, speaker_mapping::surround_atmos_5_1_4,
211 surround_mode::surround_atmos_7_1_4, speaker_mapping::surround_atmos_7_1_4
216hi_export [[nodiscard]]
constexpr surround_mode operator&(surround_mode
const& lhs, surround_mode
const& rhs)
noexcept
218 return static_cast<surround_mode
>(std::to_underlying(lhs) & std::to_underlying(rhs));
221hi_export [[nodiscard]]
constexpr surround_mode operator|(surround_mode
const& lhs, surround_mode
const& rhs)
noexcept
223 return static_cast<surround_mode
>(std::to_underlying(lhs) | std::to_underlying(rhs));
226hi_export
constexpr surround_mode& operator|=(surround_mode& lhs, surround_mode
const& rhs)
noexcept
228 return lhs = lhs | rhs;
231hi_export [[nodiscard]]
constexpr bool to_bool(surround_mode
const& rhs)
noexcept
233 return to_bool(std::to_underlying(rhs));
236hi_export [[nodiscard]]
constexpr speaker_mapping to_speaker_mapping(surround_mode
const& rhs)
noexcept
238 return surround_mode_speaker_mappings[rhs];
241hi_export [[nodiscard]]
inline generator<surround_mode> enumerate_surround_modes() noexcept
243 auto const begin = std::to_underlying(surround_mode::mono_1_0);
244 auto const end = std::to_underlying(surround_mode::surround_atmos_7_1_4) << 1;
246 for (uint64_t i =
begin; i !=
end; i <<= 1) {
247 auto const mode =
static_cast<surround_mode
>(i);
252hi_export [[nodiscard]]
constexpr std::string_view to_string_view_one(surround_mode
const& mode)
noexcept
254 return surround_mode_short_names[mode];
259 switch (std::popcount(std::to_underlying(mask))) {
266 auto const begin = std::to_underlying(surround_mode::mono_1_0);
267 auto const end = std::to_underlying(surround_mode::surround_atmos_7_1_4) << 1;
270 for (uint64_t i =
begin; i !=
end; i <<= 1) {
271 auto const mode =
static_cast<surround_mode
>(i);
272 if (to_bool(mode & mask)) {
276 r += to_string_view_one(mode);
288struct std::formatter<
hi::surround_mode, char> : std::formatter<std::string_view, char> {
289 auto format(hi::surround_mode
const& t,
auto& fc)
const
291 return std::formatter<std::string_view, char>::format(hi::to_string(t), fc);
@ end
Start from the end of the file.
@ begin
Start from the beginning of the file.
The HikoGUI namespace.
Definition array_generic.hpp:20
DOXYGEN BUG.
Definition algorithm_misc.hpp:20