19 typedef struct ALbufferlistitem
{
20 struct ALbuffer
*buffer
;
21 struct ALbufferlistitem
*volatile next
;
25 struct ALsourceProps
{
26 ATOMIC(ALfloat
) Pitch
;
28 ATOMIC(ALfloat
) OuterGain
;
29 ATOMIC(ALfloat
) MinGain
;
30 ATOMIC(ALfloat
) MaxGain
;
31 ATOMIC(ALfloat
) InnerAngle
;
32 ATOMIC(ALfloat
) OuterAngle
;
33 ATOMIC(ALfloat
) RefDistance
;
34 ATOMIC(ALfloat
) MaxDistance
;
35 ATOMIC(ALfloat
) RollOffFactor
;
36 ATOMIC(ALfloat
) Position
[3];
37 ATOMIC(ALfloat
) Velocity
[3];
38 ATOMIC(ALfloat
) Direction
[3];
39 ATOMIC(ALfloat
) Orientation
[2][3];
40 ATOMIC(ALboolean
) HeadRelative
;
41 ATOMIC(enum DistanceModel
) DistanceModel
;
42 ATOMIC(ALboolean
) DirectChannels
;
44 ATOMIC(ALboolean
) DryGainHFAuto
;
45 ATOMIC(ALboolean
) WetGainAuto
;
46 ATOMIC(ALboolean
) WetGainHFAuto
;
47 ATOMIC(ALfloat
) OuterGainHF
;
49 ATOMIC(ALfloat
) AirAbsorptionFactor
;
50 ATOMIC(ALfloat
) RoomRolloffFactor
;
51 ATOMIC(ALfloat
) DopplerFactor
;
53 ATOMIC(ALfloat
) StereoPan
[2];
55 ATOMIC(ALfloat
) Radius
;
57 /** Direct filter and auxiliary send info. */
60 ATOMIC(ALfloat
) GainHF
;
61 ATOMIC(ALfloat
) HFReference
;
62 ATOMIC(ALfloat
) GainLF
;
63 ATOMIC(ALfloat
) LFReference
;
66 ATOMIC(struct ALeffectslot
*) Slot
;
68 ATOMIC(ALfloat
) GainHF
;
69 ATOMIC(ALfloat
) HFReference
;
70 ATOMIC(ALfloat
) GainLF
;
71 ATOMIC(ALfloat
) LFReference
;
74 ATOMIC(struct ALsourceProps
*) next
;
78 typedef struct ALvoice
{
79 struct ALsourceProps Props
;
81 struct ALsource
*Source
;
83 /** Current target parameters used for mixing. */
86 /* If not 'moving', gain/coefficients are set directly without fading. */
91 ALuint Offset
; /* Number of output samples mixed since starting. */
93 alignas(16) ALfloat PrevSamples
[MAX_INPUT_CHANNELS
][MAX_PRE_SAMPLES
];
98 ALfloat (*Buffer
)[BUFFERSIZE
];
103 ALfloat (*Buffer
)[BUFFERSIZE
];
105 } SendOut
[MAX_SENDS
];
109 SendParams Send
[MAX_SENDS
];
110 } Chan
[MAX_INPUT_CHANNELS
];
114 typedef struct ALsource
{
115 /** Source properties. */
125 ALfloat RollOffFactor
;
128 ALfloat Direction
[3];
129 ALfloat Orientation
[2][3];
130 ALboolean HeadRelative
;
131 enum DistanceModel DistanceModel
;
132 ALboolean DirectChannels
;
134 ALboolean DryGainHFAuto
;
135 ALboolean WetGainAuto
;
136 ALboolean WetGainHFAuto
;
139 ALfloat AirAbsorptionFactor
;
140 ALfloat RoomRolloffFactor
;
141 ALfloat DopplerFactor
;
143 /* NOTE: Stereo pan angles are specified in radians, counter-clockwise
144 * rather than clockwise.
146 ALfloat StereoPan
[2];
150 /** Direct filter and auxiliary send info. */
159 struct ALeffectslot
*Slot
;
168 * Last user-specified offset, and the offset type (bytes, samples, or
174 /** Source type (static, streaming, or undetermined) */
177 /** Source state (initial, playing, paused, or stopped) */
181 /** Source Buffer Queue info. */
183 ATOMIC(ALbufferlistitem
*) queue
;
184 ATOMIC(ALbufferlistitem
*) current_buffer
;
187 * Source offset in samples, relative to the currently playing buffer, NOT
188 * the whole queue, and the fractional (fixed-point) offset to the next
191 ATOMIC(ALuint
) position
;
192 ATOMIC(ALuint
) position_fraction
;
194 ATOMIC(ALboolean
) looping
;
196 /** Current buffer sample info. */
202 ATOMIC(struct ALsourceProps
*) Update
;
203 ATOMIC(struct ALsourceProps
*) FreeList
;
209 inline void LockSourcesRead(ALCcontext
*context
)
210 { LockUIntMapRead(&context
->SourceMap
); }
211 inline void UnlockSourcesRead(ALCcontext
*context
)
212 { UnlockUIntMapRead(&context
->SourceMap
); }
213 inline void LockSourcesWrite(ALCcontext
*context
)
214 { LockUIntMapWrite(&context
->SourceMap
); }
215 inline void UnlockSourcesWrite(ALCcontext
*context
)
216 { UnlockUIntMapWrite(&context
->SourceMap
); }
218 inline struct ALsource
*LookupSource(ALCcontext
*context
, ALuint id
)
219 { return (struct ALsource
*)LookupUIntMapKeyNoLock(&context
->SourceMap
, id
); }
220 inline struct ALsource
*RemoveSource(ALCcontext
*context
, ALuint id
)
221 { return (struct ALsource
*)RemoveUIntMapKeyNoLock(&context
->SourceMap
, id
); }
223 void UpdateAllSourceProps(ALCcontext
*context
);
224 ALvoid
SetSourceState(ALsource
*Source
, ALCcontext
*Context
, ALenum state
);
225 ALboolean
ApplyOffset(ALsource
*Source
);
227 ALvoid
ReleaseALSources(ALCcontext
*Context
);