14 #define SRC_HISTORY_BITS (6)
15 #define SRC_HISTORY_LENGTH (1<<SRC_HISTORY_BITS)
16 #define SRC_HISTORY_MASK (SRC_HISTORY_LENGTH-1)
18 extern enum Resampler DefaultResampler
;
20 extern const ALsizei ResamplerPadding
[ResamplerMax
];
21 extern const ALsizei ResamplerPrePadding
[ResamplerMax
];
24 typedef struct ALbufferlistitem
26 struct ALbuffer
*buffer
;
27 struct ALbufferlistitem
*next
;
28 struct ALbufferlistitem
*prev
;
31 typedef struct HrtfState
{
34 ALIGN(16) ALfloat History
[MaxChannels
][SRC_HISTORY_LENGTH
];
35 ALIGN(16) ALfloat Values
[MaxChannels
][HRIR_LENGTH
][2];
39 typedef struct HrtfParams
{
42 ALIGN(16) ALfloat Coeffs
[MaxChannels
][HRIR_LENGTH
][2];
43 ALIGN(16) ALfloat CoeffStep
[HRIR_LENGTH
][2];
44 ALuint Delay
[MaxChannels
][2];
49 typedef struct DirectParams
{
50 ALfloat (*OutBuffer
)[BUFFERSIZE
];
51 ALfloat
*ClickRemoval
;
52 ALfloat
*PendingClicks
;
57 /* A mixing matrix. First subscript is the channel number of the input data
58 * (regardless of channel configuration) and the second is the channel
59 * target (eg. FrontLeft). Not used with HRTF. */
60 ALfloat Gains
[MaxChannels
][MaxChannels
];
62 /* A low-pass filter, using 2 chained one-pole filters. */
64 ALfloat history
[MaxChannels
*2];
67 typedef struct SendParams
{
68 struct ALeffectslot
*Slot
;
70 /* Gain control, which applies to all input channels to a single (mono)
74 /* A low-pass filter, using 2 chained one-pole filters. */
76 ALfloat history
[MaxChannels
*2];
80 typedef struct ALsource
82 /** Source properties. */
83 volatile ALfloat Pitch
;
84 volatile ALfloat Gain
;
85 volatile ALfloat OuterGain
;
86 volatile ALfloat MinGain
;
87 volatile ALfloat MaxGain
;
88 volatile ALfloat InnerAngle
;
89 volatile ALfloat OuterAngle
;
90 volatile ALfloat RefDistance
;
91 volatile ALfloat MaxDistance
;
92 volatile ALfloat RollOffFactor
;
93 volatile ALfloat Position
[3];
94 volatile ALfloat Velocity
[3];
95 volatile ALfloat Orientation
[3];
96 volatile ALboolean HeadRelative
;
97 volatile ALboolean Looping
;
98 volatile enum DistanceModel DistanceModel
;
99 volatile ALboolean DirectChannels
;
101 volatile ALboolean DryGainHFAuto
;
102 volatile ALboolean WetGainAuto
;
103 volatile ALboolean WetGainHFAuto
;
104 volatile ALfloat OuterGainHF
;
106 volatile ALfloat AirAbsorptionFactor
;
107 volatile ALfloat RoomRolloffFactor
;
108 volatile ALfloat DopplerFactor
;
110 enum Resampler Resampler
;
113 * Last user-specified offset, and the offset type (bytes, samples, or
119 /** Source type (static, streaming, or undetermined) */
120 volatile ALint SourceType
;
122 /** Source state (initial, playing, paused, or stopped) */
123 volatile ALenum state
;
127 * Source offset in samples, relative to the currently playing buffer, NOT
128 * the whole queue, and the fractional (fixed-point) offset to the next
132 ALuint position_fraction
;
134 /** Source Buffer Queue info. */
135 ALbufferlistitem
*queue
;
136 ALuint BuffersInQueue
;
137 ALuint BuffersPlayed
;
139 /** Current buffer sample info. */
143 /** Direct filter and auxiliary send info. */
145 ALfloat DirectGainHF
;
148 struct ALeffectslot
*Slot
;
156 /** Current target parameters used for mixing. */
158 ResamplerFunc Resample
;
166 SendParams Send
[MAX_SENDS
];
168 /** Source needs to update its mixing parameters. */
169 volatile ALenum NeedsUpdate
;
171 /** Method to update mixing parameters. */
172 ALvoid (*Update
)(struct ALsource
*self
, const ALCcontext
*context
);
177 #define ALsource_Update(s,a) ((s)->Update(s,a))
179 ALvoid
SetSourceState(ALsource
*Source
, ALCcontext
*Context
, ALenum state
);
180 ALboolean
ApplyOffset(ALsource
*Source
);
182 ALvoid
ReleaseALSources(ALCcontext
*Context
);