#ifndef AL_LISTENER_H #define AL_LISTENER_H #include #include #include "AL/al.h" #include "AL/alc.h" #include "AL/efx.h" #include "almalloc.h" #include "vecmat.h" enum class DistanceModel; struct ALlistenerProps { std::array Position; std::array Velocity; std::array OrientAt; std::array OrientUp; ALfloat Gain; ALfloat MetersPerUnit; std::atomic next; DEF_NEWDEL(ALlistenerProps) }; struct ALlistener { 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}; ALfloat mMetersPerUnit{AL_DEFAULT_METERS_PER_UNIT}; std::atomic_flag PropsClean; struct { /* Pointer to the most recent property values that are awaiting an * update. */ std::atomic Update{nullptr}; alu::Matrix Matrix; alu::Vector Velocity; ALfloat Gain; ALfloat MetersPerUnit; ALfloat DopplerFactor; ALfloat SpeedOfSound; /* in units per sec! */ ALboolean SourceDistanceModel; DistanceModel mDistanceModel; } Params; ALlistener() { PropsClean.test_and_set(std::memory_order_relaxed); } }; void UpdateListenerProps(ALCcontext *context); #endif