#include <vae_hrtf_util.hpp>
Definition at line 11 of file vae_hrtf_util.hpp.
◆ apply()
Applies simple time domain convolution.
- Parameters
-
hrtf | HRTF to use |
hrtfVoice | Convolution data for the voice |
frames | Number of frames |
target | Target buffer to mix into |
in | Signal to convolve |
distanceAttenuated | Volume applied |
Definition at line 48 of file vae_hrtf_util.hpp.
53 const
Sample* irLeft = hrtf.ir[0][0];
54 const
Sample* irRight = hrtf.ir[1][0];
55 const
Size irLen = hrtf.ir[0].size();
56 Sample* convolutionBuffer = hrtfVoice.convolutionBuffer[0];
57 Size convolutionIndex = hrtfVoice.convolutionIndex;
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;
73 hrtfVoice.convolutionIndex = convolutionIndex;
AudioBuffer::Size SampleIndex
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,...
#define VAE_PROFILER_SCOPE_NAMED(name)
Profiles a scope and names it.
◆ closest()
static Size vae::core::HRTFUtil::closest |
( |
const HRTF & |
hrtf, |
|
|
const Vec3 & |
direction |
|
) |
| |
|
inlinestatic |
Looks for the best matching IR in a HRTF.
Does bad brute force search, should use kd tree or the mysodalib
- Parameters
-
- Returns
- Size
Definition at line 19 of file vae_hrtf_util.hpp.
23 Size closestIndex = ~0;
24 for (
Size i = 0; i < hrtf.positions.size(); i++) {
25 const auto& pos = hrtf.positions[i];
26 const Sample dist = glm::distance(pos.pos, direction);
T max(const T &v1, const T &v2)
static Size closest(const HRTF &hrtf, const Vec3 &direction)
Looks for the best matching IR in a HRTF.
The documentation for this struct was generated from the following file: