aboutsummaryrefslogtreecommitdiffstats
path: root/al/alListener.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-07-29 15:40:17 -0700
committerChris Robinson <[email protected]>2019-07-29 15:40:17 -0700
commit0a26bab14e0100b883f59958f3ce417888cebc62 (patch)
tree2ef9bb6a2f100366eed14bcbaf51edecab6211ca /al/alListener.h
parent8ccb7604d30147583fda134e220807f3dc2f07e5 (diff)
Rename the OpenAL32 directory to al
Diffstat (limited to 'al/alListener.h')
-rw-r--r--al/alListener.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/al/alListener.h b/al/alListener.h
new file mode 100644
index 00000000..a71db9f8
--- /dev/null
+++ b/al/alListener.h
@@ -0,0 +1,58 @@
+#ifndef AL_LISTENER_H
+#define AL_LISTENER_H
+
+#include <array>
+#include <atomic>
+
+#include "AL/al.h"
+#include "AL/alc.h"
+
+#include "vecmat.h"
+
+enum class DistanceModel;
+
+
+struct ALlistenerProps {
+ std::array<ALfloat,3> Position;
+ std::array<ALfloat,3> Velocity;
+ std::array<ALfloat,3> OrientAt;
+ std::array<ALfloat,3> OrientUp;
+ ALfloat Gain;
+
+ std::atomic<ALlistenerProps*> next;
+};
+
+struct ALlistener {
+ std::array<ALfloat,3> Position{{0.0f, 0.0f, 0.0f}};
+ std::array<ALfloat,3> Velocity{{0.0f, 0.0f, 0.0f}};
+ std::array<ALfloat,3> OrientAt{{0.0f, 0.0f, -1.0f}};
+ std::array<ALfloat,3> OrientUp{{0.0f, 1.0f, 0.0f}};
+ ALfloat Gain{1.0f};
+
+ std::atomic_flag PropsClean;
+
+ /* Pointer to the most recent property values that are awaiting an update.
+ */
+ std::atomic<ALlistenerProps*> Update{nullptr};
+
+ struct {
+ alu::Matrix Matrix;
+ alu::Vector Velocity;
+
+ ALfloat Gain;
+ ALfloat MetersPerUnit;
+
+ ALfloat DopplerFactor;
+ ALfloat SpeedOfSound; /* in units per sec! */
+ ALfloat ReverbSpeedOfSound; /* in meters per sec! */
+
+ ALboolean SourceDistanceModel;
+ DistanceModel mDistanceModel;
+ } Params;
+
+ ALlistener() { PropsClean.test_and_set(std::memory_order_relaxed); }
+};
+
+void UpdateListenerProps(ALCcontext *context);
+
+#endif