SAF
Loading...
Searching...
No Matches
powermap.h

A sound-field visualiser, which utilises spherical harmonic signals as input.

A sound-field visualiser, which utilises spherical harmonic signals as input

Files

powermap.h (include), powermap_internal.h, powermap.c, powermap_internal.c

Include Header

/*
* Copyright 2016-2018 Leo McCormack
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef __POWERMAP_H_INCLUDED__
#define __POWERMAP_H_INCLUDED__
#include "_common.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* ========================================================================== */
/* Presets + Constants */
/* ========================================================================== */
typedef enum {
/* ========================================================================== */
/* Main Functions */
/* ========================================================================== */
void powermap_create(void** const phPm);
void powermap_destroy(void** const phPm);
void powermap_init(void* const hPm,
float samplerate);
void powermap_initCodec(void* const hPm);
void powermap_analysis(void* const hPm,
const float *const * inputs,
int nInputs,
int nSamples,
int isPlaying);
/* ========================================================================== */
/* Set Functions */
/* ========================================================================== */
void powermap_refreshSettings(void* const hPm);
void powermap_setPowermapMode(void* const hPm, int newMode);
void powermap_setMasterOrder(void* const hPm, int newValue);
void powermap_setAnaOrder(void* const hPm, int newValue, int bandIdx);
void powermap_setAnaOrderAllBands(void* const hPm, int newValue);
void powermap_setPowermapEQ(void* const hPm, float newValue, int bandIdx);
void powermap_setPowermapEQAllBands(void* const hPm, float newValue);
void powermap_setCovAvgCoeff(void* const hPm, float newAvg);
void powermap_setChOrder(void* const hPm, int newOrder);
void powermap_setNormType(void* const hPm, int newType);
void powermap_setSourcePreset(void* const hPm, int newPresetID);
void powermap_setNumSources(void* const hPm, int newValue);
void powermap_setDispFOV(void* const hPm, int newOption);
void powermap_setAspectRatio(void* const hPm, int newOption);
void powermap_setPowermapAvgCoeff(void* const hPm, float newValue);
void powermap_requestPmapUpdate(void* const hPm);
/* ========================================================================== */
/* Get Functions */
/* ========================================================================== */
float powermap_getProgressBar0_1(void* const hPm);
void powermap_getProgressBarText(void* const hPm, char* text);
int powermap_getMasterOrder(void* const hPm);
int powermap_getPowermapMode(void* const hPm);
int powermap_getSamplingRate(void* const hPm);
float powermap_getCovAvgCoeff(void* const hPm);
int powermap_getNSHrequired(void* const hPm);
float powermap_getPowermapEQ(void* const hPm, int bandIdx);
float powermap_getPowermapEQAllBands(void* const hPm);
void powermap_getPowermapEQHandle(void* const hPm,
float** pX_vector,
float** pY_values,
int* pNpoints);
int powermap_getAnaOrder(void* const hPm, int bandIdx);
int powermap_getAnaOrderAllBands(void* const hPm);
void powermap_getAnaOrderHandle(void* const hPm,
float** pX_vector,
int** pY_values,
int* pNpoints);
int powermap_getChOrder(void* const hPm);
int powermap_getNormType(void* const hPm);
int powermap_getNumSources(void* const hPm);
int powermap_getDispFOV(void* const hPm);
int powermap_getAspectRatio(void* const hPm);
float powermap_getPowermapAvgCoeff(void* const hPm);
int powermap_getPmap(void* const hPm,
float** grid_dirs,
float** pmap,
int* nDirs,
int* pmapWidth,
int* hfov,
int* aspectRatio);
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#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