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 {
71 DevFmtChannelsDefault
= DevFmtStereo
73 #define MAX_OUTPUT_CHANNELS 16
75 /* DevFmtType traits, providing the type, etc given a DevFmtType. */
76 template<DevFmtType T
>
77 struct DevFmtTypeTraits
{ };
80 struct DevFmtTypeTraits
<DevFmtByte
> { using Type
= int8_t; };
82 struct DevFmtTypeTraits
<DevFmtUByte
> { using Type
= uint8_t; };
84 struct DevFmtTypeTraits
<DevFmtShort
> { using Type
= int16_t; };
86 struct DevFmtTypeTraits
<DevFmtUShort
> { using Type
= uint16_t; };
88 struct DevFmtTypeTraits
<DevFmtInt
> { using Type
= int32_t; };
90 struct DevFmtTypeTraits
<DevFmtUInt
> { using Type
= uint32_t; };
92 struct DevFmtTypeTraits
<DevFmtFloat
> { using Type
= float; };
94 template<DevFmtType T
>
95 using DevFmtType_t
= typename DevFmtTypeTraits
<T
>::Type
;
98 uint
BytesFromDevFmt(DevFmtType type
) noexcept
;
99 uint
ChannelsFromDevFmt(DevFmtChannels chans
, uint ambiorder
) noexcept
;
100 inline uint
FrameSizeFromDevFmt(DevFmtChannels chans
, DevFmtType type
, uint ambiorder
) noexcept
101 { return ChannelsFromDevFmt(chans
, ambiorder
) * BytesFromDevFmt(type
); }
103 const char *DevFmtTypeString(DevFmtType type
) noexcept
;
104 const char *DevFmtChannelsString(DevFmtChannels chans
) noexcept
;
106 enum class DevAmbiLayout
: bool {
113 enum class DevAmbiScaling
: unsigned char {
121 #endif /* CORE_DEVFORMAT_H */