@@ -61,7 +61,13 @@ extern "C" {
6161#if (POWERMAP_FRAME_SIZE % HOP_SIZE != 0 )
6262# error "POWERMAP_FRAME_SIZE must be an integer multiple of HOP_SIZE"
6363#endif
64-
64+
65+ #ifndef __STDC_NO_ATOMICS__
66+ typedef _Atomic (POWERMAP_MODES ) _Atomic_POWERMAP_MODES ;
67+ #else
68+ typedef POWERMAP_MODES _Atomic_POWERMAP_MODES ;
69+ #endif
70+
6571/* ========================================================================== */
6672/* Structures */
6773/* ========================================================================== */
@@ -100,38 +106,38 @@ typedef struct _powermap
100106 /* internal */
101107 int isFirstInit ; /**< Flag */
102108 float_complex Cx [HYBRID_BANDS ][MAX_NUM_SH_SIGNALS * MAX_NUM_SH_SIGNALS ]; /**< covariance matrices per band */
103- int new_masterOrder ; /**< New maximum/master SH analysis order (current value will be replaced by this after next re-init) */
104- int dispWidth ; /**< Number of pixels on the horizontal in the 2D interpolated powermap image */
109+ _Atomic_INT32 new_masterOrder ; /**< New maximum/master SH analysis order (current value will be replaced by this after next re-init) */
110+ _Atomic_INT32 dispWidth ; /**< Number of pixels on the horizontal in the 2D interpolated powermap image */
105111
106112 /* ana configuration */
107- CODEC_STATUS codecStatus ; /**< see #CODEC_STATUS */
108- PROC_STATUS procStatus ; /**< see #PROC_STATUS */
109- float progressBar0_1 ; /**< Current (re)initialisation progress, between [0..1] */
110- char * progressBarText ; /**< Current (re)initialisation step, string */
111- powermap_codecPars * pars ; /**< codec parameters */
113+ _Atomic_CODEC_STATUS codecStatus ; /**< see #CODEC_STATUS */
114+ _Atomic_PROC_STATUS procStatus ; /**< see #PROC_STATUS */
115+ _Atomic_FLOAT32 progressBar0_1 ; /**< Current (re)initialisation progress, between [0..1] */
116+ char * progressBarText ; /**< Current (re)initialisation step, string */
117+ powermap_codecPars * pars ; /**< codec parameters */
112118
113119 /* display */
114120 float * pmap ; /**< grid_nDirs x 1 */
115121 float * prev_pmap ; /**< grid_nDirs x 1 */
116122 float * pmap_grid [NUM_DISP_SLOTS ]; /**< powermap interpolated to grid; interp_nDirs x 1 */
117- int dispSlotIdx ; /**< Current display slot */
123+ _Atomic_INT32 dispSlotIdx ; /**< Current display slot */
118124 float pmap_grid_minVal ; /**< Current minimum value in pmap (used to normalise [0..1]) */
119125 float pmap_grid_maxVal ; /**< Current maximum value in pmap (used to normalise [0..1]) */
120- int recalcPmap ; /**< set this to 1 to generate a new powermap */
121- int pmapReady ; /**< 0: powermap not started yet, 1: powermap is ready for plotting*/
126+ _Atomic_INT32 recalcPmap ; /**< set this to 1 to generate a new powermap */
127+ _Atomic_INT32 pmapReady ; /**< 0: powermap not started yet, 1: powermap is ready for plotting*/
122128
123129 /* User parameters */
124- int masterOrder ; /**< Current maximum/master SH analysis order */
125- int analysisOrderPerBand [HYBRID_BANDS ]; /**< SH analysis order per frequency band */
126- float pmapEQ [HYBRID_BANDS ]; /**< Equalisation/weights per band */
127- HFOV_OPTIONS HFOVoption ; /**< see #HFOV_OPTIONS */
128- ASPECT_RATIO_OPTIONS aspectRatioOption ; /**< see #ASPECT_RATIO_OPTIONS */
129- float covAvgCoeff ; /**< Covariance matrix averaging coefficient, [0..1] */
130- float pmapAvgCoeff ; /**< Powermap averaging coefficient, [0..1] */
131- int nSources ; /**< Current number of sources (used for MUSIC) */
132- POWERMAP_MODES pmap_mode ; /**< see #POWERMAP_MODES*/
133- CH_ORDER chOrdering ; /**< Ambisonic channel order convention (see #CH_ORDER) */
134- NORM_TYPES norm ; /**< Ambisonic normalisation convention (see #NORM_TYPES) */
130+ _Atomic_INT32 masterOrder ; /**< Current maximum/master SH analysis order */
131+ _Atomic_INT32 analysisOrderPerBand [HYBRID_BANDS ]; /**< SH analysis order per frequency band */
132+ _Atomic_FLOAT32 pmapEQ [HYBRID_BANDS ]; /**< Equalisation/weights per band */
133+ _Atomic_HFOV_OPTIONS HFOVoption ; /**< see #HFOV_OPTIONS */
134+ _Atomic_ASPECT_RATIO_OPTIONS aspectRatioOption ; /**< see #ASPECT_RATIO_OPTIONS */
135+ _Atomic_FLOAT32 covAvgCoeff ; /**< Covariance matrix averaging coefficient, [0..1] */
136+ _Atomic_FLOAT32 pmapAvgCoeff ; /**< Powermap averaging coefficient, [0..1] */
137+ _Atomic_INT32 nSources ; /**< Current number of sources (used for MUSIC) */
138+ _Atomic_POWERMAP_MODES pmap_mode ; /**< see #POWERMAP_MODES*/
139+ _Atomic_CH_ORDER chOrdering ; /**< Ambisonic channel order convention (see #CH_ORDER) */
140+ _Atomic_NORM_TYPES norm ; /**< Ambisonic normalisation convention (see #NORM_TYPES) */
135141
136142} powermap_data ;
137143
0 commit comments