SAF
Loading...
Searching...
No Matches
saf_hades_synthesis.h
Go to the documentation of this file.
1/*
2 * This file is part of the saf_hades module.
3 * Copyright (c) 2021 - Leo McCormack & Janani Fernandez
4 *
5 * The saf_hades module is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * The saf_hades module is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * See <http://www.gnu.org/licenses/> for a copy of the GNU General Public
16 * License.
17 */
18
38#ifndef __SAF_HADES_SYNTHESIS_H_INCLUDED__
39#define __SAF_HADES_SYNTHESIS_H_INCLUDED__
40
41#include "saf_hades_analysis.h"
42
43#ifdef __cplusplus
44extern "C" {
45#endif /* __cplusplus */
46
47#ifdef SAF_ENABLE_HADES_MODULE
48
50typedef struct _hades_synthesis_data* hades_synthesis_handle;
51
53typedef struct _hades_radial_editor_data* hades_radial_editor_handle;
54
55/* ========================================================================== */
56/* HADES Synthesis Configurations Options */
57/* ========================================================================== */
58
60typedef struct _hades_binaural_config{
61 int lHRIR;
62 int nHRIR;
63 int hrir_fs;
64 float* hrirs;
69
77
83
84
85/* ========================================================================== */
86/* HADES Radial Editor */
87/* ========================================================================== */
88
96void hades_radial_editor_create(/* Input Arguments */
97 hades_radial_editor_handle* const phREd,
98 hades_analysis_handle const hAna);
99
105void hades_radial_editor_destroy(/* Input Arguments */
106 hades_radial_editor_handle* const phREd);
107
115void hades_radial_editor_apply(/* Input Arguments */
118 float dirGain_dB[360]);
119
120
121/* ========================================================================== */
122/* HADES Synthesis */
123/* ========================================================================== */
124
135void hades_synthesis_create(/* Input Arguments */
136 hades_synthesis_handle* const phSyn,
137 hades_analysis_handle const hAna,
138 HADES_BEAMFORMER_TYPE beamOption,
139 int enableCM,
140 int refIndices[2],
141 hades_binaural_config* binConfig,
142 HADES_HRTF_INTERP_OPTIONS interpOption);
143
149void hades_synthesis_destroy(/* Input Arguments */
150 hades_synthesis_handle* const phSyn);
151
160
175void hades_synthesis_apply(/* Input Arguments */
176 hades_synthesis_handle const hSyn,
179 int nChannels,
180 int blocksize,
181 /* Output Arguments */
182 float** output);
183
193 int* nBands);
194
205 int* nBands);
206
216
225
226#endif /* SAF_ENABLE_HADES_MODULE */
227
228
229#ifdef __cplusplus
230} /* extern "C" */
231#endif /* __cplusplus */
232
233#endif /* __SAF_HADES_SYNTHESIS_H_INCLUDED__ */
Header for the HADES analysis (SAF_HADES_MODULE)
struct _hades_analysis_data * hades_analysis_handle
Handle for the hades analysis data.
struct _hades_param_container_data * hades_param_container_handle
Handle for the hades parameter container data.
struct _hades_signal_container_data * hades_signal_container_handle
Handle for the hades signal container data.
void hades_radial_editor_destroy(hades_radial_editor_handle *const phREd)
Destroys an instance of a hades radial editor object.
int hades_synthesis_getProcDelay(hades_synthesis_handle const hSyn)
Returns the synthesiser processing delay, in samples.
void hades_radial_editor_apply(hades_radial_editor_handle const hREd, hades_param_container_handle const hPCon, float dirGain_dB[360])
Applies the radial (360 degree) parameter editing.
void hades_radial_editor_create(hades_radial_editor_handle *const phREd, hades_analysis_handle const hAna)
Creates and returns a handle to an instance of a hades radial editor object, which allows for directi...
float * hades_synthesis_getEqPtr(hades_synthesis_handle const hSyn, int *nBands)
Returns a pointer to the eq vector, which can be changed at run-time.
float * hades_synthesis_getSynthesisAveragingCoeffPtr(hades_synthesis_handle const hSyn)
Returns a pointer to the synthesis averaging coefficient scalar [0..1], which can be changed at run-t...
struct _hades_radial_editor_data * hades_radial_editor_handle
Handle for the hades radial editor data.
struct _hades_synthesis_data * hades_synthesis_handle
Handle for the hades synthesis data.
HADES_BEAMFORMER_TYPE
Beamforming options for hades_synthesis.
@ HADES_BEAMFORMER_FILTER_AND_SUM
Filter-and-sum beamforming.
@ HADES_BEAMFORMER_BMVDR
Binaural minimum-variance distortion- less response (MVDR) beamforming.
@ HADES_BEAMFORMER_NONE
No beamforming (ref sensors only)
void hades_synthesis_apply(hades_synthesis_handle const hSyn, hades_param_container_handle const hPCon, hades_signal_container_handle const hSCon, int nChannels, int blocksize, float **output)
Performs hades synthesis.
void hades_synthesis_create(hades_synthesis_handle *const phSyn, hades_analysis_handle const hAna, HADES_BEAMFORMER_TYPE beamOption, int enableCM, int refIndices[2], hades_binaural_config *binConfig, HADES_HRTF_INTERP_OPTIONS interpOption)
Creates and returns a handle to an instance of a hades synthesis object.
HADES_HRTF_INTERP_OPTIONS
HRTF interpolation options for hades_synthesis.
@ HADES_HRTF_INTERP_NEAREST
Quantise to nearest measurement.
@ HADES_HRTF_INTERP_TRIANGULAR
Triangular interpolation.
float * hades_synthesis_getStreamBalancePtr(hades_synthesis_handle const hSyn, int *nBands)
Returns a pointer to the stream balance vector [0..2], which can be changed at run-time.
void hades_synthesis_reset(hades_synthesis_handle const hSyn)
Flushes run-time buffers with zeros.
void hades_synthesis_destroy(hades_synthesis_handle *const phSyn)
Destroys an instance of hades synthesis.
Binaural configuration struct.
int nHRIR
Number of HRIRs.
int hrir_fs
HRIR sample rate.
int lHRIR
Length of HRIRs in samples.
float * hrir_dirs_deg
HRTF directions in [azimuth elevation] format, in degrees; FLAT: nHRIR x 2.
float * hrirs
Matrix of HRIR data; FLAT: nHRIR x NUM_EARS x lHRIR.