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 MixDirect_C(ALfloat (*restrict OutBuffer
)[BUFFERSIZE
], const ALfloat
*data
,
99 MixGains
*Gains
, ALuint Counter
, ALuint OutPos
, ALuint BufferSize
)
101 ALfloat DrySend
, Step
;
104 for(c
= 0;c
< MaxChannels
;c
++)
107 DrySend
= Gains
->Current
[c
];
108 Step
= Gains
->Step
[c
];
109 if(Step
!= 1.0f
&& Counter
> 0)
111 for(;pos
< BufferSize
&& pos
< Counter
;pos
++)
113 OutBuffer
[c
][OutPos
+pos
] += data
[pos
]*DrySend
;
117 DrySend
= Gains
->Target
[c
];
118 Gains
->Current
[c
] = DrySend
;
121 if(!(DrySend
> GAIN_SILENCE_THRESHOLD
))
123 for(;pos
< BufferSize
;pos
++)
124 OutBuffer
[c
][OutPos
+pos
] += data
[pos
]*DrySend
;
129 void MixSend_C(ALfloat (*restrict OutBuffer
)[BUFFERSIZE
], const ALfloat
*data
,
130 MixGainMono
*Gain
, ALuint Counter
, ALuint OutPos
, ALuint BufferSize
)
132 ALfloat WetSend
, Step
;
136 WetSend
= Gain
->Current
;
138 if(Step
!= 1.0f
&& Counter
> 0)
140 for(;pos
< BufferSize
&& pos
< Counter
;pos
++)
142 OutBuffer
[0][OutPos
+pos
] += data
[pos
]*WetSend
;
146 WetSend
= Gain
->Target
;
147 Gain
->Current
= WetSend
;
150 if(!(WetSend
> GAIN_SILENCE_THRESHOLD
))
152 for(;pos
< BufferSize
;pos
++)
153 OutBuffer
[0][OutPos
+pos
] += data
[pos
] * WetSend
;