1 #ifndef CORE_DEVFORMAT_H
2 #define CORE_DEVFORMAT_H
8 using uint
= unsigned int;
10 enum Channel
: unsigned char {
56 enum DevFmtType
: unsigned char {
65 DevFmtTypeDefault
= DevFmtFloat
67 enum DevFmtChannels
: unsigned char {
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
{ };
88 struct DevFmtTypeTraits
<DevFmtByte
> { using Type
= int8_t; };
90 struct DevFmtTypeTraits
<DevFmtUByte
> { using Type
= uint8_t; };
92 struct DevFmtTypeTraits
<DevFmtShort
> { using Type
= int16_t; };
94 struct DevFmtTypeTraits
<DevFmtUShort
> { using Type
= uint16_t; };
96 struct DevFmtTypeTraits
<DevFmtInt
> { using Type
= int32_t; };
98 struct DevFmtTypeTraits
<DevFmtUInt
> { using Type
= uint32_t; };
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 {
121 enum class DevAmbiScaling
: unsigned char {
129 #endif /* CORE_DEVFORMAT_H */