Skip to content

Commit 8b07bfe

Browse files
changing default sofa strings for the examples, and powermap only intialises the interpolation grid on the first init
1 parent 7a87719 commit 8b07bfe

File tree

8 files changed

+52
-46
lines changed

8 files changed

+52
-46
lines changed

examples/include/ambi_drc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ extern "C" {
7878
#define AMBI_DRC_IN_GAIN_MIN_VAL ( -40.0f ) /**< Minimum input gain, dB */
7979
#define AMBI_DRC_IN_GAIN_MAX_VAL ( 20.0f ) /**< Maximum input gain, dB */
8080
#define AMBI_DRC_THRESHOLD_MIN_VAL ( -60.0f ) /**< Minimum threshold, dB */
81-
#define AMBI_DRC_THRESHOLD_MAX_VAL ( 0.0f ) /**< Maximum threshold, dB */
81+
#define AMBI_DRC_THRESHOLD_MAX_VAL ( 6.0f ) /**< Maximum threshold, dB */
8282
#define AMBI_DRC_RATIO_MIN_VAL ( 1.0f ) /**< Minimum ratio, X:1 */
8383
#define AMBI_DRC_RATIO_MAX_VAL ( 30.0f ) /**< Maximum ratio, X:1 */
8484
#define AMBI_DRC_KNEE_MIN_VAL ( 0.0f ) /**< Minimum knee, dB */

examples/src/ambi_bin/ambi_bin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ char* ambi_bin_getSofaFilePath(void* const hAmbi)
719719
if(pars->sofa_filepath!=NULL)
720720
return pars->sofa_filepath;
721721
else
722-
return "no_file";
722+
return "/Spatial_Audio_Framework/Default";
723723
}
724724

725725
int ambi_bin_getChOrder(void* const hAmbi)

examples/src/ambi_dec/ambi_dec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ char* ambi_dec_getSofaFilePath(void* const hAmbi)
937937
if(pars->sofa_filepath!=NULL)
938938
return pars->sofa_filepath;
939939
else
940-
return "no_file";
940+
return "/Spatial_Audio_Framework/Default";
941941
}
942942

943943
int ambi_dec_getEnableHRIRsPreProc(void* const hAmbi)

examples/src/binauraliser/binauraliser.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ char* binauraliser_getSofaFilePath(void* const hBin)
582582
if(pData->sofa_filepath!=NULL)
583583
return pData->sofa_filepath;
584584
else
585-
return "no_file";
585+
return "/Spatial_Audio_Framework/Default";
586586
}
587587

588588
int binauraliser_getEnableHRIRsDiffuseEQ(void* const hBin)

examples/src/dirass/dirass.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void dirass_create
5252
pData->DirAssMode = REASS_UPSCALE;
5353
pData->upscaleOrder = pData->new_upscaleOrder = UPSCALE_ORDER_TENTH;
5454
pData->gridOption = GRID_GEOSPHERE_8;
55-
pData->pmapAvgCoeff = 0.666f;
55+
pData->pmapAvgCoeff = 0.2f;
5656
pData->minFreq_hz = 100.0f;
5757
pData->maxFreq_hz = 8e3f;
5858
pData->dispWidth = 120;

examples/src/powermap/powermap.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void powermap_create
4848
pData->pmapEQ[band] = 1.0f;
4949
}
5050
pData->covAvgCoeff = 0.0f;
51-
pData->pmapAvgCoeff = 0.666f;
51+
pData->pmapAvgCoeff = 0.25f;
5252
pData->nSources = 1;
5353
pData->pmap_mode = PM_MODE_MUSIC;
5454
pData->HFOVoption = HFOV_360;
@@ -71,6 +71,7 @@ void powermap_create
7171
pars->interp_table = NULL;
7272

7373
/* internal */
74+
pData->isFirstInit = 1;
7475
pData->progressBar0_1 = 0.0f;
7576
pData->progressBarText = malloc1d(PROGRESSBARTEXT_CHAR_LENGTH*sizeof(char));
7677
strcpy(pData->progressBarText,"");
@@ -173,7 +174,7 @@ void powermap_initCodec
173174
/* for progress bar */
174175
pData->codecStatus = CODEC_STATUS_INITIALISING;
175176
strcpy(pData->progressBarText,"Initialising");
176-
pData->progressBar0_1 = 0.0f;
177+
pData->progressBar0_1 = 0.5f;
177178

178179
powermap_initTFT(hPm);
179180
powermap_initAna(hPm);

examples/src/powermap/powermap_internal.c

Lines changed: 43 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -73,51 +73,55 @@ void powermap_initAna(void* const hPm)
7373
pars->Y_grid_cmplx[n-1][i*(pars->grid_nDirs)+j] = cmplxf(pars->Y_grid[n-1][i*(pars->grid_nDirs)+j], 0.0f);
7474
}
7575

76-
/* generate interpolation table for current display settings */
77-
switch(pData->HFOVoption){
78-
default:
79-
case HFOV_360: hfov = 360.0f; break;
80-
}
81-
switch(pData->aspectRatioOption){
82-
default:
83-
case ASPECT_RATIO_2_1: aspectRatio = 2.0f; break;
84-
}
85-
N_azi = pData->dispWidth;
86-
N_ele = (int)((float)pData->dispWidth/aspectRatio + 0.5f);
87-
grid_x_axis = malloc1d(N_azi * sizeof(float));
88-
grid_y_axis = malloc1d(N_ele * sizeof(float));
89-
vfov = hfov/aspectRatio;
90-
for(fi = -hfov/2.0f, i = 0; i<N_azi; fi+=hfov/N_azi, i++)
91-
grid_x_axis[i] = fi;
92-
for(fi = -vfov/2.0f, i = 0; i<N_ele; fi+=vfov/N_ele, i++)
93-
grid_y_axis[i] = fi;
94-
free(pars->interp_dirs_deg);
95-
pars->interp_dirs_deg = malloc1d(N_azi*N_ele*2*sizeof(float));
96-
for(i = 0; i<N_ele; i++){
97-
for(j=0; j<N_azi; j++){
98-
pars->interp_dirs_deg[(i*N_azi + j)*2] = grid_x_axis[j];
99-
pars->interp_dirs_deg[(i*N_azi + j)*2+1] = grid_y_axis[i];
76+
if(pData->isFirstInit){
77+
/* generate interpolation table for current display settings */
78+
switch(pData->HFOVoption){
79+
default:
80+
case HFOV_360: hfov = 360.0f; break;
10081
}
101-
}
102-
free(pars->interp_table);
103-
generateVBAPgainTable3D_srcs(pars->interp_dirs_deg, N_azi*N_ele, pars->grid_dirs_deg, pars->grid_nDirs, 0, 0, 0.0f, &(pars->interp_table), &(pars->interp_nDirs), &(pars->interp_nTri));
104-
VBAPgainTable2InterpTable(pars->interp_table, pars->interp_nDirs, pars->grid_nDirs);
105-
106-
/* reallocate memory for storing the powermaps */
107-
free(pData->pmap);
108-
pData->pmap = malloc1d(pars->grid_nDirs*sizeof(float));
109-
free(pData->prev_pmap);
110-
pData->prev_pmap = calloc1d(pars->grid_nDirs, sizeof(float));
111-
for(i=0; i<NUM_DISP_SLOTS; i++){
112-
free(pData->pmap_grid[i]);
113-
pData->pmap_grid[i] = calloc1d(pars->interp_nDirs,sizeof(float));
82+
switch(pData->aspectRatioOption){
83+
default:
84+
case ASPECT_RATIO_2_1: aspectRatio = 2.0f; break;
85+
}
86+
N_azi = pData->dispWidth;
87+
N_ele = (int)((float)pData->dispWidth/aspectRatio + 0.5f);
88+
grid_x_axis = malloc1d(N_azi * sizeof(float));
89+
grid_y_axis = malloc1d(N_ele * sizeof(float));
90+
vfov = hfov/aspectRatio;
91+
for(fi = -hfov/2.0f, i = 0; i<N_azi; fi+=hfov/N_azi, i++)
92+
grid_x_axis[i] = fi;
93+
for(fi = -vfov/2.0f, i = 0; i<N_ele; fi+=vfov/N_ele, i++)
94+
grid_y_axis[i] = fi;
95+
free(pars->interp_dirs_deg);
96+
pars->interp_dirs_deg = malloc1d(N_azi*N_ele*2*sizeof(float));
97+
for(i = 0; i<N_ele; i++){
98+
for(j=0; j<N_azi; j++){
99+
pars->interp_dirs_deg[(i*N_azi + j)*2] = grid_x_axis[j];
100+
pars->interp_dirs_deg[(i*N_azi + j)*2+1] = grid_y_axis[i];
101+
}
102+
}
103+
free(pars->interp_table);
104+
generateVBAPgainTable3D_srcs(pars->interp_dirs_deg, N_azi*N_ele, pars->grid_dirs_deg, pars->grid_nDirs, 0, 0, 0.0f, &(pars->interp_table), &(pars->interp_nDirs), &(pars->interp_nTri));
105+
VBAPgainTable2InterpTable(pars->interp_table, pars->interp_nDirs, pars->grid_nDirs);
106+
107+
/* reallocate memory for storing the powermaps */
108+
free(pData->pmap);
109+
pData->pmap = malloc1d(pars->grid_nDirs*sizeof(float));
110+
free(pData->prev_pmap);
111+
pData->prev_pmap = calloc1d(pars->grid_nDirs, sizeof(float));
112+
for(i=0; i<NUM_DISP_SLOTS; i++){
113+
free(pData->pmap_grid[i]);
114+
pData->pmap_grid[i] = calloc1d(pars->interp_nDirs,sizeof(float));
115+
}
116+
free(grid_x_axis);
117+
free(grid_y_axis);
118+
119+
pData->isFirstInit = 0;
114120
}
115121

116122
pData->masterOrder = order;
117123

118124
free(Y_grid_N);
119-
free(grid_x_axis);
120-
free(grid_y_axis);
121125
}
122126

123127
void powermap_initTFT

examples/src/powermap/powermap_internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ typedef struct _powermap
9898
float fs; /**< Host sample rate, in Hz*/
9999

100100
/* internal */
101+
int isFirstInit; /**< Flag */
101102
float_complex Cx[HYBRID_BANDS][MAX_NUM_SH_SIGNALS*MAX_NUM_SH_SIGNALS]; /**< covariance matrices per band */
102103
int new_masterOrder; /**< New maximum/master SH analysis order (current value will be replaced by this after next re-init) */
103104
int dispWidth; /**< Number of pixels on the horizontal in the 2D interpolated powermap image */

0 commit comments

Comments
 (0)