Skip to content

Commit d978c98

Browse files
minor fixes for unit tests now that some of the examples are latency free
1 parent 71484cc commit d978c98

File tree

7 files changed

+20
-16
lines changed

7 files changed

+20
-16
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
# About
99

10-
The Spatial_Audio_Framework (SAF) is an open-source and cross-platform framework for developing spatial audio related algorithms and software in C/C++. Originally intended as a resource for researchers in the field, the framework has gradually grown into a large codebase comprising a number of distinct [**modules**](framework/modules); with each module targeting a specific sub-field of spatial audio, such as: Ambisonics encoding/decoding, spherical array processing, amplitude-panning, HRIR processing, room simulation, etc.. The framework also makes use of highly optimised linear algebra libraries (such as: Intel MKL, Apple Accelerate, OpenBLAS) as well as x86 SIMD intrinsics (SSE, AVX, AVX-512).
10+
The Spatial_Audio_Framework (SAF) is an open-source and cross-platform framework for developing spatial audio related algorithms and software in C/C++. Originally intended as a resource for researchers in the field, the framework has gradually grown into a large codebase comprising a number of distinct [**modules**](framework/modules). Each module targets a specific sub-field of spatial audio, such as: Ambisonics encoding/decoding, spherical array processing, amplitude-panning (VBAP), HRIR processing, room simulation, etc. The framework also makes use of highly optimised linear algebra libraries (such as: Intel MKL, Apple Accelerate, OpenBLAS) as well as x86 SIMD intrinsics (SSE, AVX, AVX-512).
1111

1212
Several [**examples**](examples/include) are also included in the repository, which serve to demonstrate the functionality of the framework and may also act as a starting point for new projects. These examples have also been realised as VST/LV2 audio plug-ins under the [**SPARTA**](https://github.com/leomccormack/SPARTA) banner.
1313

@@ -46,7 +46,7 @@ The [framework](docs/FRAMEWORK_STRUCTURE.md) comprises the following core module
4646
The framework also includes the following optional modules:
4747
* **saf_sofa_reader** - a simple SOFA file reader (**ISC** License).
4848
* **saf_tracker** - a particle-filtering based tracker (**GPLv2** License).
49-
* **saf_hades** - for binaural rendering of Hearing-Assistive/Augmented-reality Devices (HADES) (**GPLv2** License).
49+
* **saf_hades** - for binaural rendering of Hearing-Assistive/Augmented-reality Devices (HADES) (**GPLv2** License).
5050

5151
To enable optional framework modules, simply add the relevant pre-processor definition:
5252
```
@@ -57,10 +57,10 @@ SAF_ENABLE_HADES_MODULE # to enable saf_hades
5757

5858
### Additional options
5959

60-
The framework can be configured further, with the following options:
60+
The framework can be configured further with the following options:
6161
```
62-
SAF_USE_INTEL_IPP # To use Intel IPP for performing the DFT/FFT and resampling
63-
SAF_USE_FFTW # To use the FFTW library for performing the DFT/FFT
62+
SAF_USE_INTEL_IPP # To use Intel IPP for performing the DFT/FFTs and resampling
63+
SAF_USE_FFTW # To use the FFTW library for performing the DFT/FFTs
6464
SAF_ENABLE_SIMD # To enable SIMD (SSE3, AVX2 and/or AVX512) intrinsics for certain vector operations
6565
```
6666

examples/src/ambi_dec/ambi_dec.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -450,12 +450,16 @@ void ambi_dec_initCodec
450450
pars->hrtf_fb_mag = realloc1d(pars->hrtf_fb_mag, HYBRID_BANDS*NUM_EARS*(pars->N_hrir_dirs)*sizeof(float));
451451
for(i=0; i<HYBRID_BANDS*NUM_EARS* (pars->N_hrir_dirs); i++)
452452
pars->hrtf_fb_mag[i] = cabsf(pars->hrtf_fb[i]);
453-
453+
454454
/* clean-up */
455455
free(hrtf_vbap_gtable);
456456
pData->reinit_hrtfsFLAG = 0;
457457
}
458458

459+
/* HRTFs should be reinterpolated */
460+
for(ch=0; ch<MAX_NUM_LOUDSPEAKERS; ch++)
461+
pData->recalc_hrtf_interpFLAG[ch] = 1;
462+
459463
/* done! */
460464
strcpy(pData->progressBarText,"Done!");
461465
pData->progressBar0_1 = 1.0f;
@@ -597,9 +601,6 @@ void ambi_dec_process
597601
void ambi_dec_refreshSettings(void* const hAmbi)
598602
{
599603
ambi_dec_data *pData = (ambi_dec_data*)(hAmbi);
600-
int ch;
601-
for(ch=0; ch<MAX_NUM_LOUDSPEAKERS; ch++)
602-
pData->recalc_hrtf_interpFLAG[ch] = 1;
603604
pData->reinit_hrtfsFLAG = 1;
604605
ambi_dec_setCodecStatus(hAmbi, CODEC_STATUS_NOT_INITIALISED);
605606
}

examples/src/ambi_enc/ambi_enc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,5 +366,5 @@ int ambi_enc_getEnablePostScaling(void* const hAmbi)
366366

367367
int ambi_enc_getProcessingDelay(void)
368368
{
369-
return AMBI_ENC_FRAME_SIZE;
369+
return 0;
370370
}

examples/src/array2sh/array2sh.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,9 @@ void array2sh_setArrayType(void* const hA2sh, int newType)
440440

441441
if(arraySpecs->arrayType != (ARRAY2SH_ARRAY_TYPES)newType){
442442
arraySpecs->arrayType = (ARRAY2SH_ARRAY_TYPES)newType;
443+
if( !(arraySpecs->weightType == WEIGHT_RIGID_OMNI || arraySpecs->weightType == WEIGHT_OPEN_OMNI)){
444+
arraySpecs->weightType = WEIGHT_RIGID_OMNI;
445+
}
443446
pData->reinitSHTmatrixFLAG = 1;
444447
array2sh_setEvalStatus(hA2sh, EVAL_STATUS_NOT_EVALUATED);
445448
}

examples/src/beamformer/beamformer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ int beamformer_getBeamType(void* const hBeam)
330330

331331
int beamformer_getProcessingDelay(void)
332332
{
333-
return BEAMFORMER_FRAME_SIZE;
333+
return 0;
334334
}
335335

336336

examples/src/rotator/rotator.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,5 +429,5 @@ int rotator_getNSHrequired(void* const hRot)
429429

430430
int rotator_getProcessingDelay(void)
431431
{
432-
return ROTATOR_FRAME_SIZE;
432+
return 0;
433433
}

test/src/test__examples.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,8 @@ void test__saf_example_ambi_enc(void){
254254

255255
/* ambi_enc should be equivalent to the reference */
256256
for(i=0; i<nSH; i++)
257-
for(j=0; j<signalLength-delay; j++)
258-
TEST_ASSERT_FLOAT_WITHIN(acceptedTolerance, shSig_ref[i][j], shSig[i][j+delay]);
257+
for(j=framesize; j<signalLength-framesize; j++)
258+
TEST_ASSERT_FLOAT_WITHIN(acceptedTolerance, shSig_ref[i][j], shSig[i][j]);
259259

260260
/* Clean-up */
261261
ambi_enc_destroy(&hAmbi);
@@ -428,8 +428,8 @@ void test__saf_example_rotator(void){
428428
/* ambi_enc should be equivalent to the reference, except delayed due to the
429429
* temporal interpolation employed in ambi_enc */
430430
for(i=0; i<nSH; i++)
431-
for(j=0; j<signalLength-delay; j++)
432-
TEST_ASSERT_FLOAT_WITHIN(acceptedTolerance, shSig_rot_ref[i][j], shSig_rot[i][j+delay]);
431+
for(j=framesize; j<signalLength-framesize; j++)
432+
TEST_ASSERT_FLOAT_WITHIN(acceptedTolerance, shSig_rot_ref[i][j], shSig_rot[i][j]);
433433

434434
/* Clean-up */
435435
rotator_destroy(&hRot);

0 commit comments

Comments
 (0)