HephAudio v3.0.6
A cross-platform C++ library for recording, playing, and processing audio on Windows, Android, Linux, iOS, and macOS.
|
implements reading the SOFA files and HRTF interpolation for spatialization. More...
#include <Spatializer.h>
Public Member Functions | |
Spatializer (const std::filesystem::path &sofaFilePath, uint32_t sampleRate) | |
Spatializer (const Spatializer &)=delete | |
Spatializer (Spatializer &&rhs) noexcept | |
Spatializer & | operator= (const Spatializer &)=delete |
Spatializer & | operator= (Spatializer &&rhs) noexcept |
uint32_t | GetSampleRate () const |
size_t | GetFrameCount () const |
void | OpenSofaFile (const std::filesystem::path &sofaFilePath, uint32_t sampleRate) |
void | CloseSofaFile () |
void | Process (AudioBuffer &buffer, float azimuth_deg, float elevation_deg) |
void | Process (AudioBuffer &buffer, float azimuth_deg, float elevation_deg, const Heph::DoubleBuffer &windowBuffer) |
implements reading the SOFA files and HRTF interpolation for spatialization.
uint32_t HephAudio::Spatializer::GetSampleRate | ( | ) | const |
gets the sampling rate of the read SOFA file.
size_t HephAudio::Spatializer::GetFrameCount | ( | ) | const |
gets the size of the HRTF filters.
void HephAudio::Spatializer::OpenSofaFile | ( | const std::filesystem::path & | sofaFilePath, |
uint32_t | sampleRate ) |
reads the SOFA file for using the HRTF data.
FailException |
void HephAudio::Spatializer::CloseSofaFile | ( | ) |
closes the SOFA file and releases the resources.
void HephAudio::Spatializer::Process | ( | AudioBuffer & | buffer, |
float | azimuth_deg, | ||
float | elevation_deg ) |
spatializes the provided audio data.
Uses HannWindow for windowing.
buffer | audio data. |
azimuth_deg | desired azimuth angle in degrees. |
elevation_deg | desired elevation angle in degrees. |
InvalidArgumentException |
void HephAudio::Spatializer::Process | ( | AudioBuffer & | buffer, |
float | azimuth_deg, | ||
float | elevation_deg, | ||
const Heph::DoubleBuffer & | windowBuffer ) |
spatializes the provided audio data.
buffer | audio data. |
azimuth_deg | desired azimuth angle in degrees. |
elevation_deg | desired elevation angle in degrees. |
windowBuffer | buffer that's generated by using one of the Window classes. |
InvalidArgumentException |