SAF
|
A binaural Ambisonic decoder for reproducing Ambisonic sound scenes over headphones. More...
#include "_common.h"
Go to the source code of this file.
Macros | |
#define | AMBI_BIN_NUM_DECODING_METHODS ( 5 ) |
Number of decoding method options. | |
#define | AMBI_BIN_NUM_HRIR_PREPROC_OPTIONS ( 4 ) |
Number of HRIR pre-preprocessing options. | |
Enumerations | |
enum | AMBI_BIN_DECODING_METHODS { DECODING_METHOD_LS = 1 , DECODING_METHOD_LSDIFFEQ , DECODING_METHOD_SPR , DECODING_METHOD_TA , DECODING_METHOD_MAGLS } |
Available decoding methods for the ambi_bin example. More... | |
enum | AMBI_BIN_PREPROC { HRIR_PREPROC_OFF = 1 , HRIR_PREPROC_EQ , HRIR_PREPROC_PHASE , HRIR_PREPROC_ALL } |
Available HRIR pre-preprocessing options. More... | |
Functions | |
void | ambi_bin_create (void **const phAmbi) |
Creates an instance of ambi_bin. | |
void | ambi_bin_destroy (void **const phAmbi) |
Destroys an instance of ambi_bin. | |
void | ambi_bin_init (void *const hAmbi, int samplerate) |
Initialises ambi_bin with default settings, and samplerate. | |
void | ambi_bin_initCodec (void *const hAmbi) |
Intialises the codec variables, based on current global/user parameters. | |
void | ambi_bin_process (void *const hAmbi, const float *const *inputs, float *const *const outputs, int nInputs, int nOutputs, int nSamples) |
Decodes input spherical harmonic signals to the binaural channels. | |
void | ambi_bin_refreshParams (void *const hAmbi) |
Sets intialisation flags to 1, so as to re-initialise all settings/variables (as ambi_bin is currently configured), at next available opportunity. | |
void | ambi_bin_setUseDefaultHRIRsflag (void *const hAmbi, int newState) |
Sets flag to dictate whether the default HRIRs in the Spatial_Audio_Framework should be used, or a custom HRIR set loaded via a SOFA file. | |
void | ambi_bin_setSofaFilePath (void *const hAmbi, const char *path) |
Sets the file path for a .sofa file, in order to employ a custom HRIR set for the decoding. | |
void | ambi_bin_setInputOrderPreset (void *const hAmbi, SH_ORDERS newPreset) |
Sets the decoding order (see SH_ORDERS enum) | |
void | ambi_bin_setDecodingMethod (void *const hAmbi, AMBI_BIN_DECODING_METHODS newMethod) |
Sets the decoding method (see AMBI_BIN_DECODING_METHODS enum) | |
void | ambi_bin_setChOrder (void *const hAmbi, int newOrder) |
Sets the Ambisonic channel ordering convention to decode with, in order to match the convention employed by the input signals. | |
void | ambi_bin_setNormType (void *const hAmbi, int newType) |
Sets the Ambisonic normalisation convention to decode with, in order to match with the convention employed by the input signals. | |
void | ambi_bin_setEnableMaxRE (void *const hAmbi, int newState) |
Sets a flag to enable/disable the max_rE weighting. | |
void | ambi_bin_setEnableDiffuseMatching (void *const hAmbi, int newState) |
Sets a flag to enable/disable (1 or 0) the diffuse-covariance constraint. | |
void | ambi_bin_setEnableTruncationEQ (void *const hAmbi, int newState) |
Sets a flag to enable/disable (1 or 0) truncation EQ. | |
void | ambi_bin_setHRIRsPreProc (void *const hAmbi, AMBI_BIN_PREPROC newType) |
Sets HRIR pre-processing strategy (see AMBI_BIN_PREPROC enum) | |
void | ambi_bin_setEnableRotation (void *const hAmbi, int newState) |
Sets the flag to enable/disable (1 or 0) sound-field rotation. | |
void | ambi_bin_setYaw (void *const hAmbi, float newYaw_deg) |
Sets the 'yaw' rotation angle, in degrees. | |
void | ambi_bin_setPitch (void *const hAmbi, float newPitch) |
Sets the 'pitch' rotation angle, in degrees. | |
void | ambi_bin_setRoll (void *const hAmbi, float newRoll) |
Sets the 'roll' rotation angle, in degrees. | |
void | ambi_bin_setFlipYaw (void *const hAmbi, int newState) |
Sets a flag as to whether to "flip" the sign of the current 'yaw' angle. | |
void | ambi_bin_setFlipPitch (void *const hAmbi, int newState) |
Sets a flag as to whether to "flip" the sign of the current 'pitch' angle. | |
void | ambi_bin_setFlipRoll (void *const hAmbi, int newState) |
Sets a flag as to whether to "flip" the sign of the current 'roll' angle. | |
void | ambi_bin_setRPYflag (void *const hAmbi, int newState) |
Sets a flag as to whether to use "yaw-pitch-roll" (0) or "roll-pitch-yaw" (1) rotation order. | |
int | ambi_bin_getFrameSize (void) |
Returns the processing framesize (i.e., number of samples processed with every _process() call ) | |
CODEC_STATUS | ambi_bin_getCodecStatus (void *const hAmbi) |
Returns current codec status, see CODEC_STATUS enum. | |
float | ambi_bin_getProgressBar0_1 (void *const hAmbi) |
(Optional) Returns current intialisation/processing progress, between 0..1 | |
void | ambi_bin_getProgressBarText (void *const hAmbi, char *text) |
(Optional) Returns current intialisation/processing progress text | |
int | ambi_bin_getUseDefaultHRIRsflag (void *const hAmbi) |
Returns the value of a flag used to dictate whether the default HRIRs in the Spatial_Audio_Framework should be used (1), or a custom HRIR set loaded via a SOFA file (0). | |
int | ambi_bin_getInputOrderPreset (void *const hAmbi) |
Returns the decoding order. | |
AMBI_BIN_DECODING_METHODS | ambi_bin_getDecodingMethod (void *const hAmbi) |
Returns the currently selected decoding method (see AMBI_BIN_DECODING_METHODS enum) | |
char * | ambi_bin_getSofaFilePath (void *const hAmbi) |
Returns the file path for a .sofa file. | |
int | ambi_bin_getChOrder (void *const hAmbi) |
Returns the Ambisonic channel ordering convention currently being used to decode with, which should match the convention employed by the input signals (see CH_ORDER enum) | |
int | ambi_bin_getNormType (void *const hAmbi) |
Returns the Ambisonic normalisation convention currently being usedto decode with, which should match the convention employed by the input signals (see NORM_TYPES enum). | |
int | ambi_bin_getNumEars (void) |
Returns the number of ears possessed by the average homo sapien (2) | |
int | ambi_bin_getNSHrequired (void *const hAmbi) |
Returns the number of spherical harmonic signals required by the current decoding order: (current_order+1)^2. | |
int | ambi_bin_getEnableMaxRE (void *const hAmbi) |
Returns the flag value which dictates whether to enable/disable maxrE weighting ('0' disabled, '1' enabled). | |
int | ambi_bin_getEnableDiffuseMatching (void *const hAmbi) |
Returns the flag value which dictates whether the diffuse covariance contraint is currently enabled ('0' disabled, '1' enabled). | |
int | ambi_bin_getEnableTruncationEQ (void *const hAmbi) |
Returns the flag value which dictates whether the truncation EQ is currently enabled ('0' disabled, '1' enabled). | |
AMBI_BIN_PREPROC | ambi_bin_getHRIRsPreProc (void *const hAmbi) |
Returns HRIR pre-processing strategy. | |
int | ambi_bin_getEnableRotation (void *const hAmbi) |
Returns the flag value which dictates whether to enable/disable sound-field rotation ('0' disabled, '1' enabled). | |
float | ambi_bin_getYaw (void *const hAmbi) |
Returns the 'yaw' rotation angle, in degree. | |
float | ambi_bin_getPitch (void *const hAmbi) |
Returns the 'pitch' rotation angle, in degrees. | |
float | ambi_bin_getRoll (void *const hAmbi) |
Returns the 'roll' rotation angle, in degrees. | |
int | ambi_bin_getFlipYaw (void *const hAmbi) |
Returns a flag as to whether to "flip" the sign of the current 'yaw' angle ('0' do not flip sign, '1' flip the sign) | |
int | ambi_bin_getFlipPitch (void *const hAmbi) |
Returns a flag as to whether to "flip" the sign of the current 'pitch' angle ('0' do not flip sign, '1' flip the sign) | |
int | ambi_bin_getFlipRoll (void *const hAmbi) |
Returns a flag as to whether to "flip" the sign of the current 'roll' angle ('0' do not flip sign, '1' flip the sign) | |
int | ambi_bin_getRPYflag (void *const hAmbi) |
Returns a flag as to whether to use "yaw-pitch-roll" (0) or "roll-pitch-yaw" (1) rotation order. | |
int | ambi_bin_getNDirs (void *const hAmbi) |
Returns the number of directions in the currently used HRIR set. | |
int | ambi_bin_getHRIRlength (void *const hAmbi) |
Returns the length of HRIRs in time-domain samples. | |
int | ambi_bin_getHRIRsamplerate (void *const hAmbi) |
Returns the HRIR sample rate. | |
int | ambi_bin_getDAWsamplerate (void *const hAmbi) |
Returns the DAW/Host sample rate. | |
int | ambi_bin_getProcessingDelay (void) |
Returns the processing delay in samples (may be used for delay compensation features) | |
A binaural Ambisonic decoder for reproducing Ambisonic sound scenes over headphones.
The decoder offers choice over many different binaural decoding options [1-4] It also supports sound-field rotation for head-tracking and can accomodate loading custom HRIR sets via the SOFA standard.
Definition in file ambi_bin.h.
#define AMBI_BIN_NUM_DECODING_METHODS ( 5 ) |
Number of decoding method options.
Definition at line 138 of file ambi_bin.h.
#define AMBI_BIN_NUM_HRIR_PREPROC_OPTIONS ( 4 ) |
Number of HRIR pre-preprocessing options.
Definition at line 149 of file ambi_bin.h.
Available decoding methods for the ambi_bin example.
See saf_hoa_internal.h for a more indepth descriptions of the approaches.
Definition at line 126 of file ambi_bin.h.
enum AMBI_BIN_PREPROC |
Available HRIR pre-preprocessing options.
Definition at line 141 of file ambi_bin.h.
void ambi_bin_create | ( | void **const | phAmbi | ) |
Creates an instance of ambi_bin.
[in] | phAmbi | (&) address of ambi_bin handle |
Definition at line 50 of file ambi_bin.c.
void ambi_bin_destroy | ( | void **const | phAmbi | ) |
Destroys an instance of ambi_bin.
[in] | phAmbi | (&) address of ambi_bin handle |
Definition at line 110 of file ambi_bin.c.
int ambi_bin_getChOrder | ( | void *const | hAmbi | ) |
Returns the Ambisonic channel ordering convention currently being used to decode with, which should match the convention employed by the input signals (see CH_ORDER enum)
Definition at line 725 of file ambi_bin.c.
CODEC_STATUS ambi_bin_getCodecStatus | ( | void *const | hAmbi | ) |
Returns current codec status, see CODEC_STATUS enum.
Definition at line 673 of file ambi_bin.c.
int ambi_bin_getDAWsamplerate | ( | void *const | hAmbi | ) |
AMBI_BIN_DECODING_METHODS ambi_bin_getDecodingMethod | ( | void *const | hAmbi | ) |
Returns the currently selected decoding method (see AMBI_BIN_DECODING_METHODS enum)
Definition at line 709 of file ambi_bin.c.
int ambi_bin_getEnableDiffuseMatching | ( | void *const | hAmbi | ) |
Returns the flag value which dictates whether the diffuse covariance contraint is currently enabled ('0' disabled, '1' enabled).
Definition at line 743 of file ambi_bin.c.
int ambi_bin_getEnableMaxRE | ( | void *const | hAmbi | ) |
Returns the flag value which dictates whether to enable/disable maxrE weighting ('0' disabled, '1' enabled).
Definition at line 737 of file ambi_bin.c.
int ambi_bin_getEnableRotation | ( | void *const | hAmbi | ) |
Returns the flag value which dictates whether to enable/disable sound-field rotation ('0' disabled, '1' enabled).
Definition at line 766 of file ambi_bin.c.
int ambi_bin_getEnableTruncationEQ | ( | void *const | hAmbi | ) |
Returns the flag value which dictates whether the truncation EQ is currently enabled ('0' disabled, '1' enabled).
Definition at line 749 of file ambi_bin.c.
int ambi_bin_getFlipPitch | ( | void *const | hAmbi | ) |
Returns a flag as to whether to "flip" the sign of the current 'pitch' angle ('0' do not flip sign, '1' flip the sign)
Definition at line 796 of file ambi_bin.c.
int ambi_bin_getFlipRoll | ( | void *const | hAmbi | ) |
Returns a flag as to whether to "flip" the sign of the current 'roll' angle ('0' do not flip sign, '1' flip the sign)
Definition at line 802 of file ambi_bin.c.
int ambi_bin_getFlipYaw | ( | void *const | hAmbi | ) |
Returns a flag as to whether to "flip" the sign of the current 'yaw' angle ('0' do not flip sign, '1' flip the sign)
Definition at line 790 of file ambi_bin.c.
int ambi_bin_getFrameSize | ( | void | ) |
Returns the processing framesize (i.e., number of samples processed with every _process() call )
Definition at line 668 of file ambi_bin.c.
int ambi_bin_getHRIRlength | ( | void *const | hAmbi | ) |
Returns the length of HRIRs in time-domain samples.
Definition at line 821 of file ambi_bin.c.
int ambi_bin_getHRIRsamplerate | ( | void *const | hAmbi | ) |
AMBI_BIN_PREPROC ambi_bin_getHRIRsPreProc | ( | void *const | hAmbi | ) |
Returns HRIR pre-processing strategy.
(see AMBI_BIN_PREPROC enum)
Definition at line 697 of file ambi_bin.c.
int ambi_bin_getInputOrderPreset | ( | void *const | hAmbi | ) |
Returns the decoding order.
If decoding order is higher than the input signal order, the extra required channels are filled with zeros. If the decoding order is lower than the input signal order, the number input signals is truncated accordingly.
Definition at line 703 of file ambi_bin.c.
int ambi_bin_getNDirs | ( | void *const | hAmbi | ) |
Returns the number of directions in the currently used HRIR set.
Definition at line 814 of file ambi_bin.c.
int ambi_bin_getNormType | ( | void *const | hAmbi | ) |
Returns the Ambisonic normalisation convention currently being usedto decode with, which should match the convention employed by the input signals (see NORM_TYPES enum).
Definition at line 731 of file ambi_bin.c.
int ambi_bin_getNSHrequired | ( | void *const | hAmbi | ) |
Returns the number of spherical harmonic signals required by the current decoding order: (current_order+1)^2.
Definition at line 760 of file ambi_bin.c.
int ambi_bin_getNumEars | ( | void | ) |
Returns the number of ears possessed by the average homo sapien (2)
Definition at line 755 of file ambi_bin.c.
float ambi_bin_getPitch | ( | void *const | hAmbi | ) |
Returns the 'pitch' rotation angle, in degrees.
Definition at line 778 of file ambi_bin.c.
int ambi_bin_getProcessingDelay | ( | void | ) |
Returns the processing delay in samples (may be used for delay compensation features)
Definition at line 841 of file ambi_bin.c.
float ambi_bin_getProgressBar0_1 | ( | void *const | hAmbi | ) |
(Optional) Returns current intialisation/processing progress, between 0..1
Definition at line 679 of file ambi_bin.c.
void ambi_bin_getProgressBarText | ( | void *const | hAmbi, |
char * | text ) |
(Optional) Returns current intialisation/processing progress text
Definition at line 685 of file ambi_bin.c.
float ambi_bin_getRoll | ( | void *const | hAmbi | ) |
Returns the 'roll' rotation angle, in degrees.
Definition at line 784 of file ambi_bin.c.
int ambi_bin_getRPYflag | ( | void *const | hAmbi | ) |
Returns a flag as to whether to use "yaw-pitch-roll" (0) or "roll-pitch-yaw" (1) rotation order.
Definition at line 808 of file ambi_bin.c.
char * ambi_bin_getSofaFilePath | ( | void *const | hAmbi | ) |
Returns the file path for a .sofa file.
Definition at line 715 of file ambi_bin.c.
int ambi_bin_getUseDefaultHRIRsflag | ( | void *const | hAmbi | ) |
Returns the value of a flag used to dictate whether the default HRIRs in the Spatial_Audio_Framework should be used (1), or a custom HRIR set loaded via a SOFA file (0).
Definition at line 691 of file ambi_bin.c.
float ambi_bin_getYaw | ( | void *const | hAmbi | ) |
Returns the 'yaw' rotation angle, in degree.
Definition at line 772 of file ambi_bin.c.
void ambi_bin_init | ( | void *const | hAmbi, |
int | samplerate ) |
Initialises ambi_bin with default settings, and samplerate.
[in] | hAmbi | ambi_bin handle |
[in] | samplerate | host samplerate. |
Definition at line 148 of file ambi_bin.c.
void ambi_bin_initCodec | ( | void *const | hAmbi | ) |
Intialises the codec variables, based on current global/user parameters.
[in] | hAmbi | ambi_bin handle |
Definition at line 168 of file ambi_bin.c.
void ambi_bin_process | ( | void *const | hAmbi, |
const float *const * | inputs, | ||
float *const *const | outputs, | ||
int | nInputs, | ||
int | nOutputs, | ||
int | nSamples ) |
Decodes input spherical harmonic signals to the binaural channels.
[in] | hAmbi | ambi_bin handle |
[in] | inputs | Input channel buffers; 2-D array: nInputs x nSamples |
[in] | outputs | Output channel buffers; 2-D array: nOutputs x nSamples |
[in] | nInputs | Number of input channels |
[in] | nOutputs | Number of output channels |
[in] | nSamples | Number of samples in 'inputs'/'output' matrices |
Definition at line 402 of file ambi_bin.c.
void ambi_bin_refreshParams | ( | void *const | hAmbi | ) |
Sets intialisation flags to 1, so as to re-initialise all settings/variables (as ambi_bin is currently configured), at next available opportunity.
Definition at line 505 of file ambi_bin.c.
void ambi_bin_setChOrder | ( | void *const | hAmbi, |
int | newOrder ) |
Sets the Ambisonic channel ordering convention to decode with, in order to match the convention employed by the input signals.
Definition at line 555 of file ambi_bin.c.
void ambi_bin_setDecodingMethod | ( | void *const | hAmbi, |
AMBI_BIN_DECODING_METHODS | newMethod ) |
Sets the decoding method (see AMBI_BIN_DECODING_METHODS enum)
Definition at line 548 of file ambi_bin.c.
void ambi_bin_setEnableDiffuseMatching | ( | void *const | hAmbi, |
int | newState ) |
Sets a flag to enable/disable (1 or 0) the diffuse-covariance constraint.
Definition at line 578 of file ambi_bin.c.
void ambi_bin_setEnableMaxRE | ( | void *const | hAmbi, |
int | newState ) |
Sets a flag to enable/disable the max_rE weighting.
Definition at line 569 of file ambi_bin.c.
void ambi_bin_setEnableRotation | ( | void *const | hAmbi, |
int | newState ) |
Sets the flag to enable/disable (1 or 0) sound-field rotation.
Definition at line 605 of file ambi_bin.c.
void ambi_bin_setEnableTruncationEQ | ( | void *const | hAmbi, |
int | newState ) |
Sets a flag to enable/disable (1 or 0) truncation EQ.
Definition at line 587 of file ambi_bin.c.
void ambi_bin_setFlipPitch | ( | void *const | hAmbi, |
int | newState ) |
Sets a flag as to whether to "flip" the sign of the current 'pitch' angle.
Definition at line 641 of file ambi_bin.c.
void ambi_bin_setFlipRoll | ( | void *const | hAmbi, |
int | newState ) |
Sets a flag as to whether to "flip" the sign of the current 'roll' angle.
Definition at line 650 of file ambi_bin.c.
void ambi_bin_setFlipYaw | ( | void *const | hAmbi, |
int | newState ) |
Sets a flag as to whether to "flip" the sign of the current 'yaw' angle.
Definition at line 632 of file ambi_bin.c.
void ambi_bin_setHRIRsPreProc | ( | void *const | hAmbi, |
AMBI_BIN_PREPROC | newType ) |
Sets HRIR pre-processing strategy (see AMBI_BIN_PREPROC enum)
Definition at line 596 of file ambi_bin.c.
void ambi_bin_setInputOrderPreset | ( | void *const | hAmbi, |
SH_ORDERS | newPreset ) |
Sets the decoding order (see SH_ORDERS enum)
Definition at line 534 of file ambi_bin.c.
void ambi_bin_setNormType | ( | void *const | hAmbi, |
int | newType ) |
Sets the Ambisonic normalisation convention to decode with, in order to match with the convention employed by the input signals.
Definition at line 562 of file ambi_bin.c.
void ambi_bin_setPitch | ( | void *const | hAmbi, |
float | newPitch ) |
Sets the 'pitch' rotation angle, in degrees.
Definition at line 618 of file ambi_bin.c.
void ambi_bin_setRoll | ( | void *const | hAmbi, |
float | newRoll ) |
Sets the 'roll' rotation angle, in degrees.
Definition at line 625 of file ambi_bin.c.
void ambi_bin_setRPYflag | ( | void *const | hAmbi, |
int | newState ) |
Sets a flag as to whether to use "yaw-pitch-roll" (0) or "roll-pitch-yaw" (1) rotation order.
Definition at line 659 of file ambi_bin.c.
void ambi_bin_setSofaFilePath | ( | void *const | hAmbi, |
const char * | path ) |
Sets the file path for a .sofa file, in order to employ a custom HRIR set for the decoding.
[in] | hAmbi | ambi_bin handle |
[in] | path | File path to .sofa file (WITH file extension) |
Definition at line 522 of file ambi_bin.c.
void ambi_bin_setUseDefaultHRIRsflag | ( | void *const | hAmbi, |
int | newState ) |
Sets flag to dictate whether the default HRIRs in the Spatial_Audio_Framework should be used, or a custom HRIR set loaded via a SOFA file.
[in] | hAmbi | ambi_bin handle |
[in] | newState | '0' use custom HRIR set, '1' use default HRIR set |
Definition at line 512 of file ambi_bin.c.
void ambi_bin_setYaw | ( | void *const | hAmbi, |
float | newYaw_deg ) |
Sets the 'yaw' rotation angle, in degrees.
Definition at line 611 of file ambi_bin.c.