From d367093c0616e561a14ca1c486aff99cde98f4be Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 26 Dec 2018 22:27:34 -0800 Subject: Use std::array for appropriate source and listener properties --- OpenAL32/Include/alListener.h | 18 ++++++++++-------- OpenAL32/Include/alSource.h | 13 ++++++++----- OpenAL32/Include/alu.h | 11 ++++++----- 3 files changed, 24 insertions(+), 18 deletions(-) (limited to 'OpenAL32/Include') diff --git a/OpenAL32/Include/alListener.h b/OpenAL32/Include/alListener.h index 490f1594..0aa28a46 100644 --- a/OpenAL32/Include/alListener.h +++ b/OpenAL32/Include/alListener.h @@ -1,6 +1,8 @@ #ifndef _AL_LISTENER_H_ #define _AL_LISTENER_H_ +#include + #include "AL/alc.h" #include "AL/al.h" #include "AL/alext.h" @@ -12,20 +14,20 @@ enum class DistanceModel; struct ALlistenerProps { - ALfloat Position[3]; - ALfloat Velocity[3]; - ALfloat Forward[3]; - ALfloat Up[3]; + std::array Position; + std::array Velocity; + std::array OrientAt; + std::array OrientUp; ALfloat Gain; std::atomic next; }; struct ALlistener { - ALfloat Position[3]{0.0f, 0.0f, 0.0f}; - ALfloat Velocity[3]{0.0f, 0.0f, 0.0f}; - ALfloat Forward[3]{0.0f, 0.0f, -1.0f}; - ALfloat Up[3]{0.0f, 1.0f, 0.0f}; + std::array Position{{0.0f, 0.0f, 0.0f}}; + std::array Velocity{{0.0f, 0.0f, 0.0f}}; + std::array OrientAt{{0.0f, 0.0f, -1.0f}}; + std::array OrientUp{{0.0f, 1.0f, 0.0f}}; ALfloat Gain{1.0f}; std::atomic_flag PropsClean{true}; diff --git a/OpenAL32/Include/alSource.h b/OpenAL32/Include/alSource.h index 381e0a9b..ac17fc0d 100644 --- a/OpenAL32/Include/alSource.h +++ b/OpenAL32/Include/alSource.h @@ -1,6 +1,8 @@ #ifndef _AL_SOURCE_H_ #define _AL_SOURCE_H_ +#include + #include "alMain.h" #include "alu.h" #include "hrtf.h" @@ -34,10 +36,11 @@ struct ALsource { ALfloat RefDistance; ALfloat MaxDistance; ALfloat RolloffFactor; - ALfloat Position[3]; - ALfloat Velocity[3]; - ALfloat Direction[3]; - ALfloat Orientation[2][3]; + std::array Position; + std::array Velocity; + std::array Direction; + std::array OrientAt; + std::array OrientUp; ALboolean HeadRelative; ALboolean Looping; DistanceModel mDistanceModel; @@ -57,7 +60,7 @@ struct ALsource { /* NOTE: Stereo pan angles are specified in radians, counter-clockwise * rather than clockwise. */ - ALfloat StereoPan[2]; + std::array StereoPan; ALfloat Radius; diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h index 775d34f6..7a378562 100644 --- a/OpenAL32/Include/alu.h +++ b/OpenAL32/Include/alu.h @@ -155,10 +155,11 @@ struct ALvoicePropsBase { ALfloat RefDistance; ALfloat MaxDistance; ALfloat RolloffFactor; - ALfloat Position[3]; - ALfloat Velocity[3]; - ALfloat Direction[3]; - ALfloat Orientation[2][3]; + std::array Position; + std::array Velocity; + std::array Direction; + std::array OrientAt; + std::array OrientUp; ALboolean HeadRelative; DistanceModel mDistanceModel; Resampler mResampler; @@ -174,7 +175,7 @@ struct ALvoicePropsBase { ALfloat RoomRolloffFactor; ALfloat DopplerFactor; - ALfloat StereoPan[2]; + std::array StereoPan; ALfloat Radius; -- cgit v1.2.3