2007-11-13 18:02:18 -08:00
|
|
|
#ifndef _AL_LISTENER_H_
|
|
|
|
#define _AL_LISTENER_H_
|
|
|
|
|
2018-11-17 23:21:37 -08:00
|
|
|
#include "AL/alc.h"
|
|
|
|
#include "AL/al.h"
|
|
|
|
#include "AL/alext.h"
|
|
|
|
|
|
|
|
#include "atomic.h"
|
|
|
|
#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 {
|
2017-03-08 03:38:28 -08:00
|
|
|
ALfloat Position[3];
|
|
|
|
ALfloat Velocity[3];
|
|
|
|
ALfloat Forward[3];
|
|
|
|
ALfloat Up[3];
|
|
|
|
ALfloat Gain;
|
2016-05-11 18:40:17 -07:00
|
|
|
|
2018-11-26 14:48:26 -08:00
|
|
|
std::atomic<ALlistenerProps*> next;
|
2016-05-11 18:40:17 -07:00
|
|
|
};
|
|
|
|
|
2018-11-17 23:21:37 -08:00
|
|
|
struct ALlistener {
|
2018-11-18 05:40:00 -08:00
|
|
|
ALfloat Position[3]{0.0f, 0.0f, 0.0f};
|
|
|
|
ALfloat Velocity[3]{0.0f, 0.0f, 0.0f};
|
|
|
|
ALfloat Forward[3]{0.0f, 0.0f, -1.0f};
|
|
|
|
ALfloat Up[3]{0.0f, 1.0f, 0.0f};
|
|
|
|
ALfloat Gain{1.0f};
|
2012-10-09 06:19:36 -07:00
|
|
|
|
2018-11-20 10:45:01 -08:00
|
|
|
std::atomic_flag PropsClean{true};
|
2017-09-27 09:36:34 -07:00
|
|
|
|
2016-05-11 18:40:17 -07:00
|
|
|
/* Pointer to the most recent property values that are awaiting an update.
|
|
|
|
*/
|
2018-11-26 14:48:26 -08:00
|
|
|
std::atomic<ALlistenerProps*> Update{nullptr};
|
2016-05-11 18:40:17 -07:00
|
|
|
|
2012-10-09 06:19:36 -07:00
|
|
|
struct {
|
2016-05-16 18:28:46 -07:00
|
|
|
aluMatrixf Matrix;
|
2015-11-11 08:19:33 -08:00
|
|
|
aluVector Velocity;
|
2016-05-09 11:26:49 -07:00
|
|
|
|
|
|
|
ALfloat Gain;
|
|
|
|
ALfloat MetersPerUnit;
|
|
|
|
|
|
|
|
ALfloat DopplerFactor;
|
2017-09-22 05:42:04 -07:00
|
|
|
ALfloat SpeedOfSound; /* in units per sec! */
|
|
|
|
ALfloat ReverbSpeedOfSound; /* in meters per sec! */
|
2016-08-23 19:17:17 -07:00
|
|
|
|
|
|
|
ALboolean SourceDistanceModel;
|
2018-11-18 03:39:32 -08:00
|
|
|
DistanceModel mDistanceModel;
|
2012-10-09 06:19:36 -07:00
|
|
|
} Params;
|
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
|