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