diff options
author | Chris Robinson <[email protected]> | 2018-11-20 02:01:03 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-11-20 02:01:03 -0800 |
commit | 5881cd2183ac4aa954cae1daabf093f006eb0aa3 (patch) | |
tree | b9f0c2153f2862b95ef83541dc148edd253d5a35 /OpenAL32/Include | |
parent | eb2937de8419dddc73952feef5119e6a6be2a93d (diff) |
Add compile-time traits for DevFmtType enum values
Diffstat (limited to 'OpenAL32/Include')
-rw-r--r-- | OpenAL32/Include/alMain.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h index 8f08d94a..0770ee89 100644 --- a/OpenAL32/Include/alMain.h +++ b/OpenAL32/Include/alMain.h @@ -437,6 +437,26 @@ enum DevFmtChannels { }; #define MAX_OUTPUT_CHANNELS (16) +/* DevFmtType traits, providing the type, etc given a DevFmtType. */ +template<DevFmtType T> +struct DevFmtTypeTraits { }; + +template<> +struct DevFmtTypeTraits<DevFmtByte> { using Type = ALbyte; }; +template<> +struct DevFmtTypeTraits<DevFmtUByte> { using Type = ALubyte; }; +template<> +struct DevFmtTypeTraits<DevFmtShort> { using Type = ALshort; }; +template<> +struct DevFmtTypeTraits<DevFmtUShort> { using Type = ALushort; }; +template<> +struct DevFmtTypeTraits<DevFmtInt> { using Type = ALint; }; +template<> +struct DevFmtTypeTraits<DevFmtUInt> { using Type = ALuint; }; +template<> +struct DevFmtTypeTraits<DevFmtFloat> { using Type = ALfloat; }; + + ALsizei BytesFromDevFmt(enum DevFmtType type); ALsizei ChannelsFromDevFmt(enum DevFmtChannels chans, ALsizei ambiorder); inline ALsizei FrameSizeFromDevFmt(enum DevFmtChannels chans, enum DevFmtType type, ALsizei ambiorder) |