46#ifndef __AMBI_DEC_INTERNAL_H_INCLUDED__
47#define __AMBI_DEC_INTERNAL_H_INCLUDED__
61#if !defined(AMBI_DEC_FRAME_SIZE)
62# if defined(FRAME_SIZE)
63# define AMBI_DEC_FRAME_SIZE ( FRAME_SIZE )
65# define AMBI_DEC_FRAME_SIZE ( 128 )
68#define HOP_SIZE ( 128 )
69#define HYBRID_BANDS ( HOP_SIZE + 5 )
70#define TIME_SLOTS ( AMBI_DEC_FRAME_SIZE / HOP_SIZE )
71#define MAX_NUM_LOUDSPEAKERS ( MAX_NUM_OUTPUTS )
72#define MIN_NUM_LOUDSPEAKERS ( 4 )
73#define NUM_DECODERS ( 2 )
76#if (AMBI_DEC_FRAME_SIZE % HOP_SIZE != 0)
77# error "AMBI_DEC_FRAME_SIZE must be an integer multiple of HOP_SIZE"
88typedef struct _ambi_dec_codecPars
106 int hrtf_vbapTableRes[2];
127typedef struct _ambi_dec
#define MAX_SH_ORDER
Maximum supported Ambisonic order.
LOUDSPEAKER_ARRAY_PRESETS
Available loudspeaker array presets.
PROC_STATUS
Current status of the processing loop.
NORM_TYPES
Available Ambisonic normalisation conventions.
CH_ORDER
Available Ambisonic channel ordering conventions.
CODEC_STATUS
Current status of the codec.
#define HYBRID_BANDS
Number of frequency bands.
A frequency-dependent Ambisonic decoder for reproducing Ambisonic sound scenes over loudspeakers.
AMBI_DEC_DIFFUSE_FIELD_EQ_APPROACH
When using mixed order decoding (i.e.
AMBI_DEC_DECODING_METHODS
Available decoding methods.
void loadLoudspeakerArrayPreset(LOUDSPEAKER_ARRAY_PRESETS preset, float dirs_deg[MAX_NUM_LOUDSPEAKERS][2], int *nCH, int *nDims)
Returns the loudspeaker directions for a specified loudspeaker array preset.
void ambi_dec_setCodecStatus(void *const hCmp, CODEC_STATUS newStatus)
Sets codec status (see CODEC_STATUS enum)
#define HYBRID_BANDS
Number of frequency bands.
void ambi_dec_interpHRTFs(void *const hAmbi, float azimuth_deg, float elevation_deg, float_complex h_intrp[HYBRID_BANDS][NUM_EARS])
Interpolates between the 3 nearest HRTFs using amplitude-preserving VBAP gains.
#define MAX_NUM_LOUDSPEAKERS
Maximum permitted output channels.
#define NUM_DECODERS
One for low-frequencies and another for high-frequencies.
#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, HRTF interpolation, and the loudspeaker decoders.
char * sofa_filepath
absolute/relevative file path for a sofa file
int hrtf_nTriangles
number of triangle groups after triangulation
float * itds_s
interaural-time differences for each HRIR (in seconds); N_hrirs x 1
int * hrtf_vbap_gtableIdx
N_hrtf_vbap_gtable x 3.
int hrir_len
length of the HRIRs, this can be truncated, see "saf_sofa_reader.h"
float_complex * hrtf_fb
HRTF filterbank coefficients; nBands x nCH x N_hrirs.
int hrir_fs
sampling rate of the HRIRs, should ideally match the host sampling rate, although not required
float * hrtf_fb_mag
magnitudes of the HRTF filterbank coefficients; nBands x nCH x N_hrirs
int N_hrtf_vbap_gtable
number of interpolation directions
float * weights
grid integration weights of hrirs; N_hrirs x 1
int N_hrir_dirs
number of HRIR directions in the current sofa file
float * hrtf_vbap_gtableComp
N_hrtf_vbap_gtable x 3.
float * hrirs
time domain HRIRs; N_hrir_dirs x 2 x hrir_len
float * hrir_dirs_deg
directions of the HRIRs in degrees [azi elev]; N_hrir_dirs x 2
Main structure for ambi_dec.
CODEC_STATUS codecStatus
see CODEC_STATUS
int new_nLoudpkrs
if new_nLoudpkrs != nLoudpkrs, afSTFT is reinitialised (current value will be replaced by this after ...
int new_masterOrder
if new_masterOrder != masterOrder, ambi_dec is reinitialised (current value will be replaced by this ...
CH_ORDER chOrdering
Ambisonic channel order convention (see CH_ORDER)
int afSTFTdelay
for host delay compensation
int loudpkrs_nDims
dimensionality of the current loudspeaker set-up
float ** SHFrameTD
Input spherical harmonic (SH) signals in the time-domain; MAX_NUM_SH_SIGNALS x AMBI_DEC_FRAME_SIZE.
float_complex *** binframeTF
Output binaural signals in the time-frequency domain; HYBRID_BANDS x NUM_EARS x TIME_SLOTS.
int useDefaultHRIRsFLAG
1: use default HRIRs in database, 0: use those from SOFA file
float transitionFreq
transition frequency for the 2 decoders, in Hz
void * hSTFT
afSTFT handle
float_complex *** SHframeTF
Input spherical harmonic (SH) signals in the time-frequency domain; HYBRID_BANDS x MAX_NUM_SH_SIGNALS...
int enableHRIRsPreProc
flag to apply pre-processing to the currently loaded HRTFs
float progressBar0_1
Current (re)initialisation progress, between [0..1].
int masterOrder
Current maximum/master decoding order.
NORM_TYPES norm
Ambisonic normalisation convention (see NORM_TYPES)
float ** outputFrameTD
Output loudspeaker or binaural signals in the time-domain; MAX_NUM_LOUDSPEAKERS x AMBI_DEC_FRAME_SIZE...
int nLoudpkrs
number of loudspeakers/virtual loudspeakers
PROC_STATUS procStatus
see PROC_STATUS
char * progressBarText
Current (re)initialisation step, string.
int binauraliseLS
1: convolve loudspeaker signals with HRTFs, 0: output loudspeaker signals
ambi_dec_codecPars * pars
codec parameters
float_complex *** outputframeTF
Output loudspeaker signals in the time-frequency domain; HYBRID_BANDS x MAX_NUM_LOUDSPEAKERS x TIME_S...
int new_binauraliseLS
if new_binauraliseLS != binauraliseLS, ambi_dec is reinitialised (current value will be replaced by t...
int reinit_hrtfsFLAG
0: no init required, 1: init required