SAF
Loading...
Searching...
No Matches
powermap.h
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
42#ifndef __POWERMAP_H_INCLUDED__
43#define __POWERMAP_H_INCLUDED__
44
45#include "_common.h"
46
47#ifdef __cplusplus
48extern "C" {
49#endif /* __cplusplus */
50
51/* ========================================================================== */
52/* Presets + Constants */
53/* ========================================================================== */
54
76
77
78/* ========================================================================== */
79/* Main Functions */
80/* ========================================================================== */
81
87void powermap_create(void** const phPm);
88
94void powermap_destroy(void** const phPm);
95
104void powermap_init(void* const hPm,
105 float samplerate);
106
122void powermap_initCodec(void* const hPm);
123
134void powermap_analysis(void* const hPm,
135 const float *const * inputs,
136 int nInputs,
137 int nSamples,
138 int isPlaying);
139
140
141/* ========================================================================== */
142/* Set Functions */
143/* ========================================================================== */
144
149void powermap_refreshSettings(void* const hPm);
150
152void powermap_setPowermapMode(void* const hPm, int newMode);
153
155void powermap_setMasterOrder(void* const hPm, int newValue);
156
158void powermap_setAnaOrder(void* const hPm, int newValue, int bandIdx);
159
161void powermap_setAnaOrderAllBands(void* const hPm, int newValue);
162
167void powermap_setPowermapEQ(void* const hPm, float newValue, int bandIdx);
168
170void powermap_setPowermapEQAllBands(void* const hPm, float newValue);
171
173void powermap_setCovAvgCoeff(void* const hPm, float newAvg);
174
179void powermap_setChOrder(void* const hPm, int newOrder);
180
185void powermap_setNormType(void* const hPm, int newType);
186
191void powermap_setSourcePreset(void* const hPm, int newPresetID);
192
194void powermap_setNumSources(void* const hPm, int newValue);
195
200void powermap_setDispFOV(void* const hPm, int newOption);
201
206void powermap_setAspectRatio(void* const hPm, int newOption);
207
209void powermap_setPowermapAvgCoeff(void* const hPm, float newValue);
210
215void powermap_requestPmapUpdate(void* const hPm);
216
217
218/* ========================================================================== */
219/* Get Functions */
220/* ========================================================================== */
221
226int powermap_getFrameSize(void);
227
230
236float powermap_getProgressBar0_1(void* const hPm);
237
243void powermap_getProgressBarText(void* const hPm, char* text);
244
248int powermap_getMasterOrder(void* const hPm);
249
254int powermap_getPowermapMode(void* const hPm);
255
257int powermap_getSamplingRate(void* const hPm);
258
260float powermap_getCovAvgCoeff(void* const hPm);
261
264
269int powermap_getNSHrequired(void* const hPm);
270
275float powermap_getPowermapEQ(void* const hPm, int bandIdx);
276
280float powermap_getPowermapEQAllBands(void* const hPm);
281
290void powermap_getPowermapEQHandle(void* const hPm,
291 float** pX_vector,
292 float** pY_values,
293 int* pNpoints);
294
296int powermap_getAnaOrder(void* const hPm, int bandIdx);
297
299int powermap_getAnaOrderAllBands(void* const hPm);
300
309void powermap_getAnaOrderHandle(void* const hPm,
310 float** pX_vector,
311 int** pY_values,
312 int* pNpoints);
313
319int powermap_getChOrder(void* const hPm);
320
326int powermap_getNormType(void* const hPm);
327
329int powermap_getNumSources(void* const hPm);
330
335int powermap_getDispFOV(void* const hPm);
336
341int powermap_getAspectRatio(void* const hPm);
342
344float powermap_getPowermapAvgCoeff(void* const hPm);
345
359int powermap_getPmap(void* const hPm,
360 float** grid_dirs,
361 float** pmap,
362 int* nDirs,
363 int* pmapWidth,
364 int* hfov,
365 int* aspectRatio);
366
372
373
374#ifdef __cplusplus
375} /* extern "C" */
376#endif /* __cplusplus */
377
378#endif /* __POWERMAP_H_INCLUDED__ */
A bunch of things that are common to many of the saf examples.
CODEC_STATUS
Current status of the codec.
Definition _common.h:201
int powermap_getNormType(void *const hPm)
Returns the Ambisonic normalisation convention currently being usedto decode with,...
Definition powermap.c:691
void powermap_refreshSettings(void *const hPm)
Sets all intialisation flags to 1; re-initialising all settings/variables as powermap is currently co...
Definition powermap.c:386
void powermap_setChOrder(void *const hPm, int newOrder)
Sets the Ambisonic channel ordering convention to decode with, in order to match the convention emplo...
Definition powermap.c:529
int powermap_getAnaOrder(void *const hPm, int bandIdx)
Returns the input/analysis order for one specific frequency band.
Definition powermap.c:648
int powermap_getNumberOfBands(void)
Returns the number of frequency bands used for the analysis.
Definition powermap.c:674
int powermap_getPowermapMode(void *const hPm)
Returns the powermap/activity-map mode to employed for the analysis see POWERMAP_MODES enum.
Definition powermap.c:604
float powermap_getPowermapAvgCoeff(void *const hPm)
Returns the current activity-map averaging coefficient, 0..1.
Definition powermap.c:715
int powermap_getAnaOrderAllBands(void *const hPm)
Returns the input/analysis order for the first frequency band.
Definition powermap.c:654
void powermap_setNormType(void *const hPm, int newType)
Sets the Ambisonic normalisation convention to decode with, in order to match with the convention emp...
Definition powermap.c:536
float powermap_getProgressBar0_1(void *const hPm)
(Optional) Returns current intialisation/processing progress, between 0..1
Definition powermap.c:586
void powermap_setAspectRatio(void *const hPm, int newOption)
Sets the visualisation display window aspect-ratio (see ASPECT_RATIO_OPTIONS enum)
Definition powermap.c:552
void powermap_setNumSources(void *const hPm, int newValue)
Sets the number of sources present in the input sound scene.
Definition powermap.c:420
void powermap_setPowermapAvgCoeff(void *const hPm, float newValue)
Sets the activity-map averaging coefficient, 0..1.
Definition powermap.c:561
int powermap_getFrameSize(void)
Returns the processing framesize (i.e., number of samples processed with every _process() call )
Definition powermap.c:575
void powermap_setCovAvgCoeff(void *const hPm, float newAvg)
Sets the covariance matrix averaging coefficient, 0..1.
Definition powermap.c:414
int powermap_getChOrder(void *const hPm)
Returns the Ambisonic channel ordering convention currently being used to decode with,...
Definition powermap.c:685
void powermap_init(void *const hPm, float samplerate)
Initialises an instance of powermap with default settings.
Definition powermap.c:137
float powermap_getPowermapEQAllBands(void *const hPm)
Returns the weighting coefficient for the first frequency band.
Definition powermap.c:628
int powermap_getNumSources(void *const hPm)
Returns the number of sources present in the input sound scene.
Definition powermap.c:697
void powermap_setSourcePreset(void *const hPm, int newPresetID)
Sets an input preset; the microphone/hyrophone array used to capture the input signals,...
Definition powermap.c:426
void powermap_initCodec(void *const hPm)
Intialises the codec variables, based on current global/user parameters.
Definition powermap.c:159
int powermap_getPmap(void *const hPm, float **grid_dirs, float **pmap, int *nDirs, int *pmapWidth, int *hfov, int *aspectRatio)
Returns the latest computed activity-map if it is ready.
Definition powermap.c:721
void powermap_destroy(void **const phPm)
Destroys an instance of the powermap.
Definition powermap.c:96
void powermap_setMasterOrder(void *const hPm, int newValue)
Sets the maximum input/analysis order (see SH_ORDERS enum)
Definition powermap.c:400
void powermap_setAnaOrder(void *const hPm, int newValue, int bandIdx)
Sets the input/analysis order for one specific frequency band index.
Definition powermap.c:499
int powermap_getAspectRatio(void *const hPm)
Returns the current visualisation display window aspect-ratio (see ASPECT_RATIO_OPTIONS enum)
Definition powermap.c:709
void powermap_requestPmapUpdate(void *const hPm)
Informs powermap that it should compute a new activity-map at its own convenience,...
Definition powermap.c:567
void powermap_setPowermapMode(void *const hPm, int newMode)
Sets the powermap/activity-map approach, (see POWERMAP_MODES enum)
Definition powermap.c:391
void powermap_setPowermapEQAllBands(void *const hPm, float newValue)
Sets the weighting coefficient for all frequency bands.
Definition powermap.c:520
void powermap_getProgressBarText(void *const hPm, char *text)
(Optional) Returns current intialisation/processing progress text
Definition powermap.c:592
void powermap_analysis(void *const hPm, const float *const *inputs, int nInputs, int nSamples, int isPlaying)
Analyses the input spherical harmonic signals to generate an activity-map.
Definition powermap.c:188
void powermap_create(void **const phPm)
Creates an instance of the powermap.
Definition powermap.c:36
POWERMAP_MODES
Available power-map/activity-map options.
Definition powermap.h:58
@ PM_MODE_PWD
Activity-map based on the energy of hyper-cardioid [plane-wave decomposition (PWD)] beamformers.
Definition powermap.h:59
@ PM_MODE_MVDR
Activity-map based on the energy of minimum- variance distortionless response (MVDR) beamformers.
Definition powermap.h:61
@ PM_MODE_MINNORM
Activity-map based on the sub-space method: minimum-norm (Min-Norm)
Definition powermap.h:71
@ PM_MODE_MINNORM_LOG
Same as PM_MODE_MINNORM, but log(out_values)
Definition powermap.h:73
@ PM_MODE_MUSIC_LOG
Same as PM_MODE_MUSIC, but log(out_values)
Definition powermap.h:70
@ PM_MODE_CROPAC_LCMV
Experimental! activity-map based on a linearly- contrained minimum-variance (LCMV) formulation of the...
Definition powermap.h:64
@ PM_MODE_MUSIC
Activity-map based on the sub-space method: multiple signal classification (MUSIC)
Definition powermap.h:68
int powermap_getMasterOrder(void *const hPm)
Returns the current maximum analysis/input order (see SH_ORDERS enum)
Definition powermap.c:598
float powermap_getPowermapEQ(void *const hPm, int bandIdx)
Returns the weighting coefficient for a particular frequency band index, allowing one to "equalise" t...
Definition powermap.c:622
void powermap_setDispFOV(void *const hPm, int newOption)
Sets the visualisation display window horizontal field-of-view (FOV) (see HFOV_OPTIONS enum)
Definition powermap.c:543
int powermap_getDispFOV(void *const hPm)
Returns the current visualisation display window horizontal field-of-view (FOV) (see HFOV_OPTIONS enu...
Definition powermap.c:703
void powermap_getPowermapEQHandle(void *const hPm, float **pX_vector, float **pY_values, int *pNpoints)
Returns the weighting coefficient for all frequency bands.
Definition powermap.c:635
void powermap_setAnaOrderAllBands(void *const hPm, int newValue)
Sets the input/analysis order for all frequency bands.
Definition powermap.c:505
int powermap_getProcessingDelay(void)
Returns the processing delay in samples (may be used for delay compensation features)
Definition powermap.c:746
int powermap_getSamplingRate(void *const hPm)
Returns the current sampling rate, in Hz.
Definition powermap.c:610
void powermap_getAnaOrderHandle(void *const hPm, float **pX_vector, int **pY_values, int *pNpoints)
Returns the input/analysis order for all frequency bands.
Definition powermap.c:661
int powermap_getNSHrequired(void *const hPm)
Returns the number of spherical harmonic signals required by the current analysis order: (current_ord...
Definition powermap.c:679
void powermap_setPowermapEQ(void *const hPm, float newValue, int bandIdx)
Sets the weighting coefficient for a particular frequency band, allowing one to "equalise" the activi...
Definition powermap.c:514
CODEC_STATUS powermap_getCodecStatus(void *const hPm)
Returns current codec status (see CODEC_STATUS enum)
Definition powermap.c:580
float powermap_getCovAvgCoeff(void *const hPm)
Returns the current covariance averaging coefficient value, in Hz.
Definition powermap.c:616