SAF
Loading...
Searching...
No Matches
dirass.h
Go to the documentation of this file.
1/*
2 * Copyright 2019 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
47#ifndef __DIRASS_H_INCLUDED__
48#define __DIRASS_H_INCLUDED__
49
50#include "_common.h"
51
52#ifdef __cplusplus
53extern "C" {
54#endif /* __cplusplus */
55
56/* ========================================================================== */
57/* Presets + Constants */
58/* ========================================================================== */
59
84
101
121
122
123/* ========================================================================== */
124/* Main Functions */
125/* ========================================================================== */
126
132void dirass_create(void** const phDir);
133
139void dirass_destroy(void** const phDir);
140
149void dirass_init(void* const hDir,
150 float samplerate);
151
167void dirass_initCodec(void* const hDir);
168
191void dirass_analysis(void* const hDir,
192 const float *const * inputs,
193 int nInputs,
194 int nSamples,
195 int isPlaying);
196
197
198/* ========================================================================== */
199/* Set Functions */
200/* ========================================================================== */
201
206void dirass_refreshSettings(void* const hDir);
207
212void dirass_setBeamType(void* const hDir, int newType);
213
215void dirass_setInputOrder(void* const hDir, int newValue);
216
222void dirass_setDisplayGridOption(void* const hDir, int newOption);
223
229void dirass_setDispWidth(void* const hDir, int newValue);
230
235void dirass_setUpscaleOrder(void* const hDir, int newOrder);
236
241void dirass_setDiRAssMode(void* const hDir, int newMode);
242
244void dirass_setMinFreq(void* const hDir, float newValue);
245
247void dirass_setMaxFreq(void* const hDir, float newValue);
248
253void dirass_setChOrder(void* const hDir, int newOrder);
254
259void dirass_setNormType(void* const hDir, int newType);
260
265void dirass_setDispFOV(void* const hDir, int newOption);
266
271void dirass_setAspectRatio(void* const hDir, int newOption);
272
274void dirass_setMapAvgCoeff(void* const hDir, float newValue);
275
277void dirass_requestPmapUpdate(void* const hDir);
278
279
280/* ========================================================================== */
281/* Get Functions */
282/* ========================================================================== */
283
288int dirass_getFrameSize(void);
289
291CODEC_STATUS dirass_getCodecStatus(void* const hDir);
292
298float dirass_getProgressBar0_1(void* const hDir);
299
309void dirass_getProgressBarText(void* const hDir, char* text);
310
314int dirass_getInputOrder(void* const hDir);
315
320int dirass_getBeamType(void* const hDir);
321
323int dirass_getDisplayGridOption(void* const hDir);
324
326int dirass_getDispWidth(void* const hDir);
327
329int dirass_getUpscaleOrder(void* const hDir);
330
335int dirass_getDiRAssMode(void* const hDir);
336
338float dirass_getMinFreq(void* const hDir);
339
341float dirass_getMaxFreq(void* const hDir);
342
344int dirass_getSamplingRate(void* const hDir);
345
350int dirass_getNSHrequired(void* const hDir);
351
357int dirass_getChOrder(void* const hDir);
358
364int dirass_getNormType(void* const hDir);
365
370int dirass_getDispFOV(void* const hDir);
371
376int dirass_getAspectRatio(void* const hDir);
377
379float dirass_getMapAvgCoeff(void* const hDir);
380
395int dirass_getPmap(void* const hDir,
396 float** grid_dirs,
397 float** pmap,
398 int* nDirs,
399 int* pmapWidth,
400 int* hfov,
401 float* aspectRatio);
402
408
409
410#ifdef __cplusplus
411} /* extern "C" */
412#endif /* __cplusplus */
413
414#endif /* __DIRASS_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 dirass_getInputOrder(void *const hDir)
Returns the current analysis/input order (see SH_ORDERS enum)
Definition dirass.c:569
int dirass_getDiRAssMode(void *const hDir)
Returns the current analysis directional re-assignment mode (see DIRASS_REASS_MODES enum)
Definition dirass.c:599
void dirass_setInputOrder(void *const hDir, int newValue)
Sets the input/analysis order (see SH_ORDERS enum)
Definition dirass.c:434
void dirass_requestPmapUpdate(void *const hDir)
Informs dirass that it should compute a new activity-map.
Definition dirass.c:537
void dirass_setMinFreq(void *const hDir, float newValue)
Sets the minimum analysis frequency, in Hz.
Definition dirass.c:487
void dirass_create(void **const phDir)
Creates an instance of the dirass.
Definition dirass.c:41
void dirass_init(void *const hDir, float samplerate)
Initialises an instance of dirass with default settings.
Definition dirass.c:148
void dirass_analysis(void *const hDir, const float *const *inputs, int nInputs, int nSamples, int isPlaying)
Analyses the input spherical harmonic signals to generate an activity-map as in [1,...
Definition dirass.c:198
void dirass_initCodec(void *const hDir)
Intialises the codec variables, based on current global/user parameters.
Definition dirass.c:170
void dirass_destroy(void **const phDir)
Destroys an instance of the dirass.
Definition dirass.c:103
void dirass_setDispWidth(void *const hDir, int newValue)
Sets the output display width in pixels.
Definition dirass.c:457
DIRASS_REASS_MODES
Available processing modes.
Definition dirass.h:110
@ REASS_NEAREST
Each sector beamformer energy is re-assigned to the nearest interpolation grid point,...
Definition dirass.h:113
@ REASS_MODE_OFF
Re-assignment is disabled.
Definition dirass.h:111
@ REASS_UPSCALE
Each sector beamformer is re-encoded into spherical harmonics of a higher order.
Definition dirass.h:116
int dirass_getProcessingDelay(void)
Returns the processing delay in samples (may be used for delay compensation features)
Definition dirass.c:685
void dirass_setMaxFreq(void *const hDir, float newValue)
Sets the maximum analysis frequency, in Hz.
Definition dirass.c:493
void dirass_setDiRAssMode(void *const hDir, int newMode)
Sets the analysis directional re-assignment mode (see DIRASS_REASS_MODES enum)
Definition dirass.c:475
void dirass_setAspectRatio(void *const hDir, int newOption)
Sets the visualisation display window aspect-ratio (see ASPECT_RATIO_OPTIONS enum)
Definition dirass.c:522
float dirass_getMinFreq(void *const hDir)
Returns the current minimum analysis frequency, in Hz.
Definition dirass.c:605
void dirass_setDisplayGridOption(void *const hDir, int newOption)
Sets a new display grid option (see DIRASS_GRID_OPTIONS enum)
Definition dirass.c:448
int dirass_getNormType(void *const hDir)
Returns the Ambisonic normalisation convention currently being usedto decode with,...
Definition dirass.c:635
int dirass_getDisplayGridOption(void *const hDir)
Returns the current display grid option (see DIRASS_GRID_OPTIONS enum)
Definition dirass.c:581
int dirass_getDispWidth(void *const hDir)
Returns the current output display width in pixels.
Definition dirass.c:587
void dirass_setDispFOV(void *const hDir, int newOption)
Sets the visualisation display window horizontal field-of-view (FOV) (see HFOV_OPTIONS enum)
Definition dirass.c:513
int dirass_getDispFOV(void *const hDir)
Returns the current visualisation display window horizontal field-of-view (FOV) (see HFOV_OPTIONS enu...
Definition dirass.c:641
int dirass_getPmap(void *const hDir, float **grid_dirs, float **pmap, int *nDirs, int *pmapWidth, int *hfov, float *aspectRatio)
Returns the latest computed activity-map if it is ready; otherwise it returns 0, and you'll just have...
Definition dirass.c:659
float dirass_getMaxFreq(void *const hDir)
Returns the current maximum analysis frequency, in Hz.
Definition dirass.c:611
int dirass_getSamplingRate(void *const hDir)
Returns the current sampling rate, in Hz.
Definition dirass.c:617
CODEC_STATUS dirass_getCodecStatus(void *const hDir)
Returns current codec status (see CODEC_STATUS enum)
Definition dirass.c:551
int dirass_getUpscaleOrder(void *const hDir)
Returns the current upscale order (see DIRASS_UPSCALE_ORDERS enum)
Definition dirass.c:593
int dirass_getFrameSize(void)
Returns the processing framesize (i.e., number of samples processed with every _process() call )
Definition dirass.c:546
void dirass_setNormType(void *const hDir, int newType)
Sets the Ambisonic normalisation convention to decode with, in order to match with the convention emp...
Definition dirass.c:506
int dirass_getChOrder(void *const hDir)
Returns the Ambisonic channel ordering convention currently being used to decode with,...
Definition dirass.c:629
void dirass_setBeamType(void *const hDir, int newType)
Sets the sector beamforming pattern to employ for the analysis (see STATIC_BEAM_TYPES enum).
Definition dirass.c:425
void dirass_getProgressBarText(void *const hDir, char *text)
(Optional) Returns current intialisation/processing progress text
Definition dirass.c:563
int dirass_getAspectRatio(void *const hDir)
Returns the current visualisation display window aspect-ratio (see ASPECT_RATIO_OPTIONS enum)
Definition dirass.c:647
float dirass_getProgressBar0_1(void *const hDir)
(Optional) Returns current intialisation/processing progress, between 0..1
Definition dirass.c:557
void dirass_setUpscaleOrder(void *const hDir, int newOrder)
Sets the upscale order, only if DIRASS_REASS_MODES is set to REASS_UPSCALE, (see DIRASS_UPSCALE_ORDER...
Definition dirass.c:466
DIRASS_GRID_OPTIONS
Available scanning grid options.
Definition dirass.h:86
@ GRID_GEOSPHERE_10
GRID_GEOSPHERE_10 - 1002 points.
Definition dirass.h:97
@ T_DESIGN_9
T_DESIGN_9 - 48 points.
Definition dirass.h:90
@ T_DESIGN_3
T_DESIGN_3 - 6 points.
Definition dirass.h:87
@ T_DESIGN_13
T_DESIGN_13 - 94 points.
Definition dirass.h:91
@ T_DESIGN_6
T_DESIGN_6 - 24 points.
Definition dirass.h:89
@ GRID_GEOSPHERE_9
GRID_GEOSPHERE_9 - 812 points.
Definition dirass.h:96
@ GRID_GEOSPHERE_8
GRID_GEOSPHERE_8 - 642 points.
Definition dirass.h:95
@ GRID_GEOSPHERE_6
GRID_GEOSPHERE_6 - 362 points.
Definition dirass.h:93
@ T_DESIGN_30
T_DESIGN_30 - 480 points.
Definition dirass.h:94
@ T_DESIGN_18
T_DESIGN_18 - 180 points.
Definition dirass.h:92
@ T_DESIGN_4
T_DESIGN_4 - 12 points.
Definition dirass.h:88
@ GRID_GEOSPHERE_12
GRID_GEOSPHERE_12 - 1442 points.
Definition dirass.h:98
void dirass_setMapAvgCoeff(void *const hDir, float newValue)
Sets the activity-map averaging coefficient, 0..1.
Definition dirass.c:531
void dirass_refreshSettings(void *const hDir)
Sets all intialisation flags to 1; re-initialising all settings/variables as dirass is currently conf...
Definition dirass.c:420
DIRASS_UPSCALE_ORDERS
Available upscaling orders.
Definition dirass.h:61
@ UPSCALE_ORDER_EIGHTEENTH
Eighteenth-order upscaling.
Definition dirass.h:79
@ UPSCALE_ORDER_TWENTIETH
Twentieth-order upscaling.
Definition dirass.h:81
@ UPSCALE_ORDER_NINETEENTH
Ninteenth-order upscaling.
Definition dirass.h:80
@ UPSCALE_ORDER_FIRST
First-order upscaling.
Definition dirass.h:62
@ UPSCALE_ORDER_SIXTH
Sixth-order upscaling.
Definition dirass.h:67
@ UPSCALE_ORDER_SEVENTH
Seventh-order upscaling.
Definition dirass.h:68
@ UPSCALE_ORDER_SEVENTEENTH
Seventeenth-order upscaling.
Definition dirass.h:78
@ UPSCALE_ORDER_TWELFTH
Twelfth-order upscaling.
Definition dirass.h:73
@ UPSCALE_ORDER_EIGHTH
Eighth-order upscaling.
Definition dirass.h:69
@ UPSCALE_ORDER_SECOND
Second-order upscaling.
Definition dirass.h:63
@ UPSCALE_ORDER_FIFTEENTH
Fifteenth-order upscaling.
Definition dirass.h:76
@ UPSCALE_ORDER_FOURTH
Fourth-order upscaling.
Definition dirass.h:65
@ UPSCALE_ORDER_NINTH
Ninth-order upscaling.
Definition dirass.h:70
@ UPSCALE_ORDER_THIRTEENTH
Thirteenth-order upscaling.
Definition dirass.h:74
@ UPSCALE_ORDER_THIRD
Third-order upscaling.
Definition dirass.h:64
@ UPSCALE_ORDER_FIFTH
Fifth-order upscaling.
Definition dirass.h:66
@ UPSCALE_ORDER_SIXTHTEENTH
Sixthteenth-order upscaling.
Definition dirass.h:77
@ UPSCALE_ORDER_ELEVENTH
Eleventh-order upscaling.
Definition dirass.h:72
@ UPSCALE_ORDER_FOURTEENTH
Fourteenth-order upscaling.
Definition dirass.h:75
@ UPSCALE_ORDER_TENTH
Tenth-order upscaling.
Definition dirass.h:71
void dirass_setChOrder(void *const hDir, int newOrder)
Sets the Ambisonic channel ordering convention to decode with, in order to match the convention emplo...
Definition dirass.c:499
float dirass_getMapAvgCoeff(void *const hDir)
Returns the current activity-map averaging coefficient, 0..1.
Definition dirass.c:653
int dirass_getNSHrequired(void *const hDir)
Returns the number of spherical harmonic signals required by the current analysis order: (current_ord...
Definition dirass.c:623
int dirass_getBeamType(void *const hDir)
Returns the sector beamforming pattern to employed for the analysis (see STATIC_BEAM_TYPES enum)
Definition dirass.c:575