Some cleanup in alspan.h
[openal-soft.git] / al / listener.h
blobe30f45c343cb5b9d6ea6655c377cd5deff5b297b
1 #ifndef AL_LISTENER_H
2 #define AL_LISTENER_H
4 #include <array>
5 #include <atomic>
7 #include "AL/al.h"
8 #include "AL/alc.h"
9 #include "AL/efx.h"
11 #include "almalloc.h"
12 #include "vecmat.h"
14 enum class DistanceModel;
17 struct ALlistenerProps {
18 std::array<float,3> Position;
19 std::array<float,3> Velocity;
20 std::array<float,3> OrientAt;
21 std::array<float,3> OrientUp;
22 float Gain;
23 float MetersPerUnit;
25 std::atomic<ALlistenerProps*> next;
27 DEF_NEWDEL(ALlistenerProps)
30 struct ALlistener {
31 std::array<float,3> Position{{0.0f, 0.0f, 0.0f}};
32 std::array<float,3> Velocity{{0.0f, 0.0f, 0.0f}};
33 std::array<float,3> OrientAt{{0.0f, 0.0f, -1.0f}};
34 std::array<float,3> OrientUp{{0.0f, 1.0f, 0.0f}};
35 float Gain{1.0f};
36 float mMetersPerUnit{AL_DEFAULT_METERS_PER_UNIT};
38 std::atomic_flag PropsClean;
40 struct {
41 /* Pointer to the most recent property values that are awaiting an
42 * update.
44 std::atomic<ALlistenerProps*> Update{nullptr};
46 alu::Matrix Matrix;
47 alu::Vector Velocity;
49 float Gain;
50 float MetersPerUnit;
52 float DopplerFactor;
53 float SpeedOfSound; /* in units per sec! */
55 bool SourceDistanceModel;
56 DistanceModel mDistanceModel;
57 } Params;
59 ALlistener() { PropsClean.test_and_set(std::memory_order_relaxed); }
61 DISABLE_ALLOC()
64 void UpdateListenerProps(ALCcontext *context);
66 #endif