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 HrtfParams
{
34 ALfloat Coeffs
[MAXCHANNELS
][HRIR_LENGTH
][2];
35 ALuint Delay
[MAXCHANNELS
][2];
36 ALfloat CoeffStep
[HRIR_LENGTH
][2];
40 typedef struct HrtfState
{
43 ALfloat History
[MAXCHANNELS
][SRC_HISTORY_LENGTH
];
44 ALfloat Values
[MAXCHANNELS
][HRIR_LENGTH
][2];
48 typedef struct ALsource
50 /** Source properties. */
51 volatile ALfloat Pitch
;
52 volatile ALfloat Gain
;
53 volatile ALfloat OuterGain
;
54 volatile ALfloat MinGain
;
55 volatile ALfloat MaxGain
;
56 volatile ALfloat InnerAngle
;
57 volatile ALfloat OuterAngle
;
58 volatile ALfloat RefDistance
;
59 volatile ALfloat MaxDistance
;
60 volatile ALfloat RollOffFactor
;
61 volatile ALfloat Position
[3];
62 volatile ALfloat Velocity
[3];
63 volatile ALfloat Orientation
[3];
64 volatile ALboolean HeadRelative
;
65 volatile ALboolean Looping
;
66 volatile enum DistanceModel DistanceModel
;
67 volatile ALboolean DirectChannels
;
69 volatile ALboolean DryGainHFAuto
;
70 volatile ALboolean WetGainAuto
;
71 volatile ALboolean WetGainHFAuto
;
72 volatile ALfloat OuterGainHF
;
74 volatile ALfloat AirAbsorptionFactor
;
75 volatile ALfloat RoomRolloffFactor
;
76 volatile ALfloat DopplerFactor
;
78 enum Resampler Resampler
;
81 * Last user-specified offset, and the offset type (bytes, samples, or
87 /** Source type (static, streaming, or undetermined) */
88 volatile ALint SourceType
;
90 /** Source state (initial, playing, paused, or stopped) */
91 volatile ALenum state
;
95 * Source offset in samples, relative to the currently playing buffer, NOT
96 * the whole queue, and the fractional (fixed-point) offset to the next
100 ALuint position_fraction
;
102 /** Source Buffer Queue info. */
103 ALbufferlistitem
*queue
;
104 ALuint BuffersInQueue
;
105 ALuint BuffersPlayed
;
107 /** Current buffer sample info. */
111 /** Direct filter and auxiliary send info. */
113 ALfloat DirectGainHF
;
116 struct ALeffectslot
*Slot
;
124 /** Current target parameters used for mixing. */
134 /* A mixing matrix. First subscript is the channel number of the
135 * input data (regardless of channel configuration) and the second
136 * is the channel target (eg. FRONT_LEFT). */
137 ALfloat Gains
[MAXCHANNELS
][MAXCHANNELS
];
140 ALfloat history
[MAXCHANNELS
*2];
144 struct ALeffectslot
*Slot
;
147 ALfloat history
[MAXCHANNELS
];
150 /** Source needs to update its mixing parameters. */
151 volatile ALenum NeedsUpdate
;
153 /** Method to update mixing parameters. */
154 ALvoid (*Update
)(struct ALsource
*self
, const ALCcontext
*context
);
159 #define ALsource_Update(s,a) ((s)->Update(s,a))
161 ALvoid
SetSourceState(ALsource
*Source
, ALCcontext
*Context
, ALenum state
);
162 ALboolean
ApplyOffset(ALsource
*Source
);
164 ALvoid
ReleaseALSources(ALCcontext
*Context
);