aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32/Include
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-11-20 02:42:49 -0800
committerChris Robinson <[email protected]>2018-11-20 02:42:49 -0800
commit16d0e79db7a5e99a9859cfaacb718dfae862cb2a (patch)
tree6c538ed799808d3ea447c3daefcca25c38bfb786 /OpenAL32/Include
parent457d48487277375a6441228b2d297f0c000e9349 (diff)
Add compile-time traits for FmtType enum values
Diffstat (limited to 'OpenAL32/Include')
-rw-r--r--OpenAL32/Include/alBuffer.h25
1 files changed, 18 insertions, 7 deletions
diff --git a/OpenAL32/Include/alBuffer.h b/OpenAL32/Include/alBuffer.h
index f264caa5..a99c06fc 100644
--- a/OpenAL32/Include/alBuffer.h
+++ b/OpenAL32/Include/alBuffer.h
@@ -8,9 +8,6 @@
#include "inprogext.h"
#include "atomic.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
/* User formats */
enum UserFmtType {
@@ -65,6 +62,24 @@ enum FmtChannels {
};
#define MAX_INPUT_CHANNELS (8)
+/* DevFmtType traits, providing the type, etc given a DevFmtType. */
+template<FmtType T>
+struct FmtTypeTraits { };
+
+template<>
+struct FmtTypeTraits<FmtUByte> { using Type = ALubyte; };
+template<>
+struct FmtTypeTraits<FmtShort> { using Type = ALshort; };
+template<>
+struct FmtTypeTraits<FmtFloat> { using Type = ALfloat; };
+template<>
+struct FmtTypeTraits<FmtDouble> { using Type = ALdouble; };
+template<>
+struct FmtTypeTraits<FmtMulaw> { using Type = ALubyte; };
+template<>
+struct FmtTypeTraits<FmtAlaw> { using Type = ALubyte; };
+
+
ALsizei BytesFromFmt(enum FmtType type);
ALsizei ChannelsFromFmt(enum FmtChannels chans);
inline ALsizei FrameSizeFromFmt(enum FmtChannels chans, enum FmtType type)
@@ -107,8 +122,4 @@ typedef struct ALbuffer {
ALvoid ReleaseALBuffers(ALCdevice *device);
-#ifdef __cplusplus
-}
-#endif
-
#endif