🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.3 KiB

  1. #ifndef _AL_LISTENER_H_
  2. #define _AL_LISTENER_H_
  3. #include <array>
  4. #include "AL/alc.h"
  5. #include "AL/al.h"
  6. #include "AL/alext.h"
  7. #include "atomic.h"
  8. #include "vecmat.h"
  9. enum class DistanceModel;
  10. struct ALlistenerProps {
  11. std::array<ALfloat,3> Position;
  12. std::array<ALfloat,3> Velocity;
  13. std::array<ALfloat,3> OrientAt;
  14. std::array<ALfloat,3> OrientUp;
  15. ALfloat Gain;
  16. std::atomic<ALlistenerProps*> next;
  17. };
  18. struct ALlistener {
  19. std::array<ALfloat,3> Position{{0.0f, 0.0f, 0.0f}};
  20. std::array<ALfloat,3> Velocity{{0.0f, 0.0f, 0.0f}};
  21. std::array<ALfloat,3> OrientAt{{0.0f, 0.0f, -1.0f}};
  22. std::array<ALfloat,3> OrientUp{{0.0f, 1.0f, 0.0f}};
  23. ALfloat Gain{1.0f};
  24. std::atomic_flag PropsClean;
  25. /* Pointer to the most recent property values that are awaiting an update.
  26. */
  27. std::atomic<ALlistenerProps*> Update{nullptr};
  28. struct {
  29. alu::Matrix Matrix;
  30. alu::Vector Velocity;
  31. ALfloat Gain;
  32. ALfloat MetersPerUnit;
  33. ALfloat DopplerFactor;
  34. ALfloat SpeedOfSound; /* in units per sec! */
  35. ALfloat ReverbSpeedOfSound; /* in meters per sec! */
  36. ALboolean SourceDistanceModel;
  37. DistanceModel mDistanceModel;
  38. } Params;
  39. ALlistener() { PropsClean.test_and_set(std::memory_order_relaxed); }
  40. };
  41. void UpdateListenerProps(ALCcontext *context);
  42. #endif