diff options
author | Chris Robinson <[email protected]> | 2019-08-05 15:03:18 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-08-05 15:03:18 -0700 |
commit | e286ec8d09b8d0a1939bca9eaa196514347282b1 (patch) | |
tree | 23050faca3ea3280a2d9a16b5cbac9ad4f5bc48e /alc/devformat.h | |
parent | d24401c3f3fbed3f0aa7fd5e4777e0d83797fa10 (diff) |
Move some declarations out of alcmain.h
Diffstat (limited to 'alc/devformat.h')
-rw-r--r-- | alc/devformat.h | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/alc/devformat.h b/alc/devformat.h new file mode 100644 index 00000000..95fe5fbd --- /dev/null +++ b/alc/devformat.h @@ -0,0 +1,120 @@ +#ifndef ALC_DEVFORMAT_H +#define ALC_DEVFORMAT_H + +#include "AL/al.h" +#include "AL/alc.h" +#include "AL/alext.h" + +#include "inprogext.h" + + +enum Channel { + FrontLeft = 0, + FrontRight, + FrontCenter, + LFE, + BackLeft, + BackRight, + BackCenter, + SideLeft, + SideRight, + + UpperFrontLeft, + UpperFrontRight, + UpperBackLeft, + UpperBackRight, + LowerFrontLeft, + LowerFrontRight, + LowerBackLeft, + LowerBackRight, + + Aux0, + Aux1, + Aux2, + Aux3, + Aux4, + Aux5, + Aux6, + Aux7, + Aux8, + Aux9, + Aux10, + Aux11, + Aux12, + Aux13, + Aux14, + Aux15, + + MaxChannels +}; + + +/* Device formats */ +enum DevFmtType : ALenum { + DevFmtByte = ALC_BYTE_SOFT, + DevFmtUByte = ALC_UNSIGNED_BYTE_SOFT, + DevFmtShort = ALC_SHORT_SOFT, + DevFmtUShort = ALC_UNSIGNED_SHORT_SOFT, + DevFmtInt = ALC_INT_SOFT, + DevFmtUInt = ALC_UNSIGNED_INT_SOFT, + DevFmtFloat = ALC_FLOAT_SOFT, + + DevFmtTypeDefault = DevFmtFloat +}; +enum DevFmtChannels : ALenum { + DevFmtMono = ALC_MONO_SOFT, + DevFmtStereo = ALC_STEREO_SOFT, + DevFmtQuad = ALC_QUAD_SOFT, + DevFmtX51 = ALC_5POINT1_SOFT, + DevFmtX61 = ALC_6POINT1_SOFT, + DevFmtX71 = ALC_7POINT1_SOFT, + DevFmtAmbi3D = ALC_BFORMAT3D_SOFT, + + /* Similar to 5.1, except using rear channels instead of sides */ + DevFmtX51Rear = 0x70000000, + + DevFmtChannelsDefault = DevFmtStereo +}; +#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(DevFmtType type) noexcept; +ALsizei ChannelsFromDevFmt(DevFmtChannels chans, ALsizei ambiorder) noexcept; +inline ALsizei FrameSizeFromDevFmt(DevFmtChannels chans, DevFmtType type, ALsizei ambiorder) noexcept +{ return ChannelsFromDevFmt(chans, ambiorder) * BytesFromDevFmt(type); } + +enum class AmbiLayout { + FuMa = ALC_FUMA_SOFT, /* FuMa channel order */ + ACN = ALC_ACN_SOFT, /* ACN channel order */ + + Default = ACN +}; + +enum class AmbiNorm { + FuMa = ALC_FUMA_SOFT, /* FuMa normalization */ + SN3D = ALC_SN3D_SOFT, /* SN3D normalization */ + N3D = ALC_N3D_SOFT, /* N3D normalization */ + + Default = SN3D +}; + +#endif /* ALC_DEVFORMAT_H */ |