16 #define F_PI (3.14159265358979323846f) /* pi */
17 #define F_PI_2 (1.57079632679489661923f) /* pi/2 */
20 #define FLT_EPSILON (1.19209290e-07f)
33 typedef void (*ResamplerFunc
)(const ALfloat
*src
, ALuint frac
, ALuint increment
,
34 ALfloat
*RESTRICT dst
, ALuint dstlen
);
36 typedef ALvoid (*DryMixerFunc
)(const struct DirectParams
*params
,
37 const ALfloat
*RESTRICT data
, ALuint srcchan
,
38 ALuint OutPos
, ALuint SamplesToDo
,
40 typedef ALvoid (*WetMixerFunc
)(const struct SendParams
*params
,
41 const ALfloat
*RESTRICT data
,
42 ALuint OutPos
, ALuint SamplesToDo
,
46 #define SPEEDOFSOUNDMETRESPERSEC (343.3f)
47 #define AIRABSORBGAINHF (0.99426f) /* -0.05dB */
49 #define FRACTIONBITS (14)
50 #define FRACTIONONE (1<<FRACTIONBITS)
51 #define FRACTIONMASK (FRACTIONONE-1)
54 static __inline ALfloat
minf(ALfloat a
, ALfloat b
)
55 { return ((a
> b
) ? b
: a
); }
56 static __inline ALfloat
maxf(ALfloat a
, ALfloat b
)
57 { return ((a
> b
) ? a
: b
); }
58 static __inline ALfloat
clampf(ALfloat val
, ALfloat min
, ALfloat max
)
59 { return minf(max
, maxf(min
, val
)); }
61 static __inline ALuint
minu(ALuint a
, ALuint b
)
62 { return ((a
> b
) ? b
: a
); }
63 static __inline ALuint
maxu(ALuint a
, ALuint b
)
64 { return ((a
> b
) ? a
: b
); }
65 static __inline ALuint
clampu(ALuint val
, ALuint min
, ALuint max
)
66 { return minu(max
, maxu(min
, val
)); }
68 static __inline ALint
mini(ALint a
, ALint b
)
69 { return ((a
> b
) ? b
: a
); }
70 static __inline ALint
maxi(ALint a
, ALint b
)
71 { return ((a
> b
) ? a
: b
); }
72 static __inline ALint
clampi(ALint val
, ALint min
, ALint max
)
73 { return mini(max
, maxi(min
, val
)); }
75 static __inline ALint64
mini64(ALint64 a
, ALint64 b
)
76 { return ((a
> b
) ? b
: a
); }
77 static __inline ALint64
maxi64(ALint64 a
, ALint64 b
)
78 { return ((a
> b
) ? a
: b
); }
79 static __inline ALint64
clampi64(ALint64 val
, ALint64 min
, ALint64 max
)
80 { return mini64(max
, maxi64(min
, val
)); }
82 static __inline ALuint64
minu64(ALuint64 a
, ALuint64 b
)
83 { return ((a
> b
) ? b
: a
); }
84 static __inline ALuint64
maxu64(ALuint64 a
, ALuint64 b
)
85 { return ((a
> b
) ? a
: b
); }
86 static __inline ALuint64
clampu64(ALuint64 val
, ALuint64 min
, ALuint64 max
)
87 { return minu64(max
, maxu64(min
, val
)); }
90 static __inline ALfloat
lerp(ALfloat val1
, ALfloat val2
, ALfloat mu
)
92 return val1
+ (val2
-val1
)*mu
;
94 static __inline ALfloat
cubic(ALfloat val0
, ALfloat val1
, ALfloat val2
, ALfloat val3
, ALfloat mu
)
97 ALfloat a0
= -0.5f
*val0
+ 1.5f
*val1
+ -1.5f
*val2
+ 0.5f
*val3
;
98 ALfloat a1
= val0
+ -2.5f
*val1
+ 2.0f
*val2
+ -0.5f
*val3
;
99 ALfloat a2
= -0.5f
*val0
+ 0.5f
*val2
;
102 return a0
*mu
*mu2
+ a1
*mu2
+ a2
*mu
+ a3
;
106 ALvoid
aluInitPanning(ALCdevice
*Device
);
108 ALvoid
ComputeAngleGains(const ALCdevice
*device
, ALfloat angle
, ALfloat hwidth
, ALfloat ingain
, ALfloat
*gains
);
110 ALvoid
CalcSourceParams(struct ALsource
*ALSource
, const ALCcontext
*ALContext
);
111 ALvoid
CalcNonAttnSourceParams(struct ALsource
*ALSource
, const ALCcontext
*ALContext
);
113 ALvoid
MixSource(struct ALsource
*Source
, ALCdevice
*Device
, ALuint SamplesToDo
);
115 ALvoid
aluMixData(ALCdevice
*device
, ALvoid
*buffer
, ALsizei size
);
116 ALvoid
aluHandleDisconnect(ALCdevice
*device
);
118 extern ALfloat ConeScale
;
119 extern ALfloat ZScale
;