8 #include "alAuxEffectSlot.h"
11 static __inline ALfloat
point32(const ALfloat
*vals
, ALuint frac
)
12 { return vals
[0]; (void)frac
; }
13 static __inline ALfloat
lerp32(const ALfloat
*vals
, ALuint frac
)
14 { return lerp(vals
[0], vals
[1], frac
* (1.0f
/FRACTIONONE
)); }
15 static __inline ALfloat
cubic32(const ALfloat
*vals
, ALuint frac
)
16 { return cubic(vals
[-1], vals
[0], vals
[1], vals
[2], frac
* (1.0f
/FRACTIONONE
)); }
18 void Resample_copy32_C(const ALfloat
*data
, ALuint frac
,
19 ALuint increment
, ALfloat
*RESTRICT OutBuffer
, ALuint BufferSize
)
22 assert(increment
==FRACTIONONE
);
23 memcpy(OutBuffer
, data
, (BufferSize
+1)*sizeof(ALfloat
));
26 #define DECL_TEMPLATE(Sampler) \
27 void Resample_##Sampler##_C(const ALfloat *data, ALuint frac, \
28 ALuint increment, ALfloat *RESTRICT OutBuffer, ALuint BufferSize) \
33 for(i = 0;i < BufferSize+1;i++) \
35 OutBuffer[i] = Sampler(data + pos, frac); \
38 pos += frac>>FRACTIONBITS; \
39 frac &= FRACTIONMASK; \
43 DECL_TEMPLATE(point32
)
45 DECL_TEMPLATE(cubic32
)
50 static __inline
void ApplyCoeffsStep(ALuint Offset
, ALfloat (*RESTRICT Values
)[2],
52 ALfloat (*RESTRICT Coeffs
)[2],
53 const ALfloat (*RESTRICT CoeffStep
)[2],
54 ALfloat left
, ALfloat right
)
57 for(c
= 0;c
< IrSize
;c
++)
59 const ALuint off
= (Offset
+c
)&HRIR_MASK
;
60 Values
[off
][0] += Coeffs
[c
][0] * left
;
61 Values
[off
][1] += Coeffs
[c
][1] * right
;
62 Coeffs
[c
][0] += CoeffStep
[c
][0];
63 Coeffs
[c
][1] += CoeffStep
[c
][1];
67 static __inline
void ApplyCoeffs(ALuint Offset
, ALfloat (*RESTRICT Values
)[2],
69 ALfloat (*RESTRICT Coeffs
)[2],
70 ALfloat left
, ALfloat right
)
73 for(c
= 0;c
< IrSize
;c
++)
75 const ALuint off
= (Offset
+c
)&HRIR_MASK
;
76 Values
[off
][0] += Coeffs
[c
][0] * left
;
77 Values
[off
][1] += Coeffs
[c
][1] * right
;
82 #include "mixer_inc.c"
86 void MixDirect_C(const DirectParams
*params
, const ALfloat
*RESTRICT data
, ALuint srcchan
,
87 ALuint OutPos
, ALuint SamplesToDo
, ALuint BufferSize
)
89 ALfloat (*RESTRICT DryBuffer
)[BUFFERSIZE
] = params
->OutBuffer
;
90 ALfloat
*RESTRICT ClickRemoval
= params
->ClickRemoval
;
91 ALfloat
*RESTRICT PendingClicks
= params
->PendingClicks
;
96 for(c
= 0;c
< MaxChannels
;c
++)
98 DrySend
= params
->Gains
[srcchan
][c
];
99 if(DrySend
< 0.00001f
)
103 ClickRemoval
[c
] -= data
[0]*DrySend
;
104 for(pos
= 0;pos
< BufferSize
;pos
++)
105 DryBuffer
[c
][OutPos
+pos
] += data
[pos
]*DrySend
;
106 if(OutPos
+pos
== SamplesToDo
)
107 PendingClicks
[c
] += data
[pos
]*DrySend
;
112 void MixSend_C(const SendParams
*params
, const ALfloat
*RESTRICT data
,
113 ALuint OutPos
, ALuint SamplesToDo
, ALuint BufferSize
)
115 ALeffectslot
*Slot
= params
->Slot
;
116 ALfloat (*RESTRICT WetBuffer
)[BUFFERSIZE
] = Slot
->WetBuffer
;
117 ALfloat
*RESTRICT WetClickRemoval
= Slot
->ClickRemoval
;
118 ALfloat
*RESTRICT WetPendingClicks
= Slot
->PendingClicks
;
119 ALfloat WetSend
= params
->Gain
;
122 if(WetSend
< 0.00001f
)
126 WetClickRemoval
[0] -= data
[0] * WetSend
;
127 for(pos
= 0;pos
< BufferSize
;pos
++)
128 WetBuffer
[0][OutPos
+pos
] += data
[pos
] * WetSend
;
129 if(OutPos
+pos
== SamplesToDo
)
130 WetPendingClicks
[0] += data
[pos
] * WetSend
;