-
-
Notifications
You must be signed in to change notification settings - Fork 213
Expand file tree
/
Copy pathdevice.cpp
More file actions
72 lines (66 loc) · 1.63 KB
/
device.cpp
File metadata and controls
72 lines (66 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include "device.hpp"
// All three functions generated from CAPABILITIES_XLIST (defined in device.hpp)
// Adding a new capability only requires adding one X() entry to the list.
const char* capability_to_string(capabilities cap)
{
switch (cap) {
#define X(id, name, short_char) \
case id: \
return name;
CAPABILITIES_XLIST
#undef X
case NUM_CAPABILITIES:
break;
}
return "unknown";
}
const char* capability_to_enum_string(capabilities cap)
{
switch (cap) {
#define X(id, name, short_char) \
case id: \
return #id;
CAPABILITIES_XLIST
#undef X
case NUM_CAPABILITIES:
break;
}
return "UNKNOWN";
}
char capability_to_short_char(capabilities cap)
{
switch (cap) {
#define X(id, name, short_char) \
case id: \
return short_char;
CAPABILITIES_XLIST
#undef X
case NUM_CAPABILITIES:
break;
}
return '\0';
}
const char* equalizer_filter_type_to_string(EqualizerFilterType type)
{
switch (type) {
case EqualizerFilterType::LowShelf:
return "lowshelf";
case EqualizerFilterType::LowPass:
return "lowpass";
case EqualizerFilterType::Peaking:
return "peaking";
case EqualizerFilterType::HighPass:
return "highpass";
case EqualizerFilterType::HighShelf:
return "highshelf";
case EqualizerFilterType::Notch:
return "notch";
case EqualizerFilterType::Count:
break;
}
return "unknown";
}
bool has_capability(int capability_mask, capabilities cap)
{
return (capability_mask & B(cap)) == B(cap);
}