aboutsummaryrefslogtreecommitdiffstats
path: root/alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-08-05 15:03:18 -0700
committerChris Robinson <[email protected]>2019-08-05 15:03:18 -0700
commite286ec8d09b8d0a1939bca9eaa196514347282b1 (patch)
tree23050faca3ea3280a2d9a16b5cbac9ad4f5bc48e /alc
parentd24401c3f3fbed3f0aa7fd5e4777e0d83797fa10 (diff)
Move some declarations out of alcmain.h
Diffstat (limited to 'alc')
-rw-r--r--alc/alcmain.h122
-rw-r--r--alc/backends/opensl.cpp3
-rw-r--r--alc/backends/wave.cpp1
-rw-r--r--alc/devformat.h120
4 files changed, 124 insertions, 122 deletions
diff --git a/alc/alcmain.h b/alc/alcmain.h
index 5b4e4a2b..e7451ab0 100644
--- a/alc/alcmain.h
+++ b/alc/alcmain.h
@@ -22,6 +22,7 @@
#include "alspan.h"
#include "ambidefs.h"
#include "atomic.h"
+#include "devformat.h"
#include "hrtf.h"
#include "inprogext.h"
#include "intrusive_ptr.h"
@@ -39,133 +40,12 @@ struct Uhj2Encoder;
struct bs2b;
-#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__)
-#define IS_LITTLE_ENDIAN (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
-#else
-static const union {
- ALuint u;
- ALubyte b[sizeof(ALuint)];
-} EndianTest = { 1 };
-#define IS_LITTLE_ENDIAN (EndianTest.b[0] == 1)
-#endif
-
-
#define MIN_OUTPUT_RATE 8000
#define DEFAULT_OUTPUT_RATE 44100
#define DEFAULT_UPDATE_SIZE 882 /* 20ms */
#define DEFAULT_NUM_UPDATES 3
-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
-};
-
-
enum DeviceType {
Playback,
Capture,
diff --git a/alc/backends/opensl.cpp b/alc/backends/opensl.cpp
index d9a7836e..28305288 100644
--- a/alc/backends/opensl.cpp
+++ b/alc/backends/opensl.cpp
@@ -33,9 +33,10 @@
#include "alcmain.h"
#include "alu.h"
+#include "compat.h"
+#include "endiantest.h"
#include "ringbuffer.h"
#include "threads.h"
-#include "compat.h"
#include <SLES/OpenSLES.h>
#include <SLES/OpenSLES_Android.h>
diff --git a/alc/backends/wave.cpp b/alc/backends/wave.cpp
index 67ed7e79..6ca2fab4 100644
--- a/alc/backends/wave.cpp
+++ b/alc/backends/wave.cpp
@@ -41,6 +41,7 @@
#include "alnumeric.h"
#include "alu.h"
#include "compat.h"
+#include "endiantest.h"
#include "logging.h"
#include "threads.h"
#include "vector.h"
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 */