HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
speaker_mapping_win32.hpp
1// Copyright Take Vos 2021.
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 "speaker_mapping.hpp"
8#include "../macros.hpp"
9
10hi_export_module(hikogui.audio.speaker_mapping_win32);
11
12hi_export namespace hi { inline namespace v1 {
13
14hi_export [[nodiscard]] hi_inline speaker_mapping speaker_mapping_from_win32(DWORD from){
15 auto r = speaker_mapping{0};
16
22
23 hi_check((from & ~valid_mask) == 0, "Unknown speaker locations");
24
26 r |= speaker_mapping::front_left;
27 }
29 r |= speaker_mapping::front_right;
30 }
32 r |= speaker_mapping::front_center;
33 }
35 r |= speaker_mapping::low_frequency;
36 }
37 if (from & SPEAKER_BACK_LEFT) {
38 r |= speaker_mapping::back_left;
39 }
41 r |= speaker_mapping::back_right;
42 }
44 r |= speaker_mapping::front_left_of_center;
45 }
47 r |= speaker_mapping::front_right_of_center;
48 }
50 r |= speaker_mapping::back_center;
51 }
52 if (from & SPEAKER_SIDE_LEFT) {
53 r |= speaker_mapping::side_left;
54 }
56 r |= speaker_mapping::side_right;
57 }
59 r |= speaker_mapping::top_center;
60 }
62 r |= speaker_mapping::top_front_left;
63 }
65 r |= speaker_mapping::top_front_center;
66 }
68 r |= speaker_mapping::top_front_right;
69 }
71 r |= speaker_mapping::top_back_left;
72 }
74 r |= speaker_mapping::top_back_center;
75 }
77 r |= speaker_mapping::top_back_right;
78 }
79
80 return r;
81}
82
83hi_export [[nodiscard]] hi_inline DWORD speaker_mapping_to_win32(speaker_mapping from) noexcept{
84 auto r = DWORD{0};
85
86 if (to_bool(from & speaker_mapping::front_left)) {
88 }
89 if (to_bool(from & speaker_mapping::front_right)) {
91 }
92 if (to_bool(from & speaker_mapping::front_center)) {
94 }
95 if (to_bool(from & speaker_mapping::low_frequency)) {
97 }
98 if (to_bool(from & speaker_mapping::back_left)) {
100 }
101 if (to_bool(from & speaker_mapping::back_right)) {
103 }
104 if (to_bool(from & speaker_mapping::front_left_of_center)) {
106 }
107 if (to_bool(from & speaker_mapping::front_right_of_center)) {
109 }
110 if (to_bool(from & speaker_mapping::back_center)) {
112 }
113 if (to_bool(from & speaker_mapping::side_left)) {
115 }
116 if (to_bool(from & speaker_mapping::side_right)) {
118 }
119 if (to_bool(from & speaker_mapping::top_center)) {
121 }
122 if (to_bool(from & speaker_mapping::top_front_left)) {
124 }
125 if (to_bool(from & speaker_mapping::top_front_center)) {
127 }
128 if (to_bool(from & speaker_mapping::top_front_right)) {
130 }
131 if (to_bool(from & speaker_mapping::top_back_left)) {
133 }
134 if (to_bool(from & speaker_mapping::top_back_center)) {
136 }
137 if (to_bool(from & speaker_mapping::top_back_right)) {
139 }
140
141 return r;
142}
143
144
145}} // namespace hi::inline v1
DOXYGEN BUG.
Definition algorithm_misc.hpp:20
The HikoGUI namespace.
Definition recursive_iterator.hpp:15
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:378