SAF
Loading...
Searching...
No Matches
binauraliser.h
Go to the documentation of this file.
1/*
2 * Copyright 2017-2018 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
44#ifndef __BINAURALISER_H_INCLUDED__
45#define __BINAURALISER_H_INCLUDED__
46
47#include "_common.h"
48
49#ifdef __cplusplus
50extern "C" {
51#endif /* __cplusplus */
52
53/* ========================================================================== */
54/* Presets + Constants */
55/* ========================================================================== */
56
62
63
64/* ========================================================================== */
65/* Main Functions */
66/* ========================================================================== */
67
73void binauraliser_create(void** const phBin);
74
80void binauraliser_destroy(void** const phBin);
81
90void binauraliser_init(void* const hBin,
91 int samplerate);
92
108void binauraliser_initCodec(void* const hBin);
109
120void binauraliser_process(void* const hBin,
121 const float *const * inputs,
122 float* const* outputs,
123 int nInputs,
124 int nOutputs,
125 int nSamples);
126
127
128/* ========================================================================== */
129/* Set Functions */
130/* ========================================================================== */
131
136void binauraliser_refreshSettings(void* const hBin);
137
139void binauraliser_setSourceAzi_deg(void* const hBin,
140 int index,
141 float newAzi_deg);
142
144void binauraliser_setSourceElev_deg(void* const hBin,
145 int index,
146 float newElev_deg);
147
149void binauraliser_setNumSources(void* const hBin, int new_nSources);
150
159void binauraliser_setUseDefaultHRIRsflag(void* const hBin, int newState);
160
172void binauraliser_setSofaFilePath(void* const hBin, const char* path);
173
175void binauraliser_setEnableHRIRsDiffuseEQ(void* const hBin, int newState);
176
178void binauraliser_setInputConfigPreset(void* const hBin, int newPresetID);
179
181void binauraliser_setEnableRotation(void* const hBin, int newState);
182
184void binauraliser_setYaw(void* const hBin, float newYaw);
185
187void binauraliser_setPitch(void* const hBin, float newPitch);
188
190void binauraliser_setRoll(void* const hBin, float newRoll);
191
196void binauraliser_setFlipYaw(void* const hBin, int newState);
197
202void binauraliser_setFlipPitch(void* const hBin, int newState);
203
208void binauraliser_setFlipRoll(void* const hBin, int newState);
209
214void binauraliser_setRPYflag(void* const hBin, int newState);
215
217void binauraliser_setInterpMode(void* const hBin, int newMode);
218
222void binauraliser_setSourceGain(void* const hBin, int srcIdx, float newGain);
223
227void binauraliser_setSourceSolo(void* const hBin, int srcIdx);
228
232void binauraliser_setUnSolo(void* const hBin);
233
234
235/* ========================================================================== */
236/* Get Functions */
237/* ========================================================================== */
238
244
247
253float binauraliser_getProgressBar0_1(void* const hBin);
254
261void binauraliser_getProgressBarText(void* const hBin, char* text);
262
264float binauraliser_getSourceAzi_deg(void* const hBin, int index);
265
267float binauraliser_getSourceElev_deg(void* const hBin, int index);
268
270int binauraliser_getNumSources(void* const hBin);
271
274
277
279int binauraliser_getNDirs(void* const hBin);
280
285int binauraliser_getNTriangles(void* const hBin);
286
288float binauraliser_getHRIRAzi_deg(void* const hBin, int index);
289
291float binauraliser_getHRIRElev_deg(void* const hBin, int index);
292
294int binauraliser_getHRIRlength(void* const hBin);
295
297int binauraliser_getHRIRsamplerate(void* const hBin);
298
307int binauraliser_getUseDefaultHRIRsflag(void* const hBin);
308
319char* binauraliser_getSofaFilePath(void* const hBin);
320
325int binauraliser_getEnableHRIRsDiffuseEQ(void* const hBin);
326
328int binauraliser_getDAWsamplerate(void* const hBin);
329
334int binauraliser_getEnableRotation(void* const hBin);
335
337float binauraliser_getYaw(void* const hBin);
338
340float binauraliser_getPitch(void* const hBin);
341
343float binauraliser_getRoll(void* const hBin);
344
349int binauraliser_getFlipYaw(void* const hBin);
350
355int binauraliser_getFlipPitch(void* const hBin);
356
361int binauraliser_getFlipRoll(void* const hBin);
362
367int binauraliser_getRPYflag(void* const hBin);
368
370int binauraliser_getInterpMode(void* const hBin);
371
377
378
379#ifdef __cplusplus
380} /* extern "C" { */
381#endif /* __cplusplus */
382
383#endif /* __BINAURALISER_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 binauraliser_getNTriangles(void *const hBin)
Returns the number of triangular groupings (faces) returned by the Convex Hull.
void binauraliser_setSofaFilePath(void *const hBin, const char *path)
Sets the file path for a .sofa file, in order to employ a custom HRIR set for the decoding.
void binauraliser_refreshSettings(void *const hBin)
Sets all intialisation flags to 1; re-initialising all settings/variables as binauraliser is currentl...
char * binauraliser_getSofaFilePath(void *const hBin)
Returns the file path for a .sofa file.
void binauraliser_setEnableHRIRsDiffuseEQ(void *const hBin, int newState)
Enable (1) or disable (0) the diffuse-field EQ applied to the HRTFs.
int binauraliser_getFlipPitch(void *const hBin)
Returns a flag as to whether to "flip" the sign of the current 'pitch' angle (0: do not flip sign,...
int binauraliser_getNDirs(void *const hBin)
Returns the number of directions in the currently used HRIR set.
void binauraliser_process(void *const hBin, const float *const *inputs, float *const *outputs, int nInputs, int nOutputs, int nSamples)
Binauralises the input signals at the user specified directions.
void binauraliser_destroy(void **const phBin)
Destroys an instance of the binauraliser.
int binauraliser_getUseDefaultHRIRsflag(void *const hBin)
Returns the value of a flag used to dictate whether the default HRIRs in the Spatial_Audio_Framework ...
void binauraliser_setRoll(void *const hBin, float newRoll)
Sets the 'roll' rotation angle, in DEGREES.
void binauraliser_initCodec(void *const hBin)
Intialises the codec variables, based on current global/user parameters.
int binauraliser_getFlipRoll(void *const hBin)
Returns a flag as to whether to "flip" the sign of the current 'roll' angle (0: do not flip sign,...
void binauraliser_setSourceAzi_deg(void *const hBin, int index, float newAzi_deg)
Sets the panning azimuth for a specific channel index, in DEGREES.
void binauraliser_setPitch(void *const hBin, float newPitch)
Sets the 'pitch' rotation angle, in DEGREES.
void binauraliser_setSourceGain(void *const hBin, int srcIdx, float newGain)
Sets gain factor for an input source.
int binauraliser_getEnableHRIRsDiffuseEQ(void *const hBin)
Returns the flag indicating whether the diffuse-field EQ applied to the HRTFs is enabled (1) or disab...
void binauraliser_setSourceElev_deg(void *const hBin, int index, float newElev_deg)
Sets the panning elevation for a specific channel index, in DEGREES.
void binauraliser_init(void *const hBin, int samplerate)
Initialises an instance of binauraliser with default settings.
float binauraliser_getProgressBar0_1(void *const hBin)
(Optional) Returns current intialisation/processing progress, between 0..1
INTERP_MODES
Available interpolation modes.
@ INTERP_TRI
Triangular interpolation.
@ INTERP_TRI_PS
Triangular interpolation (with phase-simplification)
CODEC_STATUS binauraliser_getCodecStatus(void *const hBin)
Returns current codec status codec status (see CODEC_STATUS enum)
int binauraliser_getMaxNumSources(void)
Returns the maximum number of input sources supported by binauraliser.
void binauraliser_create(void **const phBin)
Creates an instance of the binauraliser.
int binauraliser_getRPYflag(void *const hBin)
Returns a flag as to whether to use "yaw-pitch-roll" (0) or "roll-pitch-yaw" (1) rotation order.
float binauraliser_getPitch(void *const hBin)
Returns the 'pitch' rotation angle, in DEGREES.
int binauraliser_getFrameSize(void)
Returns the processing framesize (i.e., number of samples processed with every _process() call )
int binauraliser_getEnableRotation(void *const hBin)
Returns the flag value which dictates whether to enable/disable sound-field rotation (0: disabled,...
void binauraliser_setRPYflag(void *const hBin, int newState)
Sets a flag as to whether to use "yaw-pitch-roll" (0) or "roll-pitch-yaw" (1) rotation order.
int binauraliser_getNumEars(void)
Returns the number of ears possessed by the average homo sapien.
void binauraliser_getProgressBarText(void *const hBin, char *text)
(Optional) Returns current intialisation/processing progress text
int binauraliser_getProcessingDelay(void)
Returns the processing delay in samples (may be used for delay compensation purposes)
int binauraliser_getDAWsamplerate(void *const hBin)
Returns the DAW/Host sample rate.
int binauraliser_getHRIRsamplerate(void *const hBin)
Returns the HRIR sample rate.
float binauraliser_getYaw(void *const hBin)
Returns the 'yaw' rotation angle, in DEGREES.
float binauraliser_getSourceElev_deg(void *const hBin, int index)
Returns the source elevation for a given index, in DEGREES.
void binauraliser_setFlipPitch(void *const hBin, int newState)
Sets a flag as to whether to "flip" the sign of the current 'pitch' angle (0: do not flip sign,...
void binauraliser_setEnableRotation(void *const hBin, int newState)
Sets the flag to enable/disable (1 or 0) rotation.
void binauraliser_setFlipYaw(void *const hBin, int newState)
Sets a flag as to whether to "flip" the sign of the current 'yaw' angle (0: do not flip sign,...
void binauraliser_setYaw(void *const hBin, float newYaw)
Sets the 'yaw' rotation angle, in DEGREES.
void binauraliser_setInputConfigPreset(void *const hBin, int newPresetID)
Loads an input preset (see SOURCE_CONFIG_PRESETS enum)
void binauraliser_setInterpMode(void *const hBin, int newMode)
NOT IMPLEMENTED YET.
void binauraliser_setUseDefaultHRIRsflag(void *const hBin, int newState)
Sets flag to dictate whether the default HRIRs in the Spatial_Audio_Framework should be used (1),...
void binauraliser_setUnSolo(void *const hBin)
Unsolo / unmute all sources.
float binauraliser_getHRIRElev_deg(void *const hBin, int index)
Returns the HRIR/HRTF elevation for a given index, in DEGREES.
float binauraliser_getSourceAzi_deg(void *const hBin, int index)
Returns the source azimuth for a given index, in DEGREES.
float binauraliser_getRoll(void *const hBin)
Returns the 'roll' rotation angle, in DEGREES.
void binauraliser_setFlipRoll(void *const hBin, int newState)
Sets a flag as to whether to "flip" the sign of the current 'roll' angle (0: do not flip sign,...
int binauraliser_getFlipYaw(void *const hBin)
Returns a flag as to whether to "flip" the sign of the current 'yaw' angle (0: do not flip sign,...
int binauraliser_getInterpMode(void *const hBin)
NOT IMPLEMENTED YET.
int binauraliser_getHRIRlength(void *const hBin)
Returns the length of HRIRs in time-domain samples.
float binauraliser_getHRIRAzi_deg(void *const hBin, int index)
Returns the HRIR/HRTF azimuth for a given index, in DEGREES.
void binauraliser_setSourceSolo(void *const hBin, int srcIdx)
Set a source to solo.
void binauraliser_setNumSources(void *const hBin, int new_nSources)
Sets the number of input channels/sources to binauralise.
int binauraliser_getNumSources(void *const hBin)
Returns the number of inputs/sources in the current layout.