48#ifndef __AMBI_BIN_INTERNAL_H_INCLUDED__
49#define __AMBI_BIN_INTERNAL_H_INCLUDED__
63#if !defined(AMBI_BIN_FRAME_SIZE)
64# if defined(FRAME_SIZE)
65# define AMBI_BIN_FRAME_SIZE ( FRAME_SIZE )
67# define AMBI_BIN_FRAME_SIZE ( 128 )
70#define HOP_SIZE ( 128 )
71#define HYBRID_BANDS ( HOP_SIZE + 5 )
72#define TIME_SLOTS ( AMBI_BIN_FRAME_SIZE / HOP_SIZE )
73#define POST_GAIN ( -9.0f )
76#if (AMBI_BIN_FRAME_SIZE % HOP_SIZE != 0)
77# error "AMBI_BIN_FRAME_SIZE must be an integer multiple of HOP_SIZE"
80#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_ATOMICS__)
94typedef struct _ambi_bin_codecPars
121typedef struct _ambi_bin
154 _Atomic_AMBI_BIN_DECODING_METHODS
method;
#define MAX_NUM_SH_SIGNALS
Maximum number of spherical harmonic components/signals supported.
CODEC_STATUS
Current status of the codec.
A binaural Ambisonic decoder for reproducing Ambisonic sound scenes over headphones.
AMBI_BIN_DECODING_METHODS
Available decoding methods for the ambi_bin example.
AMBI_BIN_PREPROC
Available HRIR pre-preprocessing options.
#define HYBRID_BANDS
Number of frequency bands.
void ambi_bin_setCodecStatus(void *const hAmbi, CODEC_STATUS newStatus)
Sets codec status.
#define NUM_EARS
2 (true for most humans)
Main include header for the Spatial_Audio_Framework (SAF)
Include header for SAF externals.
Contains variables for sofa file loading, HRIRs, and the binaural decoder.
float * hrir_dirs_deg
directions of the HRIRs in degrees [azi elev]; FLAT: N_hrir_dirs x 2
float * weights
grid integration weights of hrirs; N_hrirs x 1
_Atomic_INT32 N_hrir_dirs
number of HRIR directions in the current sofa file
float_complex * hrtf_fb
HRTF filterbank coeffs; FLAT: nBands x nCH x N_hrirs.
char * sofa_filepath
absolute/relevative file path for a sofa file
_Atomic_INT32 hrir_len
length of the HRIRs, this can be truncated, see "saf_sofa_reader.h"
float_complex M_dec_rot[HYBRID_BANDS][NUM_EARS][MAX_NUM_SH_SIGNALS]
Decording matrix per band, with sound-field rotation baked-in.
float * hrirs
time domain HRIRs; FLAT: N_hrir_dirs x 2 x hrir_len
float_complex M_dec[HYBRID_BANDS][NUM_EARS][MAX_NUM_SH_SIGNALS]
Decoding matrix per band.
float * itds_s
interaural-time differences for each HRIR (in seconds); N_hrirs x 1
_Atomic_INT32 hrir_fs
sampling rate of the HRIRs, should ideally match the host sampling rate, although not required
Main structure for ambi_bin.
_Atomic_INT32 fs
host sampling rate
float_complex *** binframeTF
Output binaural signals in the time-frequency domain; HYBRID_BANDS x NUM_EARS x TIME_SLOTS.
_Atomic_INT32 enableRotation
Whether rotation should be enabled (1) or disabled (0)
_Atomic_CODEC_STATUS codecStatus
see CODEC_STATUS
_Atomic_AMBI_BIN_PREPROC preProc
HRIR pre-processing strategy.
_Atomic_INT32 enableTruncationEQ
0: disabled, 1: enabled
int afSTFTdelay
for host delay compensation
_Atomic_INT32 reinit_hrtfsFLAG
0: no init required, 1: init required
float_complex M_rot[MAX_NUM_SH_SIGNALS][MAX_NUM_SH_SIGNALS]
Current SH rotation matrix.
_Atomic_FLOAT32 pitch
pitch (Euler) rotation angle, in degrees
_Atomic_NORM_TYPES norm
Ambisonic normalisation convention (see NORM_TYPES)
char * progressBarText
Current (re)initialisation step, string.
_Atomic_INT32 useDefaultHRIRsFLAG
1: use default HRIRs in database, 0: use those from SOFA file
_Atomic_FLOAT32 yaw
yaw (Euler) rotation angle, in degrees
_Atomic_INT32 enableDiffuseMatching
0: disabled, 1: enabled
_Atomic_FLOAT32 roll
roll (Euler) rotation angle, in degrees
_Atomic_INT32 new_order
new decoding order (current value will be replaced by this after next re-init)
_Atomic_INT32 enableMaxRE
0: disabled, 1: enabled
void * hSTFT
afSTFT handle
_Atomic_INT32 nSH
number of spherical harmonic signals
_Atomic_AMBI_BIN_DECODING_METHODS method
current decoding method (see AMBI_BIN_DECODING_METHODS)
_Atomic_INT32 useRollPitchYawFlag
rotation order flag, 1: r-p-y, 0: y-p-r
float_complex *** SHframeTF
Input spherical harmonic (SH) signals in the time-frequency domain; HYBRID_BANDS x MAX_NUM_SH_SIGNALS...
float freqVector[HYBRID_BANDS]
frequency vector for time-frequency transform, in Hz
_Atomic_PROC_STATUS procStatus
see PROC_STATUS
_Atomic_INT32 bFlipYaw
flag to flip the sign of the yaw rotation angle
_Atomic_FLOAT32 progressBar0_1
Current (re)initialisation progress, between [0..1].
_Atomic_INT32 recalc_M_rotFLAG
0: no init required, 1: init required
_Atomic_INT32 bFlipRoll
flag to flip the sign of the roll rotation angle
ambi_bin_codecPars * pars
Decoding specific data.
_Atomic_CH_ORDER chOrdering
Ambisonic channel order convention (see CH_ORDER)
_Atomic_INT32 order
current decoding order
float ** SHFrameTD
Input spherical harmonic (SH) signals in the time-domain; MAX_NUM_SH_SIGNALS x AMBI_BIN_FRAME_SIZE.
_Atomic_INT32 bFlipPitch
flag to flip the sign of the pitch rotation angle
float ** binFrameTD
Output binaural signals in the time-domain; NUM_EARS x AMBI_BIN_FRAME_SIZE.