2012-08-15 01:01:55 -07:00
|
|
|
#ifndef MIXER_DEFS_H
|
|
|
|
#define MIXER_DEFS_H
|
|
|
|
|
|
|
|
#include "AL/al.h"
|
|
|
|
|
2019-07-28 18:33:29 -07:00
|
|
|
#include "alcmain.h"
|
2019-05-29 17:32:16 -07:00
|
|
|
#include "alspan.h"
|
2019-07-31 10:09:43 -07:00
|
|
|
#include "hrtf.h"
|
|
|
|
|
2019-10-02 16:53:23 -07:00
|
|
|
union InterpState;
|
|
|
|
struct MixHrtfFilter;
|
|
|
|
|
2019-07-31 10:09:43 -07:00
|
|
|
|
2020-04-03 03:52:23 -07:00
|
|
|
template<typename TypeTag, typename InstTag>
|
2020-04-03 03:11:32 -07:00
|
|
|
const float *Resample_(const InterpState *state, const float *RESTRICT src, ALuint frac,
|
2019-09-13 03:25:13 -07:00
|
|
|
ALuint increment, const al::span<float> dst);
|
2012-09-14 04:13:18 -07:00
|
|
|
|
2020-04-03 03:52:23 -07:00
|
|
|
template<typename InstTag>
|
2019-08-20 04:16:44 -07:00
|
|
|
void Mix_(const al::span<const float> InSamples, const al::span<FloatBufferLine> OutBuffer,
|
2019-08-20 12:00:24 -07:00
|
|
|
float *CurrentGains, const float *TargetGains, const size_t Counter, const size_t OutPos);
|
2012-09-14 04:13:18 -07:00
|
|
|
|
2020-04-03 03:52:23 -07:00
|
|
|
template<typename InstTag>
|
2019-11-03 00:30:33 -07:00
|
|
|
void MixHrtf_(const float *InSamples, float2 *AccumSamples, const ALuint IrSize,
|
2020-01-05 17:12:48 -08:00
|
|
|
const MixHrtfFilter *hrtfparams, const size_t BufferSize);
|
2020-04-03 03:52:23 -07:00
|
|
|
template<typename InstTag>
|
2019-11-03 00:30:33 -07:00
|
|
|
void MixHrtfBlend_(const float *InSamples, float2 *AccumSamples, const ALuint IrSize,
|
2020-01-05 17:12:48 -08:00
|
|
|
const HrtfFilter *oldparams, const MixHrtfFilter *newparams, const size_t BufferSize);
|
2020-04-03 03:52:23 -07:00
|
|
|
template<typename InstTag>
|
2019-10-02 16:53:23 -07:00
|
|
|
void MixDirectHrtf_(FloatBufferLine &LeftOut, FloatBufferLine &RightOut,
|
|
|
|
const al::span<const FloatBufferLine> InSamples, float2 *AccumSamples, DirectHrtfState *State,
|
|
|
|
const size_t BufferSize);
|
2012-08-15 01:01:55 -07:00
|
|
|
|
2019-01-23 11:11:41 -08:00
|
|
|
/* Vectorized resampler helpers */
|
2019-09-13 03:25:13 -07:00
|
|
|
inline void InitPosArrays(ALuint frac, ALuint increment, ALuint *frac_arr, ALuint *pos_arr,
|
|
|
|
size_t size)
|
2014-06-06 01:52:53 -07:00
|
|
|
{
|
|
|
|
pos_arr[0] = 0;
|
|
|
|
frac_arr[0] = frac;
|
2019-09-13 03:25:13 -07:00
|
|
|
for(size_t i{1};i < size;i++)
|
2014-06-06 01:52:53 -07:00
|
|
|
{
|
2019-09-13 03:25:13 -07:00
|
|
|
const ALuint frac_tmp{frac_arr[i-1] + increment};
|
2014-06-06 01:52:53 -07:00
|
|
|
pos_arr[i] = pos_arr[i-1] + (frac_tmp>>FRACTIONBITS);
|
|
|
|
frac_arr[i] = frac_tmp&FRACTIONMASK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-15 01:01:55 -07:00
|
|
|
#endif /* MIXER_DEFS_H */
|