12 #include "alcontext.h"
14 #include "alnumeric.h"
22 #define DEFAULT_SENDS 2
24 #define INVALID_VOICE_IDX static_cast<ALuint>(-1)
26 struct ALbufferlistitem
{
27 std::atomic
<ALbufferlistitem
*> mNext
{nullptr};
28 ALuint mSampleLen
{0u};
29 ALbuffer
*mBuffer
{nullptr};
31 DEF_NEWDEL(ALbufferlistitem
)
36 /** Source properties. */
46 ALfloat RolloffFactor
;
47 std::array
<ALfloat
,3> Position
;
48 std::array
<ALfloat
,3> Velocity
;
49 std::array
<ALfloat
,3> Direction
;
50 std::array
<ALfloat
,3> OrientAt
;
51 std::array
<ALfloat
,3> OrientUp
;
54 DistanceModel mDistanceModel
;
57 SpatializeMode mSpatialize
;
64 ALfloat AirAbsorptionFactor
;
65 ALfloat RoomRolloffFactor
;
66 ALfloat DopplerFactor
;
68 /* NOTE: Stereo pan angles are specified in radians, counter-clockwise
69 * rather than clockwise.
71 std::array
<ALfloat
,2> StereoPan
;
75 /** Direct filter and auxiliary send info. */
91 al::vector
<SendData
> Send
;
94 * Last user-specified offset, and the offset type (bytes, samples, or
98 ALenum OffsetType
{AL_NONE
};
100 /** Source type (static, streaming, or undetermined) */
101 ALenum SourceType
{AL_UNDETERMINED
};
103 /** Source state (initial, playing, paused, or stopped) */
104 ALenum state
{AL_INITIAL
};
106 /** Source Buffer Queue head. */
107 ALbufferlistitem
*queue
{nullptr};
109 std::atomic_flag PropsClean
;
111 /* Index into the context's Voices array. Lazily updated, only checked and
112 * reset when looking up the voice.
114 ALuint VoiceIdx
{INVALID_VOICE_IDX
};
120 ALsource(ALuint num_sends
);
123 ALsource(const ALsource
&) = delete;
124 ALsource
& operator=(const ALsource
&) = delete;
127 void UpdateAllSourceProps(ALCcontext
*context
);