openal-soft/al/listener.h

65 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<ALfloat,3> Position;
std::array<ALfloat,3> Velocity;
std::array<ALfloat,3> OrientAt;
std::array<ALfloat,3> OrientUp;
2017-03-08 03:38:28 -08:00
ALfloat Gain;
ALfloat 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<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};
ALfloat 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;
ALfloat Gain;
ALfloat MetersPerUnit;
ALfloat DopplerFactor;
ALfloat SpeedOfSound; /* in units per sec! */
ALboolean SourceDistanceModel;
DistanceModel mDistanceModel;
2012-10-09 06:19:36 -07:00
} Params;
ALlistener() { PropsClean.test_and_set(std::memory_order_relaxed); }
};
2007-11-13 18:02:18 -08:00
void UpdateListenerProps(ALCcontext *context);
2007-11-13 18:02:18 -08:00
#endif