8 #include "alAuxEffectSlot.h"
11 static inline ALfloat
point32(const ALfloat
*vals
, ALuint
UNUSED(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 const ALfloat
*Resample_copy32_C(const ALfloat
*src
, ALuint
UNUSED(frac
),
19 ALuint increment
, ALfloat
*restrict dst
, ALuint numsamples
)
21 assert(increment
==FRACTIONONE
);
22 #if defined(HAVE_SSE) || defined(HAVE_NEON)
23 /* Avoid copying the source data if it's aligned like the destination. */
24 if((((intptr_t)src
)&15) == (((intptr_t)dst
)&15))
27 memcpy(dst
, src
, numsamples
*sizeof(ALfloat
));
31 #define DECL_TEMPLATE(Sampler) \
32 const ALfloat *Resample_##Sampler##_C(const ALfloat *src, ALuint frac, \
33 ALuint increment, ALfloat *restrict dst, ALuint numsamples) \
36 for(i = 0;i < numsamples;i++) \
38 dst[i] = Sampler(src, frac); \
41 src += frac>>FRACTIONBITS; \
42 frac &= FRACTIONMASK; \
47 DECL_TEMPLATE(point32
)
49 DECL_TEMPLATE(cubic32
)
54 void ALfilterState_processC(ALfilterState
*filter
, ALfloat
*restrict dst
, const ALfloat
*src
, ALuint numsamples
)
57 for(i
= 0;i
< numsamples
;i
++)
58 *(dst
++) = ALfilterState_processSingle(filter
, *(src
++));
62 static inline void ApplyCoeffsStep(ALuint Offset
, ALfloat (*restrict Values
)[2],
64 ALfloat (*restrict Coeffs
)[2],
65 const ALfloat (*restrict CoeffStep
)[2],
66 ALfloat left
, ALfloat right
)
69 for(c
= 0;c
< IrSize
;c
++)
71 const ALuint off
= (Offset
+c
)&HRIR_MASK
;
72 Values
[off
][0] += Coeffs
[c
][0] * left
;
73 Values
[off
][1] += Coeffs
[c
][1] * right
;
74 Coeffs
[c
][0] += CoeffStep
[c
][0];
75 Coeffs
[c
][1] += CoeffStep
[c
][1];
79 static inline void ApplyCoeffs(ALuint Offset
, ALfloat (*restrict Values
)[2],
81 ALfloat (*restrict Coeffs
)[2],
82 ALfloat left
, ALfloat right
)
85 for(c
= 0;c
< IrSize
;c
++)
87 const ALuint off
= (Offset
+c
)&HRIR_MASK
;
88 Values
[off
][0] += Coeffs
[c
][0] * left
;
89 Values
[off
][1] += Coeffs
[c
][1] * right
;
94 #include "mixer_inc.c"
98 void Mix_C(const ALfloat
*data
, ALuint OutChans
, ALfloat (*restrict OutBuffer
)[BUFFERSIZE
],
99 MixGains
*Gains
, ALuint Counter
, ALuint OutPos
, ALuint BufferSize
)
104 for(c
= 0;c
< OutChans
;c
++)
107 gain
= Gains
[c
].Current
;
108 step
= Gains
[c
].Step
;
109 if(step
!= 1.0f
&& Counter
> 0)
111 for(;pos
< BufferSize
&& pos
< Counter
;pos
++)
113 OutBuffer
[c
][OutPos
+pos
] += data
[pos
]*gain
;
117 gain
= Gains
[c
].Target
;
118 Gains
[c
].Current
= gain
;
121 if(!(gain
> GAIN_SILENCE_THRESHOLD
))
123 for(;pos
< BufferSize
;pos
++)
124 OutBuffer
[c
][OutPos
+pos
] += data
[pos
]*gain
;