diff options
author | Chris Robinson <[email protected]> | 2021-04-22 10:26:20 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2021-04-22 10:26:20 -0700 |
commit | 65b85f7cb9cdac5cbad2cefbe2141141717c80cb (patch) | |
tree | 8766848438fc2ea0b32ffba7860b89c46e1728f6 /alc/hrtf.h | |
parent | d6d6fd73787bc159678a8c09cbf6833d2d336949 (diff) |
Move hrtf.cpp/h to core
Diffstat (limited to 'alc/hrtf.h')
-rw-r--r-- | alc/hrtf.h | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/alc/hrtf.h b/alc/hrtf.h deleted file mode 100644 index d60377df..00000000 --- a/alc/hrtf.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef ALC_HRTF_H -#define ALC_HRTF_H - -#include <array> -#include <cstddef> -#include <memory> -#include <string> - -#include "almalloc.h" -#include "aloptional.h" -#include "alspan.h" -#include "atomic.h" -#include "core/ambidefs.h" -#include "core/bufferline.h" -#include "core/filters/splitter.h" -#include "core/mixer/hrtfdefs.h" -#include "intrusive_ptr.h" -#include "vector.h" - - -struct HrtfStore { - RefCount mRef; - - uint sampleRate; - uint irSize; - - struct Field { - float distance; - ubyte evCount; - }; - /* NOTE: Fields are stored *backwards*. field[0] is the farthest field, and - * field[fdCount-1] is the nearest. - */ - uint fdCount; - const Field *field; - - struct Elevation { - ushort azCount; - ushort irOffset; - }; - Elevation *elev; - const HrirArray *coeffs; - const ubyte2 *delays; - - void add_ref(); - void release(); - - DEF_PLACE_NEWDEL() -}; -using HrtfStorePtr = al::intrusive_ptr<HrtfStore>; - - -struct EvRadians { float value; }; -struct AzRadians { float value; }; -struct AngularPoint { - EvRadians Elev; - AzRadians Azim; -}; - - -struct DirectHrtfState { - std::array<float,HrtfDirectDelay+BufferLineSize> mTemp; - - /* HRTF filter state for dry buffer content */ - uint mIrSize{0}; - al::FlexArray<HrtfChannelState> mChannels; - - DirectHrtfState(size_t numchans) : mChannels{numchans} { } - /** - * Produces HRTF filter coefficients for decoding B-Format, given a set of - * virtual speaker positions, a matching decoding matrix, and per-order - * high-frequency gains for the decoder. The calculated impulse responses - * are ordered and scaled according to the matrix input. - */ - void build(const HrtfStore *Hrtf, const uint irSize, - const al::span<const AngularPoint> AmbiPoints, const float (*AmbiMatrix)[MaxAmbiChannels], - const float XOverFreq, const al::span<const float,MaxAmbiOrder+1> AmbiOrderHFGain); - - static std::unique_ptr<DirectHrtfState> Create(size_t num_chans); - - DEF_FAM_NEWDEL(DirectHrtfState, mChannels) -}; - - -al::vector<std::string> EnumerateHrtf(al::optional<std::string> pathopt); -HrtfStorePtr GetLoadedHrtf(const std::string &name, const uint devrate); - -void GetHrtfCoeffs(const HrtfStore *Hrtf, float elevation, float azimuth, float distance, - float spread, HrirArray &coeffs, const al::span<uint,2> delays); - -#endif /* ALC_HRTF_H */ |