Skip to content

Commit fa767a0

Browse files
authored
Merge branch 'develop' into binauraliser-dvf
2 parents 2908d4b + d472c53 commit fa767a0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2573
-983
lines changed

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ UpgradeLog.htm
1111
cmake-build-debug/
1212
cmake-build-release/
1313
*.db
14-
dependencies/Win64/lib/saf_mkl_custom_lp64.lib
15-
dependencies/Win64/lib/saf_mkl_custom_ilp64.lib
16-
dependencies/Win64/lib/libiomp5md.lib
14+
dependencies/
1715
*.c~
1816
*.m~
1917
*.h~

ChangeLog.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,23 @@
88
Major and/or breaking changes to the Spatial_Audio_Framework are listed here.
99
For descriptions of minor changes and bug fixes, please refer to the git log.
1010

11+
====================================================================================================
12+
v1.3.0
13+
- Added saf_hades module
14+
- Added binauraliser_nf and tvconv examples
15+
- Added saf_utility_dvf.h/.c to saf_utilities module
16+
- All Bessel and Hankel functions now have two variants, with one having a "_ALL" suffix that
17+
returns all orders from 0 to the specified order, and another returning only the specified order
18+
- Added the ability to select which SOFA reader to use (libmysofa or the built-in netcdf one)
19+
- Removed the "loadSofaFile()" function (marked as deprecated since October 2020).
20+
21+
Breaking changes:
22+
23+
All Bessel and Hankel functions to have a "_ALL" suffix, since they return all orders up to the
24+
specified maximum order. Therefore, if you were using these functions prior to this version, then
25+
you will also need to add this suffix to retain previous behaviour.
26+
27+
1128
====================================================================================================
1229
v1.2.4
1330
- Added libmysofa to the saf_sofa_reader module. The saf_sofa_open() function now uses libmysofa by

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ Several **examples** have also been included in the repository, which may serve
161161
* **dirass** - a sound-field visualiser based on re-assigning the energy of beamformers. This re-assignment is based on the DoA estimates extracted from spatially-localised active-intensity vectors, which are biased towards each beamformer direction.
162162
* **matrixconv** - a basic matrix convolver with an optional partitioned convolution mode.
163163
* **multiconv** - a basic multi-channel convolver with an optional partitioned convolution mode.
164+
* **tvconv** - a time-varying partitioned convolution multi-channel convolver for SOFA files containing RIRs with multiple listener positions.
164165
* **panner** - a frequency-dependent VBAP panner, which accommodates a source loudness compensation (as a function of the room) option.
165166
* **pitch_shifter** - a basic multi-channel pitch shifter, based on the phase vocoder approach.
166167
* **powermap** - sound-field visualiser based on beamformer (PWD, MVDR) energy or subspace methods (MUSIC).

examples/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ if(NOT DEFINED saf_example_list)
2222
powermap
2323
rotator
2424
sldoa
25-
spreader)
25+
spreader
26+
tvconv)
2627
endif()
2728

2829
# Find number of examples

examples/include/binauraliser_nf.h

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2018 Michael McCrea, Leo McCormack
2+
* Copyright 2022 Michael McCrea, Leo McCormack
33
*
44
* Permission to use, copy, modify, and/or distribute this software for any
55
* purpose with or without fee is hereby granted, provided that the above
@@ -64,10 +64,6 @@
6464
extern "C" {
6565
#endif /* __cplusplus */
6666

67-
/* ========================================================================== */
68-
/* Presets + Constants */
69-
/* ========================================================================== */
70-
7167
/* ========================================================================== */
7268
/* Main Functions */
7369
/* ========================================================================== */
@@ -95,7 +91,7 @@ void binauraliserNF_destroy(void** const phBin);
9591
* @param[in] samplerate Host samplerate.
9692
*/
9793
void binauraliserNF_init(void* const hBin,
98-
int samplerate);
94+
int samplerate);
9995

10096
/**
10197
* Intialises the codec variables, based on current global/user parameters
@@ -126,11 +122,11 @@ void binauraliserNF_initCodec(void* const hBin);
126122
* @param[in] nSamples Number of samples in 'inputs'/'output' matrices
127123
*/
128124
void binauraliserNF_process(void* const hBin,
129-
const float *const * inputs,
130-
float** const outputs,
131-
int nInputs,
132-
int nOutputs,
133-
int nSamples);
125+
const float *const * inputs,
126+
float** const outputs,
127+
int nInputs,
128+
int nOutputs,
129+
int nSamples);
134130

135131
/**
136132
* Alternate version of binauraliserNF_process() that performs frequency-domain

examples/include/tvconv.h

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
/*
2+
* Copyright 2020 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+
17+
/**
18+
* @file tvconv.h
19+
* @brief A time-varying multi-channel convolver
20+
* @author Rapolas Daugintis
21+
* @date 13.07.2021
22+
*/
23+
24+
#ifndef __TVCONV_H_INCLUDED__
25+
#define __TVCONV_H_INCLUDED__
26+
27+
#include "_common.h"
28+
29+
#ifdef __cplusplus
30+
extern "C" {
31+
#endif /* __cplusplus */
32+
33+
/* ========================================================================== */
34+
/* Main Functions */
35+
/* ========================================================================== */
36+
37+
/**
38+
* Creates an instance of tvconv
39+
*
40+
* @param[in] phTVCnv (&) address of tvconv handle
41+
*/
42+
void tvconv_create(void** const phTVCnv);
43+
44+
/**
45+
* Destroys an instance of tvconv
46+
*
47+
* @param[in] phTVCnv (&) address of tvconv handle
48+
*/
49+
void tvconv_destroy(void** const phTVCnv);
50+
51+
/**
52+
* Initialises an instance of tvconv with default settings
53+
*
54+
* @param[in] hTVCnv tvconv handle
55+
* @param[in] samplerate Host samplerate.
56+
* @param[in] hostBlockSize Host frame/block size
57+
*/
58+
void tvconv_init(void* const hTVCnv,
59+
int samplerate,
60+
int hostBlockSize);
61+
62+
/**
63+
* Performs the time-varying convolution processing
64+
*
65+
* @param[in] hTVCnv tvconv handle
66+
* @param[in] inputs Input channel buffers; 2-D array: nInputs x nSamples
67+
* @param[in] outputs Output channel buffers; 2-D array: nOutputs x nSamples
68+
* @param[in] nInputs Number of input channels
69+
* @param[in] nOutputs Number of output channels
70+
* @param[in] nSamples Number of samples in 'inputs'/'output' matrices (block size)
71+
*/
72+
void tvconv_process(void* const hTVCnv,
73+
float** const inputs,
74+
float** const outputs,
75+
int nInputs,
76+
int nOutputs,
77+
int nSamples);
78+
79+
80+
/* ========================================================================== */
81+
/* Set Functions */
82+
/* ========================================================================== */
83+
84+
/**
85+
* Sets all intialisation flags to 1. Re-initialising all settings/variables,
86+
* as tvconv is currently configured, at next available opportunity.
87+
*/
88+
void tvconv_refreshParams(void* const hTVCnv);
89+
90+
/**
91+
* Checks whether things have to be reinitialised, and does so if it is needed
92+
*/
93+
void tvconv_checkReInit(void* const hTVCnv);
94+
95+
/** Reads IRs and positions from the current sofa file path. */
96+
void tvconv_setFiltersAndPositions(void* const hTVCnv);
97+
98+
/** Sets current sofa file path. */
99+
void tvconv_setSofaFilePath(void* const hTVCnv, const char* path);
100+
101+
/**
102+
* Sets the target listener position.
103+
*
104+
* @param[in] dim dimension of the coordinate to be set (0 is x, 1 is y,
105+
* * and 2 is z).
106+
* @param[in] position new position to be set.
107+
*/
108+
void tvconv_setTargetPosition(void* const hTVCnv, float position, int dim);
109+
110+
111+
/* ========================================================================== */
112+
/* Get Functions */
113+
/* ========================================================================== */
114+
115+
/**
116+
* Returns the processing framesize (i.e., number of samples processed with
117+
* every _process() call )
118+
*/
119+
int tvconv_getFrameSize(void);
120+
121+
122+
/** Returns the number input channels */
123+
int tvconv_getNumInputChannels(void* const hTVCnv);
124+
125+
/**
126+
* Returns the number of output channels (the same as the number of channels in
127+
* the loaded sofa file)
128+
*/
129+
int tvconv_getNumOutputChannels(void* const hTVCnv);
130+
131+
/** Returns the currect host block size */
132+
int tvconv_getHostBlockSize(void* const hTVCnv);
133+
134+
/** Returns the number of IR channels in the loaded sofa file */
135+
int tvconv_getNumIRs(void* const hTVCnv);
136+
137+
/** Returns the number of listener positions in the loaded sofa file */
138+
int tvconv_getNumListenerPositions(void* const hTVCnv);
139+
140+
/** Returns the current coordinate of dimension dim (0 ... NUM_DIMENSIONS-1) */
141+
float tvconv_getListenerPosition(void* const hTVCnv, int index, int dim);
142+
143+
/** Returns the index of the current IR position */
144+
int tvconv_getListenerPositionIdx(void* const hTVCnv);
145+
146+
/** Returns the current coordinate of dimension dim (0 ... NUM_DIMENSIONS-1) */
147+
float tvconv_getTargetPosition(void* const hTVCnv, int dim);
148+
149+
/** Returns the source coordinate of dimension dim (0 ... NUM_DIMENSIONS-1) */
150+
float tvconv_getSourcePosition(void* const hTVCnv, int dim);
151+
152+
/** Returns minimum cooridinate of dimension dim (0 ... NUM_DIMENSIONS-1) */
153+
float tvconv_getMinDimension(void* const hTVCnv, int dim);
154+
155+
/** Returns minimum cooridinate of dimension dim (0 ... NUM_DIMENSIONS-1) */
156+
float tvconv_getMaxDimension(void* const hTVCnv, int dim);
157+
158+
/** Returns the current filter length, in samples */
159+
int tvconv_getIRLength(void* const hTVCnv);
160+
161+
/** Returns the samplerate of the loaded filters */
162+
int tvconv_getIRFs(void* const hTVCnv);
163+
164+
/** Returns the samperate of the host */
165+
int tvconv_getHostFs(void* const hTVCnv);
166+
167+
/**
168+
* Returns the processing delay in samples (may be used for delay compensation
169+
* features)
170+
*/
171+
int tvconv_getProcessingDelay(void* const hTVCnv);
172+
173+
/** Returns the current Sofa file path */
174+
char* tvconv_getSofaFilePath(void* const hTVCnv);
175+
176+
/** Returns current codec status (see #CODEC_STATUS enum) */
177+
CODEC_STATUS tvconv_getCodecStatus(void* const hTVCnv);
178+
179+
180+
#ifdef __cplusplus
181+
} /* extern "C" { */
182+
#endif /* __cplusplus */
183+
184+
#endif /* __TVCONV_H_INCLUDED__ */

examples/src/ambi_bin/ambi_bin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ void ambi_bin_initCodec
209209
#ifdef SAF_ENABLE_SOFA_READER_MODULE
210210
if(!pData->useDefaultHRIRsFLAG && pars->sofa_filepath!=NULL){
211211
/* Load SOFA file */
212-
error = saf_sofa_open(&sofa, pars->sofa_filepath);
212+
error = saf_sofa_open(&sofa, pars->sofa_filepath, SAF_SOFA_READER_OPTION_DEFAULT);
213213

214214
/* Load defaults instead */
215215
if(error!=SAF_SOFA_OK || sofa.nReceivers!=NUM_EARS){

examples/src/ambi_dec/ambi_dec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ void ambi_dec_initCodec
355355
#ifdef SAF_ENABLE_SOFA_READER_MODULE
356356
if(!pData->useDefaultHRIRsFLAG && pars->sofa_filepath!=NULL){
357357
/* Load SOFA file */
358-
error = saf_sofa_open(&sofa, pars->sofa_filepath);
358+
error = saf_sofa_open(&sofa, pars->sofa_filepath, SAF_SOFA_READER_OPTION_DEFAULT);
359359

360360
/* Load defaults instead */
361361
if(error!=SAF_SOFA_OK || sofa.nReceivers!=NUM_EARS){

examples/src/binauraliser/binauraliser_internal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ void binauraliser_initHRTFsAndGainTables(void* const hBin)
139139
#ifdef SAF_ENABLE_SOFA_READER_MODULE
140140
if(!pData->useDefaultHRIRsFLAG && pData->sofa_filepath!=NULL){
141141
/* Load SOFA file */
142-
error = saf_sofa_open(&sofa, pData->sofa_filepath);
142+
error = saf_sofa_open(&sofa, pData->sofa_filepath, SAF_SOFA_READER_OPTION_DEFAULT);
143143

144144
/* Load defaults instead */
145145
if(error!=SAF_SOFA_OK || sofa.nReceivers!=NUM_EARS){

examples/src/binauraliser_nf/binauraliser_nf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2017-2018 Michael McCrea, Leo McCormack
2+
* Copyright 2022 Michael McCrea, Leo McCormack
33
*
44
* Permission to use, copy, modify, and/or distribute this software for any
55
* purpose with or without fee is hereby granted, provided that the above

0 commit comments

Comments
 (0)