openal-soft/al/listener.h

67 lines
1.4 KiB
C
Raw Normal View History

2019-07-28 21:29:59 -07:00
#ifndef AL_LISTENER_H
#define AL_LISTENER_H
2007-11-13 18:02:18 -08:00
#include <array>
2019-07-28 21:29:59 -07:00
#include <atomic>
#include "AL/al.h"
2019-07-28 21:29:59 -07:00
#include "AL/alc.h"
2019-08-05 22:40:19 -07:00
#include "AL/efx.h"
2019-08-13 20:33:44 -07:00
#include "almalloc.h"
#include "vecmat.h"
2007-11-13 18:02:18 -08:00
enum class DistanceModel;
2007-11-13 18:02:18 -08:00
struct ALlistenerProps {
std::array<float,3> Position;
std::array<float,3> Velocity;
std::array<float,3> OrientAt;
std::array<float,3> OrientUp;
float Gain;
float MetersPerUnit;
2018-11-26 14:48:26 -08:00
std::atomic<ALlistenerProps*> next;
2019-08-13 20:33:44 -07:00
DEF_NEWDEL(ALlistenerProps)
};
struct ALlistener {
std::array<float,3> Position{{0.0f, 0.0f, 0.0f}};
std::array<float,3> Velocity{{0.0f, 0.0f, 0.0f}};
std::array<float,3> OrientAt{{0.0f, 0.0f, -1.0f}};
std::array<float,3> OrientUp{{0.0f, 1.0f, 0.0f}};
float Gain{1.0f};
float mMetersPerUnit{AL_DEFAULT_METERS_PER_UNIT};
2012-10-09 06:19:36 -07:00
std::atomic_flag PropsClean;
2012-10-09 06:19:36 -07:00
struct {
/* Pointer to the most recent property values that are awaiting an
* update.
*/
std::atomic<ALlistenerProps*> Update{nullptr};
alu::Matrix Matrix;
alu::Vector Velocity;
float Gain;
float MetersPerUnit;
float DopplerFactor;
float SpeedOfSound; /* in units per sec! */
2020-03-28 15:37:34 -07:00
bool SourceDistanceModel;
DistanceModel mDistanceModel;
2012-10-09 06:19:36 -07:00
} Params;
ALlistener() { PropsClean.test_and_set(std::memory_order_relaxed); }
DISABLE_ALLOC()
};
2007-11-13 18:02:18 -08:00
void UpdateListenerProps(ALCcontext *context);
2007-11-13 18:02:18 -08:00
#endif