Ensure the mixer helpers are properly inlined
[openal-soft.git] / core / devformat.h
blob485826a397e7fd3e2b1bcfd4f3f64e1ebc6a9808
1 #ifndef CORE_DEVFORMAT_H
2 #define CORE_DEVFORMAT_H
4 #include <cstdint>
7 using uint = unsigned int;
9 enum Channel : unsigned char {
10 FrontLeft = 0,
11 FrontRight,
12 FrontCenter,
13 LFE,
14 BackLeft,
15 BackRight,
16 BackCenter,
17 SideLeft,
18 SideRight,
20 TopCenter,
21 TopFrontLeft,
22 TopFrontCenter,
23 TopFrontRight,
24 TopBackLeft,
25 TopBackCenter,
26 TopBackRight,
28 Aux0,
29 Aux1,
30 Aux2,
31 Aux3,
32 Aux4,
33 Aux5,
34 Aux6,
35 Aux7,
36 Aux8,
37 Aux9,
38 Aux10,
39 Aux11,
40 Aux12,
41 Aux13,
42 Aux14,
43 Aux15,
45 MaxChannels
49 /* Device formats */
50 enum DevFmtType : unsigned char {
51 DevFmtByte,
52 DevFmtUByte,
53 DevFmtShort,
54 DevFmtUShort,
55 DevFmtInt,
56 DevFmtUInt,
57 DevFmtFloat,
59 DevFmtTypeDefault = DevFmtFloat
61 enum DevFmtChannels : unsigned char {
62 DevFmtMono,
63 DevFmtStereo,
64 DevFmtQuad,
65 DevFmtX51,
66 DevFmtX61,
67 DevFmtX71,
68 DevFmtX714,
69 DevFmtX3D71,
70 DevFmtAmbi3D,
72 DevFmtChannelsDefault = DevFmtStereo
74 #define MAX_OUTPUT_CHANNELS 16
76 /* DevFmtType traits, providing the type, etc given a DevFmtType. */
77 template<DevFmtType T>
78 struct DevFmtTypeTraits { };
80 template<>
81 struct DevFmtTypeTraits<DevFmtByte> { using Type = int8_t; };
82 template<>
83 struct DevFmtTypeTraits<DevFmtUByte> { using Type = uint8_t; };
84 template<>
85 struct DevFmtTypeTraits<DevFmtShort> { using Type = int16_t; };
86 template<>
87 struct DevFmtTypeTraits<DevFmtUShort> { using Type = uint16_t; };
88 template<>
89 struct DevFmtTypeTraits<DevFmtInt> { using Type = int32_t; };
90 template<>
91 struct DevFmtTypeTraits<DevFmtUInt> { using Type = uint32_t; };
92 template<>
93 struct DevFmtTypeTraits<DevFmtFloat> { using Type = float; };
95 template<DevFmtType T>
96 using DevFmtType_t = typename DevFmtTypeTraits<T>::Type;
99 uint BytesFromDevFmt(DevFmtType type) noexcept;
100 uint ChannelsFromDevFmt(DevFmtChannels chans, uint ambiorder) noexcept;
101 inline uint FrameSizeFromDevFmt(DevFmtChannels chans, DevFmtType type, uint ambiorder) noexcept
102 { return ChannelsFromDevFmt(chans, ambiorder) * BytesFromDevFmt(type); }
104 const char *DevFmtTypeString(DevFmtType type) noexcept;
105 const char *DevFmtChannelsString(DevFmtChannels chans) noexcept;
107 enum class DevAmbiLayout : bool {
108 FuMa,
109 ACN,
111 Default = ACN
114 enum class DevAmbiScaling : unsigned char {
115 FuMa,
116 SN3D,
117 N3D,
119 Default = SN3D
122 #endif /* CORE_DEVFORMAT_H */