Don't update context and listener props unnecessarily
[openal-soft.git] / OpenAL32 / Include / alListener.h
blob8b212d473368735b05bc513fac96ffe0c7e9608a
1 #ifndef _AL_LISTENER_H_
2 #define _AL_LISTENER_H_
4 #include "alMain.h"
5 #include "alu.h"
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
11 struct ALcontextProps {
12 ALfloat DopplerFactor;
13 ALfloat DopplerVelocity;
14 ALfloat SpeedOfSound;
15 ALboolean SourceDistanceModel;
16 enum DistanceModel DistanceModel;
17 ALfloat MetersPerUnit;
19 ATOMIC(struct ALcontextProps*) next;
22 struct ALlistenerProps {
23 ALfloat Position[3];
24 ALfloat Velocity[3];
25 ALfloat Forward[3];
26 ALfloat Up[3];
27 ALfloat Gain;
29 ATOMIC(struct ALlistenerProps*) next;
32 typedef struct ALlistener {
33 alignas(16) ALfloat Position[3];
34 ALfloat Velocity[3];
35 ALfloat Forward[3];
36 ALfloat Up[3];
37 ALfloat Gain;
39 ATOMIC_FLAG PropsClean;
41 /* Pointer to the most recent property values that are awaiting an update.
43 ATOMIC(struct ALlistenerProps*) Update;
45 /* A linked list of unused property containers, free to use for future
46 * updates.
48 ATOMIC(struct ALlistenerProps*) FreeList;
50 struct {
51 aluMatrixf Matrix;
52 aluVector Velocity;
54 ALfloat Gain;
55 ALfloat MetersPerUnit;
57 ALfloat DopplerFactor;
58 ALfloat SpeedOfSound; /* in units per sec! */
59 ALfloat ReverbSpeedOfSound; /* in meters per sec! */
61 ALboolean SourceDistanceModel;
62 enum DistanceModel DistanceModel;
63 } Params;
64 } ALlistener;
66 void UpdateListenerProps(ALCcontext *context);
68 #ifdef __cplusplus
70 #endif
72 #endif