SAF
Loading...
Searching...
No Matches
beamformer_internal.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#ifndef __BEAMFORMER_INTERNAL_H_INCLUDED__
28#define __BEAMFORMER_INTERNAL_H_INCLUDED__
29
30#include "beamformer.h" /* Include header for this example */
31#include "saf.h" /* Main include header for SAF */
32#include "saf_externals.h" /* To also include SAF dependencies (cblas etc.) */
33
34#ifdef __cplusplus
35extern "C" {
36#endif /* __cplusplus */
37
38/* ========================================================================== */
39/* Internal Parameters */
40/* ========================================================================== */
41
42#if !defined(BEAMFORMER_FRAME_SIZE)
43# if defined(FRAME_SIZE) /* Use the global framesize if it is specified: */
44# define BEAMFORMER_FRAME_SIZE ( FRAME_SIZE )
45# else /* Otherwise, the default framesize for this example is: */
46# define BEAMFORMER_FRAME_SIZE ( 128 )
47# endif
48#endif
49#define MAX_NUM_BEAMS ( MAX_NUM_OUTPUTS )
51/* ========================================================================== */
52/* Structures */
53/* ========================================================================== */
54
59typedef struct _beamformer
60{
61 /* Internal audio buffers */
65 float tempFrame_fadeOut[MAX_NUM_SH_SIGNALS][BEAMFORMER_FRAME_SIZE];
66 float outputFrameTD[MAX_NUM_BEAMS][BEAMFORMER_FRAME_SIZE];
67 float outputFrameTD_fadeIn[MAX_NUM_SH_SIGNALS][BEAMFORMER_FRAME_SIZE];
69 /* internal variables */
70 int fs;
71 float beamWeights[MAX_NUM_BEAMS][MAX_NUM_SH_SIGNALS];
72 float prev_beamWeights[MAX_NUM_BEAMS][MAX_NUM_SH_SIGNALS];
73 float interpolator_fadeIn[BEAMFORMER_FRAME_SIZE];
74 float interpolator_fadeOut[BEAMFORMER_FRAME_SIZE];
75 int recalc_beamWeights[MAX_NUM_BEAMS];
77 /* user parameters */
79 int nBeams;
80 float beam_dirs_deg[MAX_NUM_BEAMS][2];
86
87
88/* ========================================================================== */
89/* Internal Functions */
90/* ========================================================================== */
91
92
93#ifdef __cplusplus
94} /* extern "C" { */
95#endif /* __cplusplus */
96
97#endif /* __BEAMFORMER_INTERNAL_H_INCLUDED__ */
STATIC_BEAM_TYPES
Available static beamforming approaches.
Definition _common.h:168
NORM_TYPES
Available Ambisonic normalisation conventions.
Definition _common.h:74
CH_ORDER
Available Ambisonic channel ordering conventions.
Definition _common.h:59
#define MAX_NUM_SH_SIGNALS
Maximum number of spherical harmonic components/signals supported.
Definition _common.h:239
Generates beamformers/virtual microphones in arbitrary directions with several different beam pattern...
#define BEAMFORMER_FRAME_SIZE
Framesize, in time-domain samples.
#define MAX_NUM_BEAMS
Maximum permitted number of beams/output channels.
Main include header for the Spatial_Audio_Framework (SAF)
Include header for SAF externals.
Main structure for beamformer.
CH_ORDER chOrdering
Ambisonic channel order convention (see CH_ORDER)
int nBeams
number of loudspeakers/virtual loudspeakers
NORM_TYPES norm
Ambisonic normalisation convention (see NORM_TYPES)
int fs
Host sampling rate, in Hz.
STATIC_BEAM_TYPES beamType
see STATIC_BEAM_TYPES enum
int beamOrder
beam order