From 5881cd2183ac4aa954cae1daabf093f006eb0aa3 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 20 Nov 2018 02:01:03 -0800 Subject: Add compile-time traits for DevFmtType enum values --- OpenAL32/Include/alMain.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'OpenAL32') 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 +struct DevFmtTypeTraits { }; + +template<> +struct DevFmtTypeTraits { using Type = ALbyte; }; +template<> +struct DevFmtTypeTraits { using Type = ALubyte; }; +template<> +struct DevFmtTypeTraits { using Type = ALshort; }; +template<> +struct DevFmtTypeTraits { using Type = ALushort; }; +template<> +struct DevFmtTypeTraits { using Type = ALint; }; +template<> +struct DevFmtTypeTraits { using Type = ALuint; }; +template<> +struct DevFmtTypeTraits { 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) -- cgit v1.2.3