48 lines
1.6 KiB
C
Raw Normal View History

2012-08-15 01:01:55 -07:00
#ifndef MIXER_DEFS_H
#define MIXER_DEFS_H
#include "AL/al.h"
#include "alcmain.h"
#include "alspan.h"
#include "hrtf.h"
union InterpState;
struct MixHrtfFilter;
template<typename TypeTag, typename InstTag>
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);
template<typename InstTag>
void Mix_(const al::span<const float> InSamples, const al::span<FloatBufferLine> OutBuffer,
float *CurrentGains, const float *TargetGains, const size_t Counter, const size_t OutPos);
template<typename InstTag>
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);
template<typename InstTag>
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);
template<typename InstTag>
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
/* 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)
{
pos_arr[0] = 0;
frac_arr[0] = frac;
2019-09-13 03:25:13 -07:00
for(size_t i{1};i < size;i++)
{
2019-09-13 03:25:13 -07:00
const ALuint frac_tmp{frac_arr[i-1] + increment};
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 */