SAF
Loading...
Searching...
No Matches
panner.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
26
53
54#ifndef __PANNER_H_INCLUDED__
55#define __PANNER_H_INCLUDED__
56
57#include "_common.h"
58
59#ifdef __cplusplus
60extern "C" {
61#endif /* __cplusplus */
62
63/* ========================================================================== */
64/* Presets + Constants */
65/* ========================================================================== */
66
68#define PANNER_SPREAD_MIN_VALUE ( 0.0f )
69
71#define PANNER_SPREAD_MAX_VALUE ( 90.0f )
72
74extern const int panner_defaultNumSources;
75
78
80extern const int panner_defaultNumLoudspeakers;
81
84
85
86/* ========================================================================== */
87/* Main Functions */
88/* ========================================================================== */
89
95void panner_create(void** const phPan);
96
102void panner_destroy(void** const phPan);
103
112void panner_init(void* const hPan,
113 int samplerate);
114
130void panner_initCodec(void* const hPan);
131
156void panner_process(void* const hPan,
157 const float *const * inputs,
158 float* const* outputs,
159 int nInputs,
160 int nOutputs,
161 int nSamples);
162
163
164/* ========================================================================== */
165/* Set Functions */
166/* ========================================================================== */
167
172void panner_refreshSettings(void* const hPan);
173
175void panner_setSourceAzi_deg(void* const hPan, int index, float newAzi_deg);
176
178void panner_setSourceElev_deg(void* const hPan, int index, float newElev_deg);
179
181void panner_setNumSources(void* const hPan, int new_nSources);
182
184void panner_setLoudspeakerAzi_deg(void* const hPan, int index, float newAzi_deg);
185
187void panner_setLoudspeakerElev_deg(void* const hPan, int index, float newElev_deg);
188
190void panner_setNumLoudspeakers(void* const hPan, int new_nLoudspeakers);
191
196void panner_setOutputConfigPreset(void* const hPan, int newPresetID);
197
201void panner_setInputConfigPreset(void* const hPan, int newPresetID);
202
212void panner_setDTT(void* const hPan, float newValue);
213
215void panner_setSpread(void* const hPan, float newValue);
216
218void panner_setYaw(void* const hPan, float newYaw);
219
221void panner_setPitch(void* const hPan, float newPitch);
222
224void panner_setRoll(void* const hPan, float newRoll);
225
230void panner_setFlipYaw(void* const hPan, int newState);
231
236void panner_setFlipPitch(void* const hPan, int newState);
237
242void panner_setFlipRoll(void* const hPan, int newState);
243
244
245/* ========================================================================== */
246/* Get Functions */
247/* ========================================================================== */
248
253int panner_getFrameSize(void);
254
256CODEC_STATUS panner_getCodecStatus(void* const hPan);
257
263float panner_getProgressBar0_1(void* const hPan);
264
271void panner_getProgressBarText(void* const hPan, char* text);
272
274float panner_getSourceAzi_deg(void* const hPan, int index);
275
277float panner_getSourceElev_deg(void* const hPan, int index);
278
280int panner_getNumSources(void* const hPan);
281
284
286float panner_getLoudspeakerAzi_deg(void* const hPan, int index);
287
289float panner_getLoudspeakerElev_deg(void* const hPan, int index);
290
292int panner_getNumLoudspeakers(void* const hPan);
293
296
298int panner_getDAWsamplerate(void* const hPan);
299
301float panner_getDTT(void* const hPan);
302
304float panner_getSpread(void* const hPan);
305
307float panner_getYaw(void* const hPan);
308
310float panner_getPitch(void* const hPan);
311
313float panner_getRoll(void* const hPan);
314
319int panner_getFlipYaw(void* const hPan);
320
325int panner_getFlipPitch(void* const hPan);
326
331int panner_getFlipRoll(void* const hPan);
332
338
339
340#ifdef __cplusplus
341} /* extern "C" */
342#endif /* __cplusplus */
343
344#endif /* __PANNER_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
#define MAX_NUM_OUTPUTS
Maximum number of output channels supported.
Definition _common.h:264
CODEC_STATUS
Current status of the codec.
Definition _common.h:229
void panner_setNumSources(void *const hPan, int new_nSources)
Sets the number of inputs/sources to pan.
Definition panner.c:373
const float panner_defaultSourceDirections[MAX_NUM_INPUTS][2]
Default Loudspeaker directions.
void panner_setLoudspeakerElev_deg(void *const hPan, int index, float newElev_deg)
Sets the elevation of a specific loudspeaker index, in DEGREES.
Definition panner.c:406
float panner_getSourceAzi_deg(void *const hPan, int index)
Returns the input/source azimuth for a given index, in DEGREES.
Definition panner.c:563
int panner_getMaxNumSources(void)
Returns the maximum number of inputs/sources permitted by panner.
Definition panner.c:581
int panner_getNumLoudspeakers(void *const hPan)
Returns the number of loudspeakers in the current layout.
Definition panner.c:598
const int panner_defaultNumLoudspeakers
Default number of Loudspeakers.
void panner_setFlipRoll(void *const hPan, int newState)
Sets a flag as to whether to "flip" the sign of the current 'roll' angle (0: do not flip sign,...
Definition panner.c:528
float panner_getLoudspeakerAzi_deg(void *const hPan, int index)
Returns the loudspeaker azimuth for a given index, in DEGREES.
Definition panner.c:586
float panner_getProgressBar0_1(void *const hPan)
(Optional) Returns current intialisation/processing progress, between 0..1
Definition panner.c:551
int panner_getDAWsamplerate(void *const hPan)
Returns the DAW/Host sample rate.
Definition panner.c:609
void panner_create(void **const phPan)
Creates an instance of the panner.
Definition panner.c:47
float panner_getDTT(void *const hPan)
Returns the room coefficient value 0..1.
Definition panner.c:615
void panner_setSpread(void *const hPan, float newValue)
Sets the degree of spread, in DEGREES.
Definition panner.c:475
const float panner_defaultLoudspeakerDirections[MAX_NUM_OUTPUTS][2]
Default Loudspeaker directions.
float panner_getYaw(void *const hPan)
Returns the 'yaw' rotation angle, in DEGREES.
Definition panner.c:627
void panner_setSourceAzi_deg(void *const hPan, int index, float newAzi_deg)
Sets the azimuth of a specific input/source index, in DEGREES.
Definition panner.c:347
void panner_process(void *const hPan, const float *const *inputs, float *const *outputs, int nInputs, int nOutputs, int nSamples)
Pans the input signals/sources to the loudspeaker channels using VBAP [1], and optional spreading [2]...
Definition panner.c:176
const int panner_defaultNumSources
Default number of Sources.
void panner_setFlipYaw(void *const hPan, int newState)
Sets a flag as to whether to "flip" the sign of the current 'yaw' angle (0: do not flip sign,...
Definition panner.c:510
void panner_setLoudspeakerAzi_deg(void *const hPan, int index, float newAzi_deg)
Sets the azimuth of a specific loudspeaker index, in DEGREES.
Definition panner.c:388
int panner_getFlipYaw(void *const hPan)
Returns a flag as to whether to "flip" the sign of the current 'yaw' angle (0: do not flip sign,...
Definition panner.c:645
float panner_getRoll(void *const hPan)
Returns the 'roll' rotation angle, in DEGREES.
Definition panner.c:639
void panner_init(void *const hPan, int samplerate)
Initialises an instance of panner with default settings.
Definition panner.c:121
void panner_setOutputConfigPreset(void *const hPan, int newPresetID)
Sets a preset for the output configuration (see LOUDSPEAKER_ARRAY_PRESETS enum)
Definition panner.c:438
void panner_setRoll(void *const hPan, float newRoll)
Sets the 'roll' rotation angle, in DEGREES.
Definition panner.c:503
int panner_getFlipRoll(void *const hPan)
Returns a flag as to whether to "flip" the sign of the current 'roll' angle (0: do not flip sign,...
Definition panner.c:657
float panner_getLoudspeakerElev_deg(void *const hPan, int index)
Returns the loudspeaker elevation for a given index, in DEGREES.
Definition panner.c:592
int panner_getFrameSize(void)
Returns the processing framesize (i.e., number of samples processed with every _process() call )
Definition panner.c:540
void panner_setDTT(void *const hPan, float newValue)
Sets the room coefficient value 0..1 [1]; 0: normal room, 0.5: dry listening room,...
Definition panner.c:461
void panner_destroy(void **const phPan)
Destroys an instance of the panner.
Definition panner.c:91
float panner_getPitch(void *const hPan)
Returns the 'pitch' rotation angle, in DEGREES.
Definition panner.c:633
void panner_setInputConfigPreset(void *const hPan, int newPresetID)
Sets a preset for the input configuration (see SOURCE_CONFIG_PRESETS enum)
Definition panner.c:450
CODEC_STATUS panner_getCodecStatus(void *const hPan)
Returns current codec status (see CODEC_STATUS enum)
Definition panner.c:545
int panner_getProcessingDelay(void)
Returns the processing delay in samples (may be used for delay compensation features)
Definition panner.c:663
void panner_getProgressBarText(void *const hPan, char *text)
(Optional) Returns current intialisation/processing progress text
Definition panner.c:557
int panner_getFlipPitch(void *const hPan)
Returns a flag as to whether to "flip" the sign of the current 'pitch' angle (0: do not flip sign,...
Definition panner.c:651
int panner_getMaxNumLoudspeakers(void)
Returns the maximum number of loudspeakers permitted.
Definition panner.c:604
void panner_setPitch(void *const hPan, float newPitch)
Sets the 'pitch' rotation angle, in DEGREES.
Definition panner.c:496
float panner_getSourceElev_deg(void *const hPan, int index)
Returns the input/source elevation for a given index, in DEGREES.
Definition panner.c:569
void panner_initCodec(void *const hPan)
Intialises the codec variables, based on current global/user parameters.
Definition panner.c:140
void panner_setSourceElev_deg(void *const hPan, int index, float newElev_deg)
Sets the elevation of a specific input/source index, in DEGREES.
Definition panner.c:361
void panner_refreshSettings(void *const hPan)
Sets all intialisation flags to 1; re-initialising all settings/variables as panner is currently conf...
Definition panner.c:337
float panner_getSpread(void *const hPan)
Returns the spread value, in DEGREES.
Definition panner.c:621
void panner_setNumLoudspeakers(void *const hPan, int new_nLoudspeakers)
Sets the number of loudspeakers to pan to.
Definition panner.c:422
int panner_getNumSources(void *const hPan)
Returns the number of inputs/sources in the current layout.
Definition panner.c:575
void panner_setYaw(void *const hPan, float newYaw)
Sets the 'yaw' rotation angle, in DEGREES.
Definition panner.c:489
void panner_setFlipPitch(void *const hPan, int newState)
Sets a flag as to whether to "flip" the sign of the current 'pitch' angle (0: do not flip sign,...
Definition panner.c:519