Apply the source's AL_AIR_ABSORPTION_FACTOR to send paths
[openal-soft.git] / core / devformat.h
blobca59df5e55f10e222fb5370489a92998f9f58d24
1 #ifndef CORE_DEVFORMAT_H
2 #define CORE_DEVFORMAT_H
4 #include <cstdint>
5 #include <cstddef>
8 using uint = unsigned int;
10 enum Channel : unsigned char {
11 FrontLeft = 0,
12 FrontRight,
13 FrontCenter,
14 LFE,
15 BackLeft,
16 BackRight,
17 BackCenter,
18 SideLeft,
19 SideRight,
21 TopCenter,
22 TopFrontLeft,
23 TopFrontCenter,
24 TopFrontRight,
25 TopBackLeft,
26 TopBackCenter,
27 TopBackRight,
29 BottomFrontLeft,
30 BottomFrontRight,
31 BottomBackLeft,
32 BottomBackRight,
34 Aux0,
35 Aux1,
36 Aux2,
37 Aux3,
38 Aux4,
39 Aux5,
40 Aux6,
41 Aux7,
42 Aux8,
43 Aux9,
44 Aux10,
45 Aux11,
46 Aux12,
47 Aux13,
48 Aux14,
49 Aux15,
51 MaxChannels
55 /* Device formats */
56 enum DevFmtType : unsigned char {
57 DevFmtByte,
58 DevFmtUByte,
59 DevFmtShort,
60 DevFmtUShort,
61 DevFmtInt,
62 DevFmtUInt,
63 DevFmtFloat,
65 DevFmtTypeDefault = DevFmtFloat
67 enum DevFmtChannels : unsigned char {
68 DevFmtMono,
69 DevFmtStereo,
70 DevFmtQuad,
71 DevFmtX51,
72 DevFmtX61,
73 DevFmtX71,
74 DevFmtX714,
75 DevFmtX7144,
76 DevFmtX3D71,
77 DevFmtAmbi3D,
79 DevFmtChannelsDefault = DevFmtStereo
81 inline constexpr std::size_t MaxOutputChannels{16};
83 /* DevFmtType traits, providing the type, etc given a DevFmtType. */
84 template<DevFmtType T>
85 struct DevFmtTypeTraits { };
87 template<>
88 struct DevFmtTypeTraits<DevFmtByte> { using Type = int8_t; };
89 template<>
90 struct DevFmtTypeTraits<DevFmtUByte> { using Type = uint8_t; };
91 template<>
92 struct DevFmtTypeTraits<DevFmtShort> { using Type = int16_t; };
93 template<>
94 struct DevFmtTypeTraits<DevFmtUShort> { using Type = uint16_t; };
95 template<>
96 struct DevFmtTypeTraits<DevFmtInt> { using Type = int32_t; };
97 template<>
98 struct DevFmtTypeTraits<DevFmtUInt> { using Type = uint32_t; };
99 template<>
100 struct DevFmtTypeTraits<DevFmtFloat> { using Type = float; };
102 template<DevFmtType T>
103 using DevFmtType_t = typename DevFmtTypeTraits<T>::Type;
106 uint BytesFromDevFmt(DevFmtType type) noexcept;
107 uint ChannelsFromDevFmt(DevFmtChannels chans, uint ambiorder) noexcept;
108 inline uint FrameSizeFromDevFmt(DevFmtChannels chans, DevFmtType type, uint ambiorder) noexcept
109 { return ChannelsFromDevFmt(chans, ambiorder) * BytesFromDevFmt(type); }
111 const char *DevFmtTypeString(DevFmtType type) noexcept;
112 const char *DevFmtChannelsString(DevFmtChannels chans) noexcept;
114 enum class DevAmbiLayout : bool {
115 FuMa,
116 ACN,
118 Default = ACN
121 enum class DevAmbiScaling : unsigned char {
122 FuMa,
123 SN3D,
124 N3D,
126 Default = SN3D
129 #endif /* CORE_DEVFORMAT_H */