Files
XCEngine/MVS/Music fluctuations/source/audio3d/HRTF.h

41 lines
1.2 KiB
C
Raw Normal View History

#pragma once
#include"mit_kemar_hrtf_data.h"
#include"../global/Base.h"
#include"FFTFilter.h"
#include"Resampler.h"
class HRTF
{
public:
HRTF();
~HRTF();
void GetDirection(int& p_elevation, int& p_azimuth);
int SetDirection(int p_elevation, int p_azimuth);
void GetLeftEarTimeHRTF(std::vector<float>& p_data);
void GetLeftEarFreqHRTF(std::vector<float>& p_data);
void GetRightEarTimeHRTF(std::vector<float>& p_data);
void GetRightEarFreqHRTF(std::vector<float>& p_data);
private:
void BuildReacherTree();
int SearchNearestIndex(int p_elevation, int p_azimuth);
double CaculateSphereDistance(int p_elevation1, int p_azimuth1, int p_elevation2, int p_azimuth2);
private:
int m_real_azimuth = 0; //ˮƽ<CBAE><C6BD>
int m_real_elevation = 0; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
int m_azimuth = 0;
int m_elevation = 0;
bool m_is_swap_left_and_right = false;
int m_direction_index = 0;
typedef std::vector<float> ResampledHRTFT;
typedef std::pair<ResampledHRTFT, ResampledHRTFT> ResampledHRTFPairT;
std::vector<ResampledHRTFPairT> hrtf_resampled_time_domain_;
std::vector<ResampledHRTFPairT> hrtf_resampled_freq_domain_;
std::map<int, std::pair<std::vector<int>, std::vector<int>>> hrtf_directions;
FFTFilter m_filter;
//Resampler m_resampler;
};