HephAudio v3.1.0
A cross-platform C++ library for recording, playing, and processing audio on Windows, Android, Linux, iOS, and macOS.
|
applies 3D audio spatialization using SOFA files. More...
#include <Spatializer.h>
Public Member Functions | |
Spatializer () | |
Spatializer (size_t hopSize, const Window &wnd) | |
Spatializer (float azimuth, float elevation, size_t hopSize, const Window &wnd) | |
Spatializer (const std::filesystem::path &filePath, uint32_t sampleRate, float azimuth, float elevation, size_t hopSize, const Window &wnd) | |
virtual | ~Spatializer () |
virtual std::string | Name () const override |
virtual void | Process (AudioBuffer &buffer, size_t startIndex, size_t frameCount) override |
virtual void | SetWindow (const Window &wnd) override |
virtual void | OpenSofaFile (const std::filesystem::path &filePath) |
virtual void | CloseSofaFile () |
virtual float | GetAzimuth () const |
virtual void | SetAzimuth (float azimuth) |
virtual float | GetElevation () const |
virtual void | SetElevation (float elevation) |
virtual uint32_t | GetSampleRate () const |
virtual void | SetSampleRate (uint32_t sampleRate) |
virtual size_t | GetHrtfSize () const |
Public Member Functions inherited from HephAudio::FrequencyDomainEffect | |
virtual | ~FrequencyDomainEffect ()=default |
Public Member Functions inherited from HephAudio::OlaEffect | |
virtual | ~OlaEffect ()=default |
virtual size_t | CalculateRequiredFrameCount (size_t outputFrameCount, const AudioFormatInfo &formatInfo) const |
virtual void | ResetInternalState () override |
virtual size_t | GetHopSize () const |
virtual void | SetHopSize (size_t hopSize) |
virtual size_t | GetWindowSize () const |
virtual void | Process (AudioBuffer &buffer) |
virtual void | Process (AudioBuffer &buffer, size_t startIndex) |
Public Member Functions inherited from HephAudio::DoubleBufferedAudioEffect | |
virtual | ~DoubleBufferedAudioEffect ()=default |
Public Member Functions inherited from HephAudio::AudioEffect | |
virtual | ~AudioEffect ()=default |
virtual bool | HasMTSupport () const |
virtual bool | HasRTSupport () const |
virtual size_t | GetThreadCount () const |
virtual void | SetThreadCount (size_t threadCount) |
virtual size_t | CalculateOutputFrameCount (size_t inputFrameCount, const AudioFormatInfo &formatInfo) const |
virtual size_t | CalculateAdvanceSize (size_t renderFrameCount, const AudioFormatInfo &formatInfo) const |
Protected Member Functions | |
virtual void | ProcessST (const AudioBuffer &inputBuffer, AudioBuffer &outputBuffer, size_t startIndex, size_t frameCount) override |
virtual void | OpenDefaultFile () |
virtual std::string | GetErrorString (int errorCode) const |
gets the error message that corresponds to the provided code. | |
Protected Member Functions inherited from HephAudio::FrequencyDomainEffect | |
FrequencyDomainEffect () | |
FrequencyDomainEffect (size_t hopSize) | |
FrequencyDomainEffect (size_t hopSize, const Window &wnd) | |
Protected Member Functions inherited from HephAudio::OlaEffect | |
OlaEffect () | |
OlaEffect (size_t hopSize) | |
OlaEffect (size_t hopSize, const Window &wnd) | |
virtual size_t | CalculateMaxNumberOfOverlaps () const |
virtual size_t | CalculatePastSamplesSize () const |
Protected Member Functions inherited from HephAudio::DoubleBufferedAudioEffect | |
DoubleBufferedAudioEffect () | |
virtual AudioBuffer | CreateOutputBuffer (const AudioBuffer &inputBuffer, size_t startIndex, size_t frameCount) const |
virtual void | InitializeOutputBuffer (const AudioBuffer &inputBuffer, AudioBuffer &outputBuffer, size_t startIndex, size_t frameCount) const |
Protected Member Functions inherited from HephAudio::AudioEffect | |
AudioEffect () | |
virtual void | ProcessMT (const AudioBuffer &inputBuffer, AudioBuffer &outputBuffer, size_t startIndex, size_t frameCount) |
Protected Attributes | |
float | azimuth |
float | elevation |
std::filesystem::path | filePath |
MYSOFA_EASY * | pEasy |
size_t | hrtfSize |
uint32_t | hrtfSampleRate |
bool | updateTransferFunctions |
std::array< Heph::ComplexBuffer, 2 > | transferFunctions |
Protected Attributes inherited from HephAudio::OlaEffect | |
size_t | hopSize |
Heph::DoubleBuffer | wnd |
size_t | currentIndex |
AudioBuffer | pastSamples |
Protected Attributes inherited from HephAudio::AudioEffect | |
size_t | threadCount |
applies 3D audio spatialization using SOFA files.
HephAudio::Spatializer::Spatializer | ( | ) |
creates a new instance and initializes it with default values.
HephAudio::Spatializer::Spatializer | ( | size_t | hopSize, |
const Window & | wnd ) |
creates a new instance and initializes it with the provided values.
hopSize | number of frames to advance each iteration. |
wnd | window that will be applied for overlap-add. |
HephAudio::Spatializer::Spatializer | ( | float | azimuth, |
float | elevation, | ||
size_t | hopSize, | ||
const Window & | wnd ) |
creates a new instance and initializes it with the provided values.
azimuth | in degrees. |
elevation | in degrees. |
hopSize | number of frames to advance each iteration. |
wnd | window that will be applied for overlap-add. |
HephAudio::Spatializer::Spatializer | ( | const std::filesystem::path & | filePath, |
uint32_t | sampleRate, | ||
float | azimuth, | ||
float | elevation, | ||
size_t | hopSize, | ||
const Window & | wnd ) |
creates a new instance and initializes it with the provided values.
filePath | path of the SOFA file. |
sampleRate | sampling rate of the HRTF filters. |
azimuth | in degrees. |
elevation | in degrees. |
hopSize | number of frames to advance each iteration. |
wnd | window that will be applied for overlap-add. |
|
virtual |
releases the resources and destroys the instance.
|
overridevirtual |
gets the name of the audio effect.
Implements HephAudio::AudioEffect.
|
overridevirtual |
Applies the effect.
buffer | contains the audio data which will be processed. |
startIndex | index of the first audio frame to process. |
frameCount | number of frames to process. |
Reimplemented from HephAudio::OlaEffect.
|
overridevirtual |
sets the window.
wnd | window that will be applied for overlap-add. |
Reimplemented from HephAudio::FrequencyDomainEffect.
|
virtual |
reads the SOFA file.
filePath | path of the SOFA file. |
|
virtual |
closes the SOFA file and releases the resources.
|
virtual |
gets the azimuth angle in degrees.
|
virtual |
sets the azimuth angle.
azimuth | in degrees. |
|
virtual |
gets the elevation angle in degrees.
|
virtual |
sets the elevation angle.
elevation | in degrees. |
|
virtual |
gets the sampling rate of the HRTF filters.
|
virtual |
sets the sampling rate of the HRTF filters.
sampleRate | sampling rate of the HRTF filters. |
|
virtual |
gets the size of the HRTF filters.
|
overrideprotectedvirtual |
applies the effect using single thread.
inputBuffer | contains the audio data which will be processed. |
outputBuffer | contains the processed audio data. |
startIndex | index of the first sample to process. |
frameCount | number of frames to process. |
Implements HephAudio::AudioEffect.
|
protectedvirtual |
opens the default SOFA file.
|
protectedvirtual |
gets the error message that corresponds to the provided code.
errorCode | the error code returned by the libmysofa library. |
|
protected |
in degrees.
|
protected |
in degrees.
|
protected |
path of the SOFA file.
|
protected |
stores the contents of the SOFA file.
|
protected |
size of the HRTF filters.
|
protected |
sampling rate of the HRTF filters.
|
protected |
indicates whether there has been any change and the transfer functions needs updating.
|
protected |
an array of transfer functions where the first element is the left channel, and the second element is the right channel.