SAF
Loading...
Searching...
No Matches
beamformer.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
27
37
38#ifndef __BEAMFORMER_H_INCLUDED__
39#define __BEAMFORMER_H_INCLUDED__
40
41#include "_common.h"
42
43#ifdef __cplusplus
44extern "C" {
45#endif /* __cplusplus */
46
48extern const int beamformer_defaultNumBeams;
49
52
53
54/* ========================================================================== */
55/* Main Functions */
56/* ========================================================================== */
57
63void beamformer_create(void** const phBeam);
64
70void beamformer_destroy(void** const phBeam);
71
78void beamformer_init(void* const hBeam,
79 int samplerate);
80
91void beamformer_process(void* const hBeam,
92 const float *const * inputs,
93 float* const* outputs,
94 int nInputs,
95 int nOutputs,
96 int nSamples);
97
98
99/* ========================================================================== */
100/* Set Functions */
101/* ========================================================================== */
102
107void beamformer_refreshSettings(void* const hBeam);
108
117void beamformer_setBeamOrder(void* const hBeam, int newValue);
118
120void beamformer_setBeamAzi_deg(void* const hBeam, int index, float newAzi_deg);
121
123void beamformer_setBeamElev_deg(void* const hBeam, int index, float newElev_deg);
124
126void beamformer_setNumBeams(void* const hBeam, int new_nBeams);
127
132void beamformer_setChOrder(void* const hBeam, int newOrder);
133
138void beamformer_setNormType(void* const hBeam, int newType);
139
141void beamformer_setBeamType(void* const hBeam, int newID);
142
143
144/* ========================================================================== */
145/* Get Functions */
146/* ========================================================================== */
147
153
155int beamformer_getBeamOrder(void* const hBeam);
156
158float beamformer_getBeamAzi_deg(void* const hBeam, int index);
159
161float beamformer_getBeamElev_deg(void* const hBeam, int index);
162
164int beamformer_getNumBeams(void* const hBeam);
165
168
173int beamformer_getNSHrequired(void* const hBeam);
174
180int beamformer_getChOrder(void* const hBeam);
181
187int beamformer_getNormType(void* const hBeam);
188
190int beamformer_getBeamType(void* const hBeam);
191
197
198
199#ifdef __cplusplus
200} /* extern "C" { */
201#endif /* __cplusplus */
202
203#endif /* __BEAMFORMER_H_INCLUDED__ */
A bunch of things that are common to many of the saf examples.
#define MAX_NUM_INPUTS
Maximum number of input channels supported.
Definition _common.h:261
float beamformer_getBeamAzi_deg(void *const hBeam, int index)
Returns the beamformer azimuth direction of a given index h, in DEGREES.
Definition beamformer.c:285
float beamformer_getBeamElev_deg(void *const hBeam, int index)
Returns the beamformer elevation direction of a given index, in DEGREES.
Definition beamformer.c:291
void beamformer_setBeamType(void *const hBeam, int newID)
Sets the beamforming approach to employ (see STATIC_BEAM_TYPES enum)
Definition beamformer.c:263
int beamformer_getChOrder(void *const hBeam)
Returns the Ambisonic channel ordering convention currently being used to decode with,...
Definition beamformer.c:314
int beamformer_getProcessingDelay(void)
Returns the processing delay in samples (may be used for delay compensation features)
Definition beamformer.c:332
int beamformer_getNumBeams(void *const hBeam)
Returns the number of beamformers being generated.
Definition beamformer.c:297
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:204
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:249
int beamformer_getBeamType(void *const hBeam)
Returns the beamforming approach employed (see STATIC_BEAM_TYPES enum)
Definition beamformer.c:326
const float beamformer_defaultBeamDirections[MAX_NUM_INPUTS][2]
Default beam directions.
void beamformer_setNumBeams(void *const hBeam, int new_nBeams)
Sets the number of beamformers to generate.
Definition beamformer.c:238
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:308
int beamformer_getFrameSize(void)
Returns the processing framesize (i.e., number of samples processed with every _process() call )
Definition beamformer.c:274
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:303
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:95
int beamformer_getBeamOrder(void *const hBeam)
Returns the beamforming order (see SH_ORDERS enum)
Definition beamformer.c:279
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:229
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:218
void beamformer_refreshSettings(void *const hBeam)
Sets all intialisation flags to 1; re-initialising all settings/variables as beamformer is currently ...
Definition beamformer.c:196
const int beamformer_defaultNumBeams
Default number of beams.
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:256
int beamformer_getNormType(void *const hBeam)
Returns the Ambisonic normalisation convention currently being usedto decode with,...
Definition beamformer.c:320