19 typedef struct ALbufferlistitem
{
20 struct ALbuffer
*buffer
;
21 struct ALbufferlistitem
*volatile next
;
25 typedef struct ALvoice
{
26 struct ALsource
*volatile Source
;
28 /** Current target parameters used for mixing. */
33 /* If not 'moving', gain/coefficients are set directly without fading. */
38 ALuint Offset
; /* Number of output samples mixed since starting. */
40 alignas(16) ALfloat PrevSamples
[MAX_INPUT_CHANNELS
][MAX_PRE_SAMPLES
];
45 ALfloat (*Buffer
)[BUFFERSIZE
];
50 ALfloat (*Buffer
)[BUFFERSIZE
];
55 SendParams Send
[MAX_SENDS
];
59 struct ALsourceProps
{
60 ATOMIC(ALfloat
) Pitch
;
62 ATOMIC(ALfloat
) OuterGain
;
63 ATOMIC(ALfloat
) MinGain
;
64 ATOMIC(ALfloat
) MaxGain
;
65 ATOMIC(ALfloat
) InnerAngle
;
66 ATOMIC(ALfloat
) OuterAngle
;
67 ATOMIC(ALfloat
) RefDistance
;
68 ATOMIC(ALfloat
) MaxDistance
;
69 ATOMIC(ALfloat
) RollOffFactor
;
70 ATOMIC(ALfloat
) Position
[3];
71 ATOMIC(ALfloat
) Velocity
[3];
72 ATOMIC(ALfloat
) Direction
[3];
73 ATOMIC(ALfloat
) Orientation
[2][3];
74 ATOMIC(ALboolean
) HeadRelative
;
75 ATOMIC(ALboolean
) Looping
;
76 ATOMIC(enum DistanceModel
) DistanceModel
;
77 ATOMIC(ALboolean
) DirectChannels
;
79 ATOMIC(ALboolean
) DryGainHFAuto
;
80 ATOMIC(ALboolean
) WetGainAuto
;
81 ATOMIC(ALboolean
) WetGainHFAuto
;
82 ATOMIC(ALfloat
) OuterGainHF
;
84 ATOMIC(ALfloat
) AirAbsorptionFactor
;
85 ATOMIC(ALfloat
) RoomRolloffFactor
;
86 ATOMIC(ALfloat
) DopplerFactor
;
88 ATOMIC(ALfloat
) StereoPan
[2];
90 ATOMIC(ALfloat
) Radius
;
92 /** Direct filter and auxiliary send info. */
95 ATOMIC(ALfloat
) GainHF
;
96 ATOMIC(ALfloat
) HFReference
;
97 ATOMIC(ALfloat
) GainLF
;
98 ATOMIC(ALfloat
) LFReference
;
101 ATOMIC(struct ALeffectslot
*) Slot
;
102 ATOMIC(ALfloat
) Gain
;
103 ATOMIC(ALfloat
) GainHF
;
104 ATOMIC(ALfloat
) HFReference
;
105 ATOMIC(ALfloat
) GainLF
;
106 ATOMIC(ALfloat
) LFReference
;
109 ATOMIC(struct ALsourceProps
*) next
;
112 typedef struct ALsource
{
113 /** Source properties. */
123 ALfloat RollOffFactor
;
126 ALfloat Direction
[3];
127 ALfloat Orientation
[2][3];
128 ALboolean HeadRelative
;
130 enum DistanceModel DistanceModel
;
131 ALboolean DirectChannels
;
133 ALboolean DryGainHFAuto
;
134 ALboolean WetGainAuto
;
135 ALboolean WetGainHFAuto
;
138 ALfloat AirAbsorptionFactor
;
139 ALfloat RoomRolloffFactor
;
140 ALfloat DopplerFactor
;
142 /* NOTE: Stereo pan angles are specified in radians, counter-clockwise
143 * rather than clockwise.
145 ALfloat StereoPan
[2];
149 /** Direct filter and auxiliary send info. */
158 struct ALeffectslot
*Slot
;
167 * Last user-specified offset, and the offset type (bytes, samples, or
173 /** Source type (static, streaming, or undetermined) */
176 /** Source state (initial, playing, paused, or stopped) */
180 /** Source Buffer Queue info. */
182 ATOMIC(ALbufferlistitem
*) queue
;
183 ATOMIC(ALbufferlistitem
*) current_buffer
;
186 * Source offset in samples, relative to the currently playing buffer, NOT
187 * the whole queue, and the fractional (fixed-point) offset to the next
190 ATOMIC(ALuint
) position
;
191 ATOMIC(ALuint
) position_fraction
;
193 /** Current buffer sample info. */
197 ATOMIC(struct ALsourceProps
*) Update
;
198 ATOMIC(struct ALsourceProps
*) FreeList
;
204 inline void LockSourcesRead(ALCcontext
*context
)
205 { LockUIntMapRead(&context
->SourceMap
); }
206 inline void UnlockSourcesRead(ALCcontext
*context
)
207 { UnlockUIntMapRead(&context
->SourceMap
); }
208 inline void LockSourcesWrite(ALCcontext
*context
)
209 { LockUIntMapWrite(&context
->SourceMap
); }
210 inline void UnlockSourcesWrite(ALCcontext
*context
)
211 { UnlockUIntMapWrite(&context
->SourceMap
); }
213 inline struct ALsource
*LookupSource(ALCcontext
*context
, ALuint id
)
214 { return (struct ALsource
*)LookupUIntMapKeyNoLock(&context
->SourceMap
, id
); }
215 inline struct ALsource
*RemoveSource(ALCcontext
*context
, ALuint id
)
216 { return (struct ALsource
*)RemoveUIntMapKeyNoLock(&context
->SourceMap
, id
); }
218 void UpdateAllSourceProps(ALCcontext
*context
);
219 ALvoid
SetSourceState(ALsource
*Source
, ALCcontext
*Context
, ALenum state
);
220 ALboolean
ApplyOffset(ALsource
*Source
);
222 ALvoid
ReleaseALSources(ALCcontext
*Context
);