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
27
43
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
64extern const int binauraliser_defaultNumSources;
65
68
69
70/* ========================================================================== */
71/* Main Functions */
72/* ========================================================================== */
73
79void binauraliser_create(void** const phBin);
80
86void binauraliser_destroy(void** const phBin);
87
96void binauraliser_init(void* const hBin,
97 int samplerate);
98
114void binauraliser_initCodec(void* const hBin);
115
126void binauraliser_process(void* const hBin,
127 const float *const * inputs,
128 float* const* outputs,
129 int nInputs,
130 int nOutputs,
131 int nSamples);
132
133
134/* ========================================================================== */
135/* Set Functions */
136/* ========================================================================== */
137
142void binauraliser_refreshSettings(void* const hBin);
143
145void binauraliser_setSourceAzi_deg(void* const hBin,
146 int index,
147 float newAzi_deg);
148
150void binauraliser_setSourceElev_deg(void* const hBin,
151 int index,
152 float newElev_deg);
153
155void binauraliser_setNumSources(void* const hBin, int new_nSources);
156
165void binauraliser_setUseDefaultHRIRsflag(void* const hBin, int newState);
166
178void binauraliser_setSofaFilePath(void* const hBin, const char* path);
179
181void binauraliser_setEnableHRIRsDiffuseEQ(void* const hBin, int newState);
182
184void binauraliser_setInputConfigPreset(void* const hBin, int newPresetID);
185
187void binauraliser_setEnableRotation(void* const hBin, int newState);
188
190void binauraliser_setYaw(void* const hBin, float newYaw);
191
193void binauraliser_setPitch(void* const hBin, float newPitch);
194
196void binauraliser_setRoll(void* const hBin, float newRoll);
197
202void binauraliser_setFlipYaw(void* const hBin, int newState);
203
208void binauraliser_setFlipPitch(void* const hBin, int newState);
209
214void binauraliser_setFlipRoll(void* const hBin, int newState);
215
220void binauraliser_setRPYflag(void* const hBin, int newState);
221
223void binauraliser_setInterpMode(void* const hBin, int newMode);
224
228void binauraliser_setSourceGain(void* const hBin, int srcIdx, float newGain);
229
233void binauraliser_setSourceSolo(void* const hBin, int srcIdx);
234
238void binauraliser_setUnSolo(void* const hBin);
239
240
241/* ========================================================================== */
242/* Get Functions */
243/* ========================================================================== */
244
250
253
259float binauraliser_getProgressBar0_1(void* const hBin);
260
267void binauraliser_getProgressBarText(void* const hBin, char* text);
268
270float binauraliser_getSourceAzi_deg(void* const hBin, int index);
271
273float binauraliser_getSourceElev_deg(void* const hBin, int index);
274
276int binauraliser_getNumSources(void* const hBin);
277
280
283
285int binauraliser_getNDirs(void* const hBin);
286
291int binauraliser_getNTriangles(void* const hBin);
292
294float binauraliser_getHRIRAzi_deg(void* const hBin, int index);
295
297float binauraliser_getHRIRElev_deg(void* const hBin, int index);
298
300int binauraliser_getHRIRlength(void* const hBin);
301
303int binauraliser_getHRIRsamplerate(void* const hBin);
304
313int binauraliser_getUseDefaultHRIRsflag(void* const hBin);
314
325char* binauraliser_getSofaFilePath(void* const hBin);
326
331int binauraliser_getEnableHRIRsDiffuseEQ(void* const hBin);
332
334int binauraliser_getDAWsamplerate(void* const hBin);
335
340int binauraliser_getEnableRotation(void* const hBin);
341
343float binauraliser_getYaw(void* const hBin);
344
346float binauraliser_getPitch(void* const hBin);
347
349float binauraliser_getRoll(void* const hBin);
350
355int binauraliser_getFlipYaw(void* const hBin);
356
361int binauraliser_getFlipPitch(void* const hBin);
362
367int binauraliser_getFlipRoll(void* const hBin);
368
373int binauraliser_getRPYflag(void* const hBin);
374
376int binauraliser_getInterpMode(void* const hBin);
377
383
384
385#ifdef __cplusplus
386} /* extern "C" { */
387#endif /* __cplusplus */
388
389#endif /* __BINAURALISER_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
CODEC_STATUS
Current status of the codec.
Definition _common.h:229
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)
const float binauraliser_defaultSourceDirections[MAX_NUM_INPUTS][2]
Default source directions.
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.
const int binauraliser_defaultNumSources
Default number of Sources.
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.