50#ifndef __ARRAY2SH_INTERNAL_H_INCLUDED__
51#define __ARRAY2SH_INTERNAL_H_INCLUDED__
65#if !defined(ARRAY2SH_FRAME_SIZE)
66# if defined(FRAME_SIZE)
67# define ARRAY2SH_FRAME_SIZE ( FRAME_SIZE )
69# define ARRAY2SH_FRAME_SIZE ( 128 )
72#define HOP_SIZE ( 128 )
73#define HYBRID_BANDS ( HOP_SIZE + 5 )
74#define TIME_SLOTS ( ARRAY2SH_FRAME_SIZE / HOP_SIZE )
75#define MAX_NUM_SENSORS ( ARRAY2SH_MAX_NUM_SENSORS )
76#define MAX_EVAL_FREQ_HZ ( 20e3f )
77#define MAX_NUM_SENSORS_IN_PRESET ( MAX_NUM_SENSORS )
80#if (ARRAY2SH_FRAME_SIZE % HOP_SIZE != 0)
81# error "ARRAY2SH_FRAME_SIZE must be an integer multiple of HOP_SIZE"
84#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_ATOMICS__)
103typedef struct _array2sh_arrayPars {
119typedef struct _array2sh
154 double_complex* L_diff_fal;
155 double_complex* L_diff;
156 double_complex* E_diff;
157 double_complex* W_diffEQ_tmp;
158 double_complex* W_tmp;
167 _Atomic_ARRAY2SH_MICROPHONE_ARRAY_PRESETS
preset;
246 _Atomic_INT32* arrayOrder,
#define MAX_SH_ORDER
Maximum supported Ambisonic order.
#define MAX_NUM_SH_SIGNALS
Maximum number of spherical harmonic components/signals supported.
Spatially encodes spherical microphone array signals into spherical harmonic signals (aka: Ambisonic ...
ARRAY2SH_MICROPHONE_ARRAY_PRESETS
Available microphone array presets.
ARRAY2SH_FILTER_TYPES
Available encoding filter approaches.
ARRAY2SH_WEIGHT_TYPES
List of supported sensor directivities and array construction types.
ARRAY2SH_ARRAY_TYPES
List of supported array types.
ARRAY2SH_EVAL_STATUS
Current status of the encoder evaluation output data.
void array2sh_initArray(void *const hPars, ARRAY2SH_MICROPHONE_ARRAY_PRESETS preset, _Atomic_INT32 *arrayOrder, int firstInitFLAG)
Intialises an instance of a struct based on a preset, which contains the array configuration data.
void array2sh_evaluateSHTfilters(void *hA2sh)
Evaluates the spherical harmonic transform performance with the currently configured microphone/hydro...
void array2sh_calculate_sht_matrix(void *const hA2sh)
Computes the spherical harmonic transform (SHT) matrix, to spatially encode input microphone/hydropho...
void array2sh_initTFT(void *const hA2sh)
Initialise the filterbank used by array2sh.
void array2sh_calculate_mag_curves(void *const hA2sh)
Computes the magnitude responses of the equalisation filters; the absolute values of the regularised ...
#define HYBRID_BANDS
Number of frequency bands.
#define MAX_NUM_SENSORS
Maximum permitted number of inputs/sensors.
void array2sh_apply_diff_EQ(void *const hA2sh)
Applies diffuse-field equalisation at frequencies above the spatial aliasing limit.
void array2sh_destroyArray(void **const hPars)
Destroys an instance of a struct, which contains the array configuration data.
void array2sh_createArray(void **const hPars)
Creates an instance of a struct, which contains the array configuration data.
Main include header for the Spatial_Audio_Framework (SAF)
Include header for SAF externals.
Contains variables for describing the microphone/hydrophone array.
_Atomic_FLOAT32 r
radius of sensors
_Atomic_ARRAY2SH_WEIGHT_TYPES weightType
see ARRAY2SH_WEIGHT_TYPES
_Atomic_ARRAY2SH_ARRAY_TYPES arrayType
see ARRAY2SH_ARRAY_TYPES
_Atomic_FLOAT32 R
radius of scatterer (only for rigid arrays)
_Atomic_INT32 Q
Current number of sensors.
_Atomic_INT32 newQ
New number of sensors (current value replaced by this after next re-init)
_Atomic_FLOAT32 sensorCoords_deg[MAX_NUM_SENSORS][2]
Sensor directions in degrees.
_Atomic_FLOAT32 sensorCoords_rad[MAX_NUM_SENSORS][2]
Sensor directions in radians.
Main structure for array2sh.
float ** SHframeTD
Output SH signals in the time-domain; MAX_NUM_SH_SIGNALS x ARRAY2SH_FRAME_SIZE.
float_complex *** inputframeTF
Input sensor signals in the time-domain; HYBRID_BANDS x MAX_NUM_SENSORS x TIME_SLOTS.
_Atomic_FLOAT32 progressBar0_1
Current (re)initialisation progress, between [0..1].
_Atomic_FLOAT32 gain_dB
post gain, dB
_Atomic_FLOAT32 regPar
regularisation upper gain limit, dB;
float freqVector[HYBRID_BANDS]
frequency vector
double_complex * bN
Temp vector for the modal coefficients.
char * progressBarText
Current (re)initialisation step, string.
double_complex bN_inv[HYBRID_BANDS][MAX_SH_ORDER+1]
1/bN_modal
_Atomic_ARRAY2SH_MICROPHONE_ARRAY_PRESETS preset
currently selected MIC preset
_Atomic_INT32 reinitSHTmatrixFLAG
0: do not reinit; 1: reinit;
_Atomic_PROC_STATUS procStatus
see PROC_STATUS
void * hSTFT
filterbank handle
float ** bN_modal_dB
modal responses / no regulaisation; HYBRID_BANDS x (MAX_SH_ORDER +1)
void * arraySpecs
array configuration
_Atomic_INT32 enableDiffEQpastAliasing
0: disabled, 1: enabled
double_complex bN_modal[HYBRID_BANDS][MAX_SH_ORDER+1]
Current modal coeffients.
float ** inputFrameTD
Input sensor signals in the time-domain; MAX_NUM_SENSORS x ARRAY2SH_FRAME_SIZE.
double_complex bN_inv_R[HYBRID_BANDS][MAX_NUM_SH_SIGNALS]
1/bN_modal with regularisation
float_complex *** SHframeTF
Output SH signals in the time-domain; HYBRID_BANDS x MAX_NUM_SH_SIGNALS x TIME_SLOTS.
float_complex W_diffEQ[HYBRID_BANDS][MAX_NUM_SH_SIGNALS][MAX_NUM_SENSORS]
Encoding weights with diffuse-field EQ above the spatial aliasing limit.
float * cSH
spatial correlation; HYBRID_BANDS x 1
_Atomic_INT32 new_order
new encoding order (current value will be replaced by this after next re-init)
_Atomic_INT32 evalRequestedFLAG
0: do not reinit; 1: reinit;
_Atomic_FLOAT32 c
speed of sound, m/s
_Atomic_ARRAY2SH_FILTER_TYPES filterType
encoding filter approach
_Atomic_ARRAY2SH_EVAL_STATUS evalStatus
see ARRAY2SH_EVAL_STATUS
_Atomic_NORM_TYPES norm
Ambisonic normalisation convention (see NORM_TYPES)
float ** bN_inv_dB
modal responses / with regularisation; HYBRID_BANDS x (MAX_SH_ORDER +1)
float * lSH
level difference; HYBRID_BANDS x 1
_Atomic_INT32 order
current encoding order
_Atomic_CH_ORDER chOrdering
Ambisonic channel order convention (see CH_ORDER)
float_complex W[HYBRID_BANDS][MAX_NUM_SH_SIGNALS][MAX_NUM_SENSORS]
Encoding weights.