10 #define DEFAULT_SENDS 2
21 typedef struct ALbufferlistitem
{
22 struct ALbuffer
*buffer
;
23 struct ALbufferlistitem
*volatile next
;
27 struct ALsourceProps
{
28 ATOMIC(struct ALsourceProps
*) next
;
39 ALfloat RollOffFactor
;
43 ALfloat Orientation
[2][3];
44 ALboolean HeadRelative
;
45 enum DistanceModel DistanceModel
;
46 ALboolean DirectChannels
;
48 ALboolean DryGainHFAuto
;
49 ALboolean WetGainAuto
;
50 ALboolean WetGainHFAuto
;
53 ALfloat AirAbsorptionFactor
;
54 ALfloat RoomRolloffFactor
;
55 ALfloat DopplerFactor
;
61 /** Direct filter and auxiliary send info. */
70 struct ALeffectslot
*Slot
;
80 typedef struct ALvoice
{
81 struct ALsourceProps
*Props
;
83 ATOMIC(struct ALsource
*) Source
;
86 /* Current buffer queue item being played. */
87 ATOMIC(ALbufferlistitem
*) current_buffer
;
90 * Source offset in samples, relative to the currently playing buffer, NOT
91 * the whole queue, and the fractional (fixed-point) offset to the next
94 ATOMIC(ALuint
) position
;
95 ATOMIC(ALuint
) position_fraction
;
98 * Number of channels and bytes-per-sample for the attached source's
104 /** Current target parameters used for mixing. */
107 /* If not 'moving', gain/coefficients are set directly without fading. */
112 ALuint Offset
; /* Number of output samples mixed since starting. */
114 alignas(16) ALfloat PrevSamples
[MAX_INPUT_CHANNELS
][MAX_PRE_SAMPLES
];
116 InterpState ResampleState
;
119 DirectParams Params
[MAX_INPUT_CHANNELS
];
121 ALfloat (*Buffer
)[BUFFERSIZE
];
126 SendParams Params
[MAX_INPUT_CHANNELS
];
128 ALfloat (*Buffer
)[BUFFERSIZE
];
134 typedef struct ALsource
{
135 /** Source properties. */
145 ALfloat RollOffFactor
;
148 ALfloat Direction
[3];
149 ALfloat Orientation
[2][3];
150 ALboolean HeadRelative
;
151 enum DistanceModel DistanceModel
;
152 ALboolean DirectChannels
;
154 ALboolean DryGainHFAuto
;
155 ALboolean WetGainAuto
;
156 ALboolean WetGainHFAuto
;
159 ALfloat AirAbsorptionFactor
;
160 ALfloat RoomRolloffFactor
;
161 ALfloat DopplerFactor
;
163 /* NOTE: Stereo pan angles are specified in radians, counter-clockwise
164 * rather than clockwise.
166 ALfloat StereoPan
[2];
170 /** Direct filter and auxiliary send info. */
179 struct ALeffectslot
*Slot
;
188 * Last user-specified offset, and the offset type (bytes, samples, or
194 /** Source type (static, streaming, or undetermined) */
197 /** Source state (initial, playing, paused, or stopped) */
198 ATOMIC(ALenum
) state
;
201 /** Source Buffer Queue head. */
203 ATOMIC(ALbufferlistitem
*) queue
;
205 ATOMIC(ALboolean
) looping
;
209 ATOMIC(struct ALsourceProps
*) Update
;
210 ATOMIC(struct ALsourceProps
*) FreeList
;
216 inline void LockSourcesRead(ALCcontext
*context
)
217 { LockUIntMapRead(&context
->SourceMap
); }
218 inline void UnlockSourcesRead(ALCcontext
*context
)
219 { UnlockUIntMapRead(&context
->SourceMap
); }
220 inline void LockSourcesWrite(ALCcontext
*context
)
221 { LockUIntMapWrite(&context
->SourceMap
); }
222 inline void UnlockSourcesWrite(ALCcontext
*context
)
223 { UnlockUIntMapWrite(&context
->SourceMap
); }
225 inline struct ALsource
*LookupSource(ALCcontext
*context
, ALuint id
)
226 { return (struct ALsource
*)LookupUIntMapKeyNoLock(&context
->SourceMap
, id
); }
227 inline struct ALsource
*RemoveSource(ALCcontext
*context
, ALuint id
)
228 { return (struct ALsource
*)RemoveUIntMapKeyNoLock(&context
->SourceMap
, id
); }
230 void UpdateAllSourceProps(ALCcontext
*context
);
231 ALvoid
SetSourceState(ALsource
*Source
, ALCcontext
*Context
, ALenum state
);
232 ALboolean
ApplyOffset(ALsource
*Source
, ALvoice
*voice
);
235 ALvoid
ReleaseALSources(ALCcontext
*Context
);