SAF
Loading...
Searching...
No Matches
beamformer.h

Generates beamformers/virtual microphones in arbitrary directions with several different beam patterns to choose from.

Generates beamformers/virtual microphones in arbitrary directions with several different beam patterns to choose from

Files

beamformer.h (include), beamformer_internal.h, beamformer.c, beamformer_internal.c

Include Header

/*
* Copyright 2019 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 __BEAMFORMER_H_INCLUDED__
#define __BEAMFORMER_H_INCLUDED__
#include "_common.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* ========================================================================== */
/* Main Functions */
/* ========================================================================== */
void beamformer_create(void** const phBeam);
void beamformer_destroy(void** const phBeam);
void beamformer_init(void* const hBeam,
int samplerate);
void beamformer_process(void* const hBeam,
const float *const * inputs,
float* const* outputs,
int nInputs,
int nOutputs,
int nSamples);
/* ========================================================================== */
/* Set Functions */
/* ========================================================================== */
void beamformer_refreshSettings(void* const hBeam);
void beamformer_setBeamOrder(void* const hBeam, int newValue);
void beamformer_setBeamAzi_deg(void* const hBeam, int index, float newAzi_deg);
void beamformer_setBeamElev_deg(void* const hBeam, int index, float newElev_deg);
void beamformer_setNumBeams(void* const hBeam, int new_nBeams);
void beamformer_setChOrder(void* const hBeam, int newOrder);
void beamformer_setNormType(void* const hBeam, int newType);
void beamformer_setBeamType(void* const hBeam, int newID);
/* ========================================================================== */
/* Get Functions */
/* ========================================================================== */
int beamformer_getBeamOrder(void* const hBeam);
float beamformer_getBeamAzi_deg(void* const hBeam, int index);
float beamformer_getBeamElev_deg(void* const hBeam, int index);
int beamformer_getNumBeams(void* const hBeam);
int beamformer_getNSHrequired(void* const hBeam);
int beamformer_getChOrder(void* const hBeam);
int beamformer_getNormType(void* const hBeam);
int beamformer_getBeamType(void* const hBeam);
#ifdef __cplusplus
} /* extern "C" { */
#endif /* __cplusplus */
#endif /* __BEAMFORMER_H_INCLUDED__ */
A bunch of things that are common to many of the saf examples.
float beamformer_getBeamAzi_deg(void *const hBeam, int index)
Returns the beamformer azimuth direction of a given index h, in DEGREES.
Definition beamformer.c:288
float beamformer_getBeamElev_deg(void *const hBeam, int index)
Returns the beamformer elevation direction of a given index, in DEGREES.
Definition beamformer.c:294
void beamformer_setBeamType(void *const hBeam, int newID)
Sets the beamforming approach to employ (see STATIC_BEAM_TYPES enum)
Definition beamformer.c:266
int beamformer_getChOrder(void *const hBeam)
Returns the Ambisonic channel ordering convention currently being used to decode with,...
Definition beamformer.c:317
int beamformer_getProcessingDelay(void)
Returns the processing delay in samples (may be used for delay compensation features)
Definition beamformer.c:335
int beamformer_getNumBeams(void *const hBeam)
Returns the number of beamformers being generated.
Definition beamformer.c:300
void beamformer_create(void **const phBeam)
Creates an instance of beamformer.
Definition beamformer.c:30
void beamformer_setBeamOrder(void *const hBeam, int newValue)
Sets the beamforming order (see SH_ORDERS enum)
Definition beamformer.c:207
void beamformer_setChOrder(void *const hBeam, int newOrder)
Sets the Ambisonic channel ordering convention to decode with, in order to match the convention emplo...
Definition beamformer.c:252
int beamformer_getBeamType(void *const hBeam)
Returns the beamforming approach employed (see STATIC_BEAM_TYPES enum)
Definition beamformer.c:329
void beamformer_setNumBeams(void *const hBeam, int new_nBeams)
Sets the number of beamformers to generate.
Definition beamformer.c:241
void beamformer_init(void *const hBeam, int samplerate)
Initialises an instance of beamformer with default settings.
Definition beamformer.c:72
int beamformer_getNSHrequired(void *const hBeam)
Returns the number of spherical harmonic signals required by the currently selected beamforming order...
Definition beamformer.c:311
int beamformer_getFrameSize(void)
Returns the processing framesize (i.e., number of samples processed with every _process() call )
Definition beamformer.c:277
void beamformer_destroy(void **const phBeam)
Destroys an instance of beamformer.
Definition beamformer.c:57
int beamformer_getMaxNumBeams(void)
Returns the maximum number of beamformers permitted.
Definition beamformer.c:306
void beamformer_process(void *const hBeam, const float *const *inputs, float *const *outputs, int nInputs, int nOutputs, int nSamples)
Generates beamformers/virtual microphones in the specified directions.
Definition beamformer.c:96
int beamformer_getBeamOrder(void *const hBeam)
Returns the beamforming order (see SH_ORDERS enum)
Definition beamformer.c:282
void beamformer_setBeamElev_deg(void *const hBeam, int index, float newElev_deg)
Sets a beamformer elevation direction for a given index, in DEGREES.
Definition beamformer.c:232
void beamformer_setBeamAzi_deg(void *const hBeam, int index, float newAzi_deg)
Sets a beamformer azimuth direction of a given index, in DEGREES.
Definition beamformer.c:221
void beamformer_refreshSettings(void *const hBeam)
Sets all intialisation flags to 1; re-initialising all settings/variables as beamformer is currently ...
Definition beamformer.c:199
void beamformer_setNormType(void *const hBeam, int newType)
Sets the Ambisonic normalisation convention to decode with, in order to match with the convention emp...
Definition beamformer.c:259
int beamformer_getNormType(void *const hBeam)
Returns the Ambisonic normalisation convention currently being usedto decode with,...
Definition beamformer.c:323