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
;
59 /* A mixing matrix. First subscript is the channel number of the input data
60 * (regardless of channel configuration) and the second is the channel
61 * target (eg. FrontLeft). Not used with HRTF. */
62 ALfloat Gains
[MaxChannels
][MaxChannels
];
64 /* A low-pass filter, using 2 chained one-pole filters. */
66 ALfloat history
[MaxChannels
*2];
69 typedef struct SendParams
{
70 struct ALeffectslot
*Slot
;
72 /* Gain control, which applies to all input channels to a single (mono)
76 /* A low-pass filter, using 2 chained one-pole filters. */
78 ALfloat history
[MaxChannels
*2];
82 typedef struct ALsource
84 /** Source properties. */
85 volatile ALfloat Pitch
;
86 volatile ALfloat Gain
;
87 volatile ALfloat OuterGain
;
88 volatile ALfloat MinGain
;
89 volatile ALfloat MaxGain
;
90 volatile ALfloat InnerAngle
;
91 volatile ALfloat OuterAngle
;
92 volatile ALfloat RefDistance
;
93 volatile ALfloat MaxDistance
;
94 volatile ALfloat RollOffFactor
;
95 volatile ALfloat Position
[3];
96 volatile ALfloat Velocity
[3];
97 volatile ALfloat Orientation
[3];
98 volatile ALboolean HeadRelative
;
99 volatile ALboolean Looping
;
100 volatile enum DistanceModel DistanceModel
;
101 volatile ALboolean DirectChannels
;
103 volatile ALboolean DryGainHFAuto
;
104 volatile ALboolean WetGainAuto
;
105 volatile ALboolean WetGainHFAuto
;
106 volatile ALfloat OuterGainHF
;
108 volatile ALfloat AirAbsorptionFactor
;
109 volatile ALfloat RoomRolloffFactor
;
110 volatile ALfloat DopplerFactor
;
112 enum Resampler Resampler
;
115 * Last user-specified offset, and the offset type (bytes, samples, or
121 /** Source type (static, streaming, or undetermined) */
122 volatile ALint SourceType
;
124 /** Source state (initial, playing, paused, or stopped) */
125 volatile ALenum state
;
129 * Source offset in samples, relative to the currently playing buffer, NOT
130 * the whole queue, and the fractional (fixed-point) offset to the next
134 ALuint position_fraction
;
136 /** Source Buffer Queue info. */
137 ALbufferlistitem
*queue
;
138 ALuint BuffersInQueue
;
139 ALuint BuffersPlayed
;
141 /** Current buffer sample info. */
145 /** Direct filter and auxiliary send info. */
147 ALfloat DirectGainHF
;
150 struct ALeffectslot
*Slot
;
158 /** Current target parameters used for mixing. */
160 ResamplerFunc Resample
;
168 SendParams Send
[MAX_SENDS
];
170 /** Source needs to update its mixing parameters. */
171 volatile ALenum NeedsUpdate
;
173 /** Method to update mixing parameters. */
174 ALvoid (*Update
)(struct ALsource
*self
, const ALCcontext
*context
);
179 #define ALsource_Update(s,a) ((s)->Update(s,a))
181 ALvoid
SetSourceState(ALsource
*Source
, ALCcontext
*Context
, ALenum state
);
182 ALboolean
ApplyOffset(ALsource
*Source
);
184 ALvoid
ReleaseALSources(ALCcontext
*Context
);