4#include "../vae_types.hpp"
5#include "../vae_util.hpp"
6#include "../pod/vae_hrtf.hpp"
7#include "../voices/vae_voice_hrtf.hpp"
10namespace vae {
namespace core {
23 Size closestIndex = ~0;
26 const Sample dist = glm::distance(pos.pos, direction);
53 const Sample* irLeft = hrtf.
ir[0][0];
54 const Sample* irRight = hrtf.
ir[1][0];
62 convolutionBuffer[convolutionIndex] = in[i];
65 const Sample conv = convolutionBuffer[(irLen + convolutionIndex - n) % irLen];
66 leftSum += irLeft[n] * conv;
67 rightSum += irRight[n] * conv;
69 target[0][i] += leftSum * distanceAttenuated;
70 target[1][i] += rightSum * distanceAttenuated;
71 convolutionIndex = (convolutionIndex + 1) % irLen;
Size size() const
Returns the allocated length of the buffer.
T max(const T &v1, const T &v2)
AudioBuffer::Size SampleIndex
Contains Typedefinitions and basic structures use by the public API and internally.
unsigned int Size
How the elements are addressed in the heapbuffer.
float Sample
Default sample types used where ever possible, changing this means the engine needs to be recompiled,...
AudioBuffer ir[2]
Impulse response needed for the convolution.
HeapBuffer< Position > positions
static Size closest(const HRTF &hrtf, const Vec3 &direction)
Looks for the best matching IR in a HRTF.
static void apply(HRTF::Position &hrtf, VoiceHRTF &hrtfVoice, SampleIndex frames, ScratchBuffer &target, const Sample *in, Sample distanceAttenuated)
Applies simple time domain convolution.
Data needed to process HRTFs.
ScratchBuffer convolutionBuffer
Temporary buffer for the convolution.
Size convolutionIndex
position in convolution buffer
#define VAE_PROFILER_SCOPE_NAMED(name)
Profiles a scope and names it.