SAF
Loading...
Searching...
No Matches
ambi_enc.c
Go to the documentation of this file.
1/*
2 * Copyright 2016-2018 Leo McCormack
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10 * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14 * PERFORMANCE OF THIS SOFTWARE.
15 */
16
26#include "ambi_enc.h"
27#include "ambi_enc_internal.h"
28
30(
31 void ** const phAmbi
32)
33{
35 *phAmbi = (void*)pData;
36 int i;
37
38 pData->order = 1;
39 pData->fs = 48000.0f;
40
41 /* default user parameters */
42 loadSourceConfigPreset(SOURCE_CONFIG_PRESET_DEFAULT, pData->src_dirs_deg, &(pData->new_nSources));
43 pData->nSources = pData->new_nSources;
44 for(i=0; i<MAX_NUM_INPUTS; i++){
45 pData->recalc_SH_FLAG[i] = 1;
46 pData->src_gains[i] = 1.f;
47 }
48 pData->chOrdering = CH_ACN;
49 pData->norm = NORM_SN3D;
50 pData->order = SH_ORDER_FIRST;
51 pData->enablePostScaling = 1;
52}
53
55(
56 void ** const phAmbi
57)
58{
59 ambi_enc_data *pData = (ambi_enc_data*)(*phAmbi);
60
61 if (pData != NULL) {
62 free(pData);
63 pData = NULL;
64 *phAmbi = NULL;
65 }
66}
67
69(
70 void * const hAmbi,
71 int sampleRate
72)
73{
74 ambi_enc_data *pData = (ambi_enc_data*)(hAmbi);
75 int i;
76
77 pData->fs = (float)sampleRate;
78 for(i=1; i<=AMBI_ENC_FRAME_SIZE; i++){
79 pData->interpolator_fadeIn[i-1] = (float)i*1.0f/(float)AMBI_ENC_FRAME_SIZE;
80 pData->interpolator_fadeOut[i-1] = 1.0f - pData->interpolator_fadeIn[i-1];
81 }
82 memset(pData->prev_Y, 0, MAX_NUM_SH_SIGNALS*MAX_NUM_INPUTS*sizeof(float));
83 memset(pData->prev_inputFrameTD, 0, MAX_NUM_INPUTS*AMBI_ENC_FRAME_SIZE*sizeof(float));
84 for(i=0; i<MAX_NUM_INPUTS; i++)
85 pData->recalc_SH_FLAG[i] = 1;
86}
87
89(
90 void * const hAmbi,
91 const float *const * inputs,
92 float* const* const outputs,
93 int nInputs,
94 int nOutputs,
95 int nSamples
96)
97{
98 ambi_enc_data *pData = (ambi_enc_data*)(hAmbi);
99 int i, j, ch, nSources, nSH, mixWithPreviousFLAG;
100 float src_dirs[MAX_NUM_INPUTS][2], scale;
101 float Y_src[MAX_NUM_SH_SIGNALS];
102
103 /* local copies of user parameters */
104 CH_ORDER chOrdering;
105 NORM_TYPES norm;
106 int order;
107 chOrdering = pData->chOrdering;
108 norm = pData->norm;
109 nSources = pData->nSources;
110 memcpy(src_dirs, pData->src_dirs_deg, MAX_NUM_INPUTS*2*sizeof(float));
111 order = SAF_MIN(pData->order, MAX_SH_ORDER);
112 nSH = ORDER2NSH(order);
113
114 /* Process frame */
115 if (nSamples == AMBI_ENC_FRAME_SIZE) {
116 /* Load time-domain data */
117 for(i=0; i < SAF_MIN(nSources,nInputs); i++)
118 utility_svvcopy(inputs[i], AMBI_ENC_FRAME_SIZE, pData->inputFrameTD[i]);
119 for(; i<MAX_NUM_INPUTS; i++)
120 memset(pData->inputFrameTD[i], 0, AMBI_ENC_FRAME_SIZE * sizeof(float));
121
122 /* recalulate SHs (only if encoding direction has changed) */
123 mixWithPreviousFLAG = 0;
124 for(ch=0; ch<nSources; ch++){
125 if(pData->recalc_SH_FLAG[ch]){
126 getRSH_recur(order, pData->src_dirs_deg[ch], 1, (float*)Y_src);
127 for(j=0; j<nSH; j++)
128 pData->Y[j][ch] = Y_src[j];
129 for(; j<MAX_NUM_SH_SIGNALS; j++)
130 pData->Y[j][ch] = 0.0f;
131 pData->recalc_SH_FLAG[ch] = 0;
132
133 /* If encoding gains have changed, then we should also mix with and interpolate the previous gains */
134 mixWithPreviousFLAG = 1;
135 }
136 /* Apply source gains */
137 if(fabsf(pData->src_gains[ch] - 1.f) > 1e-6f)
138 utility_svsmul(pData->inputFrameTD[ch], &(pData->src_gains[ch]), AMBI_ENC_FRAME_SIZE, NULL);
139 }
140
141 /* spatially encode the input signals into spherical harmonic signals */
142 cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, nSH, AMBI_ENC_FRAME_SIZE, nSources, 1.0f,
143 (float*)pData->Y, MAX_NUM_INPUTS,
144 (float*)pData->prev_inputFrameTD, AMBI_ENC_FRAME_SIZE, 0.0f,
145 (float*)pData->outputFrameTD, AMBI_ENC_FRAME_SIZE);
146
147 /* Fade between (linearly inerpolate) the new gains and the previous gains (only if the new gains are different) */
148 if(mixWithPreviousFLAG){
149 cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, nSH, AMBI_ENC_FRAME_SIZE, nSources, 1.0f,
150 (float*)pData->prev_Y, MAX_NUM_INPUTS,
151 (float*)pData->prev_inputFrameTD, AMBI_ENC_FRAME_SIZE, 0.0f,
152 (float*)pData->tempFrame, AMBI_ENC_FRAME_SIZE);
153
154 /* Apply the linear interpolation */
155 for (i=0; i < nSH; i++){
156 utility_svvmul((float*)pData->interpolator_fadeIn, (float*)pData->outputFrameTD[i], AMBI_ENC_FRAME_SIZE, (float*)pData->outputFrameTD_fadeIn[i]);
157 utility_svvmul((float*)pData->interpolator_fadeOut, (float*)pData->tempFrame[i], AMBI_ENC_FRAME_SIZE, (float*)pData->tempFrame_fadeOut[i]);
158 }
159 cblas_scopy(nSH*AMBI_ENC_FRAME_SIZE, (float*)pData->outputFrameTD_fadeIn, 1, (float*)pData->outputFrameTD, 1);
160 cblas_saxpy(nSH*AMBI_ENC_FRAME_SIZE, 1.0f, (float*)pData->tempFrame_fadeOut, 1, (float*)pData->outputFrameTD, 1);
161
162 /* for next frame */
163 utility_svvcopy((const float*)pData->Y, MAX_NUM_INPUTS*MAX_NUM_SH_SIGNALS, (float*)pData->prev_Y);
164 }
165
166 /* for next frame */
168
169 /* scale by 1/sqrt(nSources) */
170 if(pData->enablePostScaling){
171 scale = 1.0f/sqrtf((float)nSources);
172 cblas_sscal(nSH*AMBI_ENC_FRAME_SIZE, scale, (float*)pData->outputFrameTD, 1);
173 }
174
175 /* account for output channel order */
176 switch(chOrdering){
177 case CH_ACN: /* already ACN, do nothing */ break;
179 }
180
181 /* account for normalisation scheme */
182 switch(norm){
183 case NORM_N3D: /* already N3D, do nothing */ break;
186 }
187
188 /* Copy to output */
189 for(i = 0; i < SAF_MIN(nSH,nOutputs); i++)
190 utility_svvcopy(pData->outputFrameTD[i], AMBI_ENC_FRAME_SIZE, outputs[i]);
191 for(; i < nOutputs; i++)
192 memset(outputs[i], 0, AMBI_ENC_FRAME_SIZE * sizeof(float));
193 }
194 else{
195 for (ch=0; ch < nOutputs; ch++)
196 memset(outputs[ch],0, AMBI_ENC_FRAME_SIZE*sizeof(float));
197 }
198}
199
200/* Set Functions */
201
203{
204 return AMBI_ENC_FRAME_SIZE;
205}
206
207void ambi_enc_refreshParams(void* const hAmbi)
208{
209 ambi_enc_data *pData = (ambi_enc_data*)(hAmbi);
210 int i;
211 for(i=0; i<MAX_NUM_INPUTS; i++)
212 pData->recalc_SH_FLAG[i] = 1;
213}
214
215void ambi_enc_setOutputOrder(void* const hAmbi, int newOrder)
216{
217 ambi_enc_data *pData = (ambi_enc_data*)(hAmbi);
218 int i;
219 if((SH_ORDERS)newOrder != pData->order){
220 pData->order = (SH_ORDERS)newOrder;
221 for(i=0; i<MAX_NUM_INPUTS; i++)
222 pData->recalc_SH_FLAG[i] = 1;
223 /* FUMA only supports 1st order */
224 if(pData->order!=SH_ORDER_FIRST && pData->chOrdering == CH_FUMA)
225 pData->chOrdering = CH_ACN;
226 if(pData->order!=SH_ORDER_FIRST && pData->norm == NORM_FUMA)
227 pData->norm = NORM_SN3D;
228 }
229}
230
231void ambi_enc_setSourceAzi_deg(void* const hAmbi, int index, float newAzi_deg)
232{
233 ambi_enc_data *pData = (ambi_enc_data*)(hAmbi);
234 if(newAzi_deg>180.0f)
235 newAzi_deg = -360.0f + newAzi_deg;
236 newAzi_deg = SAF_MAX(newAzi_deg, -180.0f);
237 newAzi_deg = SAF_MIN(newAzi_deg, 180.0f);
238 pData->recalc_SH_FLAG[index] = 1;
239 pData->src_dirs_deg[index][0] = newAzi_deg;
240}
241
242void ambi_enc_setSourceElev_deg(void* const hAmbi, int index, float newElev_deg)
243{
244 ambi_enc_data *pData = (ambi_enc_data*)(hAmbi);
245 newElev_deg = SAF_MAX(newElev_deg, -90.0f);
246 newElev_deg = SAF_MIN(newElev_deg, 90.0f);
247 pData->recalc_SH_FLAG[index] = 1;
248 pData->src_dirs_deg[index][1] = newElev_deg;
249}
250
251void ambi_enc_setNumSources(void* const hAmbi, int new_nSources)
252{
253 ambi_enc_data *pData = (ambi_enc_data*)(hAmbi);
254 int i;
255 pData->new_nSources = SAF_CLAMP(new_nSources, 1, MAX_NUM_INPUTS);
256 pData->nSources = pData->new_nSources;
257 for(i=0; i<MAX_NUM_INPUTS; i++)
258 pData->recalc_SH_FLAG[i] = 1;
259}
260
261void ambi_enc_setInputConfigPreset(void* const hAmbi, int newPresetID)
262{
263 ambi_enc_data *pData = (ambi_enc_data*)(hAmbi);
264 int ch;
265 loadSourceConfigPreset(newPresetID, pData->src_dirs_deg, &(pData->new_nSources));
266 pData->nSources = pData->new_nSources;
267 for(ch=0; ch<MAX_NUM_INPUTS; ch++)
268 pData->recalc_SH_FLAG[ch] = 1;
269}
270
271void ambi_enc_setChOrder(void* const hAmbi, int newOrder)
272{
273 ambi_enc_data *pData = (ambi_enc_data*)(hAmbi);
274 if((CH_ORDER)newOrder != CH_FUMA || pData->order==SH_ORDER_FIRST)/* FUMA only supports 1st order */
275 pData->chOrdering = (CH_ORDER)newOrder;
276}
277
278void ambi_enc_setNormType(void* const hAmbi, int newType)
279{
280 ambi_enc_data *pData = (ambi_enc_data*)(hAmbi);
281 if((NORM_TYPES)newType != NORM_FUMA || pData->order==SH_ORDER_FIRST)/* FUMA only supports 1st order */
282 pData->norm = (NORM_TYPES)newType;
283}
284
285void ambi_enc_setEnablePostScaling(void* const hAmbi, int newStatus)
286{
287 ambi_enc_data *pData = (ambi_enc_data*)(hAmbi);
288 pData->enablePostScaling = newStatus;
289}
290
291void ambi_enc_setSourceGain(void* const hAmbi, int srcIdx, float newGain)
292{
293 ambi_enc_data *pData = (ambi_enc_data*)(hAmbi);
294 pData->src_gains[srcIdx] = newGain;
295}
296
297void ambi_enc_setSourceSolo(void* const hAmbi, int srcIdx)
298{
299 ambi_enc_data *pData = (ambi_enc_data*)(hAmbi);
300 int i;
301 for(i=0; i<pData->nSources; i++){
302 if(i==srcIdx)
303 pData->src_gains[i] = 1.f;
304 else
305 pData->src_gains[i] = 0.f;
306 }
307}
308
309void ambi_enc_setUnSolo(void* const hAmbi)
310{
311 ambi_enc_data *pData = (ambi_enc_data*)(hAmbi);
312 for(int i=0; i<pData->nSources; i++)
313 pData->src_gains[i] = 1.f;
314}
315
316/* Get Functions */
317
318int ambi_enc_getOutputOrder(void* const hAmbi)
319{
320 ambi_enc_data *pData = (ambi_enc_data*)(hAmbi);
321 return (int)pData->order;
322}
323
324float ambi_enc_getSourceAzi_deg(void* const hAmbi, int index)
325{
326 ambi_enc_data *pData = (ambi_enc_data*)(hAmbi);
327 return pData->src_dirs_deg[index][0];
328}
329
330float ambi_enc_getSourceElev_deg(void* const hAmbi, int index)
331{
332 ambi_enc_data *pData = (ambi_enc_data*)(hAmbi);
333 return pData->src_dirs_deg[index][1];
334}
335
336int ambi_enc_getNumSources(void* const hAmbi)
337{
338 ambi_enc_data *pData = (ambi_enc_data*)(hAmbi);
339 return pData->new_nSources;
340}
341
343{
344 return MAX_NUM_INPUTS;
345}
346
347int ambi_enc_getNSHrequired(void* const hAmbi)
348{
349 ambi_enc_data *pData = (ambi_enc_data*)(hAmbi);
350 return (pData->order+1)*(pData->order+1);
351}
352
353int ambi_enc_getChOrder(void* const hAmbi)
354{
355 ambi_enc_data *pData = (ambi_enc_data*)(hAmbi);
356 return (int)pData->chOrdering;
357}
358
359int ambi_enc_getNormType(void* const hAmbi)
360{
361 ambi_enc_data *pData = (ambi_enc_data*)(hAmbi);
362 return (int)pData->norm;
363}
364
365int ambi_enc_getEnablePostScaling(void* const hAmbi)
366{
367 ambi_enc_data *pData = (ambi_enc_data*)(hAmbi);
368 return pData->enablePostScaling;
369}
370
#define MAX_SH_ORDER
Maximum supported Ambisonic order.
Definition _common.h:52
#define MAX_NUM_INPUTS
Maximum number of input channels supported.
Definition _common.h:233
NORM_TYPES
Available Ambisonic normalisation conventions.
Definition _common.h:74
@ NORM_SN3D
Schmidt semi-normalisation (SN3D)
Definition _common.h:76
@ NORM_FUMA
(Legacy) Furse-Malham scaling
Definition _common.h:77
@ NORM_N3D
orthonormalised (N3D)
Definition _common.h:75
CH_ORDER
Available Ambisonic channel ordering conventions.
Definition _common.h:59
@ CH_ACN
Ambisonic Channel Numbering (ACN)
Definition _common.h:60
@ CH_FUMA
(Legacy) Furse-Malham/B-format (WXYZ)
Definition _common.h:61
#define MAX_NUM_SH_SIGNALS
Maximum number of spherical harmonic components/signals supported.
Definition _common.h:239
SH_ORDERS
Available spherical harmonic (SH) input/output order options.
Definition _common.h:38
@ SH_ORDER_FIRST
First-order (4 channels)
Definition _common.h:39
void ambi_enc_setEnablePostScaling(void *const hAmbi, int newStatus)
By default, ambi_enc will scale the output signals by the number of input signals.
Definition ambi_enc.c:285
int ambi_enc_getFrameSize(void)
Returns the processing framesize (i.e., number of samples processed with every _process() call )
Definition ambi_enc.c:202
void ambi_enc_refreshParams(void *const hAmbi)
Sets all intialisation flags to 1; re-initialising all settings/variables as ambi_enc is currently co...
Definition ambi_enc.c:207
int ambi_enc_getEnablePostScaling(void *const hAmbi)
Returns 0: if post scaling is disabled, 1: if post scaling is enabled.
Definition ambi_enc.c:365
void ambi_enc_setSourceGain(void *const hAmbi, int srcIdx, float newGain)
Sets gain factor for an input source.
Definition ambi_enc.c:291
void ambi_enc_setSourceElev_deg(void *const hAmbi, int index, float newElev_deg)
Sets the elevation for a specific source index.
Definition ambi_enc.c:242
void ambi_enc_setNormType(void *const hAmbi, int newType)
Sets the Ambisonic normalisation convention to encode with (see NORM_TYPES enum)
Definition ambi_enc.c:278
void ambi_enc_setSourceSolo(void *const hAmbi, int srcIdx)
Set a source to solo.
Definition ambi_enc.c:297
int ambi_enc_getMaxNumSources()
Returns the maximum number of input signals/sources that can be encoded.
Definition ambi_enc.c:342
int ambi_enc_getChOrder(void *const hAmbi)
Returns the Ambisonic channel ordering convention currently being used to encode with (see CH_ORDER e...
Definition ambi_enc.c:353
int ambi_enc_getProcessingDelay()
Returns the processing delay in samples (may be used for delay compensation features)
Definition ambi_enc.c:371
void ambi_enc_setUnSolo(void *const hAmbi)
Unsolo / unmute all sources.
Definition ambi_enc.c:309
void ambi_enc_setNumSources(void *const hAmbi, int new_nSources)
Sets the number of input signals/sources to encode.
Definition ambi_enc.c:251
void ambi_enc_setInputConfigPreset(void *const hAmbi, int newPresetID)
Sets the input configuration preset (see SOURCE_CONFIG_PRESETS enum)
Definition ambi_enc.c:261
void ambi_enc_setSourceAzi_deg(void *const hAmbi, int index, float newAzi_deg)
Sets the azimuth for a specific source index.
Definition ambi_enc.c:231
int ambi_enc_getNormType(void *const hAmbi)
Returns the Ambisonic normalisation convention currently being used to encode with (see NORM_TYPES en...
Definition ambi_enc.c:359
void ambi_enc_destroy(void **const phAmbi)
Destroys an instance of ambi_enc.
Definition ambi_enc.c:55
void ambi_enc_create(void **const phAmbi)
Creates an instance of ambi_enc.
Definition ambi_enc.c:30
void ambi_enc_setOutputOrder(void *const hAmbi, int newOrder)
Sets the encoding order (see SH_ORDERS enum)
Definition ambi_enc.c:215
void ambi_enc_process(void *const hAmbi, const float *const *inputs, float *const *const outputs, int nInputs, int nOutputs, int nSamples)
Encodes input signals into spherical harmonic signals, at the specified encoding directions.
Definition ambi_enc.c:89
int ambi_enc_getNSHrequired(void *const hAmbi)
Returns the number of spherical harmonic signals required by the current decoding order: (current_ord...
Definition ambi_enc.c:347
float ambi_enc_getSourceElev_deg(void *const hAmbi, int index)
Returns the elevation for a specific source, in DEGREES.
Definition ambi_enc.c:330
float ambi_enc_getSourceAzi_deg(void *const hAmbi, int index)
Returns the azimuth for a specific source, in DEGREES.
Definition ambi_enc.c:324
void ambi_enc_setChOrder(void *const hAmbi, int newOrder)
Sets the Ambisonic channel ordering convention to encode with (see CH_ORDER enum)
Definition ambi_enc.c:271
int ambi_enc_getNumSources(void *const hAmbi)
Returns the number of input signals/sources to encode.
Definition ambi_enc.c:336
int ambi_enc_getOutputOrder(void *const hAmbi)
Returns the decoding order (see SH_ORDERS enum)
Definition ambi_enc.c:318
void ambi_enc_init(void *const hAmbi, int sampleRate)
Initialises an instance of ambi_enc with default settings.
Definition ambi_enc.c:69
A basic Ambisonic encoder.
void loadSourceConfigPreset(SOURCE_CONFIG_PRESETS preset, float dirs_deg[MAX_NUM_INPUTS][2], int *newNCH)
Returns the source directions for a specified source config preset.
A basic Ambisonic encoder.
#define AMBI_ENC_FRAME_SIZE
Framesize, in time-domain samples.
void convertHOAChannelConvention(float *insig, int order, int signalLength, HOA_CH_ORDER inConvention, HOA_CH_ORDER outConvention)
Converts an Ambisonic signal from one channel ordering convention to another.
Definition saf_hoa.c:41
void convertHOANormConvention(float *insig, int order, int signalLength, HOA_NORM inConvention, HOA_NORM outConvention)
Converts an Ambisonic signal from one normalisation convention to another.
Definition saf_hoa.c:73
void getRSH_recur(int N, float *dirs_deg, int nDirs, float *Y)
Computes real-valued spherical harmonics [1] for each given direction on the unit sphere.
Definition saf_hoa.c:153
@ HOA_CH_ORDER_FUMA
Furse-Malham (FuMa) convention, often used by older recordings.
Definition saf_hoa.h:187
@ HOA_CH_ORDER_ACN
Ambisonic Channel numbering (ACN) convention, which is employed by all spherical harmonic related fun...
Definition saf_hoa.h:184
@ HOA_NORM_FUMA
Furse-Malham (FuMa) convention.
Definition saf_hoa.h:208
@ HOA_NORM_SN3D
Schmidt semi-normalisation (SN3D) convention, as used by the AmbiX standard.
Definition saf_hoa.h:206
@ HOA_NORM_N3D
Orthonormalised (N3D) convention, which is the default convention used by SAF.
Definition saf_hoa.h:204
#define ORDER2NSH(order)
Converts spherical harmonic order to number of spherical harmonic components i.e: (order+1)^2.
Definition saf_sh.h:51
#define SAF_CLAMP(a, min, max)
Ensures value "a" is clamped between the "min" and "max" values.
void utility_svvmul(const float *a, const float *b, const int len, float *c)
Single-precision, element-wise vector-vector multiplication i.e.
#define SAF_MAX(a, b)
Returns the maximum of the two values.
void utility_svvcopy(const float *a, const int len, float *c)
Single-precision, vector-vector copy, i.e.
#define SAF_MIN(a, b)
Returns the minimum of the two values.
void utility_svsmul(float *a, const float *s, const int len, float *c)
Single-precision, multiplies each element in vector 'a' with a scalar 's', i.e.
void * malloc1d(size_t dim1_data_size)
1-D malloc (same as malloc, but with error checking)
Definition md_malloc.c:59
Main structure for ambi_enc.
float tempFrame[MAX_NUM_SH_SIGNALS][AMBI_ENC_FRAME_SIZE]
Temporary frame.
float Y[MAX_NUM_SH_SIGNALS][MAX_NUM_INPUTS]
SH weights.
int enablePostScaling
Flag 1: output signals scaled by 1/sqrt(nSources), 0: disabled.
int new_nSources
New number of input signals (current value will be replaced by this after next re-init)
float interpolator_fadeIn[AMBI_ENC_FRAME_SIZE]
Linear Interpolator (fade-in)
float inputFrameTD[MAX_NUM_INPUTS][AMBI_ENC_FRAME_SIZE]
Input frame of signals.
CH_ORDER chOrdering
Ambisonic channel order convention (see CH_ORDER)
float tempFrame_fadeOut[MAX_NUM_SH_SIGNALS][AMBI_ENC_FRAME_SIZE]
Temporary frame with linear interpolation (fade-out) applied.
float outputFrameTD[MAX_NUM_SH_SIGNALS][AMBI_ENC_FRAME_SIZE]
Output frame of SH signals.
float prev_Y[MAX_NUM_SH_SIGNALS][MAX_NUM_INPUTS]
Previous SH weights.
int nSources
Current number of input signals.
float prev_inputFrameTD[MAX_NUM_INPUTS][AMBI_ENC_FRAME_SIZE]
Previous frame of signals.
NORM_TYPES norm
Ambisonic normalisation convention (see NORM_TYPES)
float src_gains[MAX_NUM_INPUTS]
Gains applied per source.
float fs
Host sampling rate.
SH_ORDERS order
Current SH encoding order.
int recalc_SH_FLAG[MAX_NUM_INPUTS]
Flags, 1: recalc SH weights, 0: do not.
float outputFrameTD_fadeIn[MAX_NUM_SH_SIGNALS][AMBI_ENC_FRAME_SIZE]
Output frame of SH signals with linear interpolation (fade-in) applied.
float src_dirs_deg[MAX_NUM_INPUTS][2]
Source directions, in degrees.
float interpolator_fadeOut[AMBI_ENC_FRAME_SIZE]
Linear Interpolator (fade-out)