1 #ifndef CORE_DEVFORMAT_H
2 #define CORE_DEVFORMAT_H
7 using uint
= unsigned int;
9 enum Channel
: unsigned char {
50 enum DevFmtType
: unsigned char {
59 DevFmtTypeDefault
= DevFmtFloat
61 enum DevFmtChannels
: unsigned char {
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
{ };
81 struct DevFmtTypeTraits
<DevFmtByte
> { using Type
= int8_t; };
83 struct DevFmtTypeTraits
<DevFmtUByte
> { using Type
= uint8_t; };
85 struct DevFmtTypeTraits
<DevFmtShort
> { using Type
= int16_t; };
87 struct DevFmtTypeTraits
<DevFmtUShort
> { using Type
= uint16_t; };
89 struct DevFmtTypeTraits
<DevFmtInt
> { using Type
= int32_t; };
91 struct DevFmtTypeTraits
<DevFmtUInt
> { using Type
= uint32_t; };
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 {
114 enum class DevAmbiScaling
: unsigned char {
122 #endif /* CORE_DEVFORMAT_H */