openal-soft/al/listener.h
Chris Robinson 29cf7ebb75 Make an inverted atomic flag type and use it
The inverted atomic flag replaces test_and_set+clear with test_and_clear+set,
essentially inverting the flag status. This makes more logical sense for
flagging dirty state, which is less confusing than flagging clean state. The
one caveat is ATOMIC_FLAG_INIT (or default construction in C++20) initializes
the state to true rather than false.
2021-04-15 15:17:04 -07:00

33 lines
692 B
C++

#ifndef AL_LISTENER_H
#define AL_LISTENER_H
#include <array>
#include <atomic>
#include "AL/al.h"
#include "AL/alc.h"
#include "AL/efx.h"
#include "almalloc.h"
#include "atomic.h"
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};
al::atomic_invflag mPropsDirty;
ALlistener() { mPropsDirty.test_and_clear(std::memory_order_relaxed); }
DISABLE_ALLOC()
};
void UpdateListenerProps(ALCcontext *context);
#endif