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 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(ALCdevice
*Device
, DirectParams
*params
,
87 const ALfloat
*RESTRICT data
, ALuint srcchan
,
88 ALuint OutPos
, ALuint SamplesToDo
, ALuint BufferSize
)
90 ALfloat (*RESTRICT DryBuffer
)[BUFFERSIZE
] = Device
->DryBuffer
;
91 ALfloat
*RESTRICT ClickRemoval
= Device
->ClickRemoval
;
92 ALfloat
*RESTRICT PendingClicks
= Device
->PendingClicks
;
97 for(c
= 0;c
< MaxChannels
;c
++)
99 DrySend
= params
->Gains
[srcchan
][c
];
100 if(DrySend
< 0.00001f
)
104 ClickRemoval
[c
] -= data
[0]*DrySend
;
105 for(pos
= 0;pos
< BufferSize
;pos
++)
106 DryBuffer
[c
][OutPos
+pos
] += data
[pos
]*DrySend
;
107 if(OutPos
+pos
== SamplesToDo
)
108 PendingClicks
[c
] += data
[pos
]*DrySend
;
113 void MixSend_C(SendParams
*params
, const ALfloat
*RESTRICT data
,
114 ALuint OutPos
, ALuint SamplesToDo
, ALuint BufferSize
)
116 ALeffectslot
*Slot
= params
->Slot
;
117 ALfloat (*RESTRICT WetBuffer
)[BUFFERSIZE
] = Slot
->WetBuffer
;
118 ALfloat
*RESTRICT WetClickRemoval
= Slot
->ClickRemoval
;
119 ALfloat
*RESTRICT WetPendingClicks
= Slot
->PendingClicks
;
120 ALfloat WetSend
= params
->Gain
;
123 if(WetSend
< 0.00001f
)
127 WetClickRemoval
[0] -= data
[0] * WetSend
;
128 for(pos
= 0;pos
< BufferSize
;pos
++)
129 WetBuffer
[0][OutPos
+pos
] += data
[pos
] * WetSend
;
130 if(OutPos
+pos
== SamplesToDo
)
131 WetPendingClicks
[0] += data
[pos
] * WetSend
;