SAF
Loading...
Searching...
No Matches
panner.h

A frequency-dependent 3D panner based on the Vector-base Amplitude Panning (VBAP) method, with an optional spread control.

A frequency-dependent 3D panner based on the Vector-base Amplitude Panning (VBAP) method, with an optional spread control

Files

panner.h (include), panner_internal.h, panner.c, panner_internal.c

Include Header

/*
* Copyright 2017-2018 Leo McCormack
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef __PANNER_H_INCLUDED__
#define __PANNER_H_INCLUDED__
#include "_common.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* ========================================================================== */
/* Presets + Constants */
/* ========================================================================== */
#define PANNER_SPREAD_MIN_VALUE ( 0.0f )
#define PANNER_SPREAD_MAX_VALUE ( 90.0f )
/* ========================================================================== */
/* Main Functions */
/* ========================================================================== */
void panner_create(void** const phPan);
void panner_destroy(void** const phPan);
void panner_init(void* const hPan,
int samplerate);
void panner_initCodec(void* const hPan);
void panner_process(void* const hPan,
const float *const * inputs,
float* const* outputs,
int nInputs,
int nOutputs,
int nSamples);
/* ========================================================================== */
/* Set Functions */
/* ========================================================================== */
void panner_refreshSettings(void* const hPan);
void panner_setSourceAzi_deg(void* const hPan, int index, float newAzi_deg);
void panner_setSourceElev_deg(void* const hPan, int index, float newElev_deg);
void panner_setNumSources(void* const hPan, int new_nSources);
void panner_setLoudspeakerAzi_deg(void* const hPan, int index, float newAzi_deg);
void panner_setLoudspeakerElev_deg(void* const hPan, int index, float newElev_deg);
void panner_setNumLoudspeakers(void* const hPan, int new_nLoudspeakers);
void panner_setOutputConfigPreset(void* const hPan, int newPresetID);
void panner_setInputConfigPreset(void* const hPan, int newPresetID);
void panner_setDTT(void* const hPan, float newValue);
void panner_setSpread(void* const hPan, float newValue);
void panner_setYaw(void* const hPan, float newYaw);
void panner_setPitch(void* const hPan, float newPitch);
void panner_setRoll(void* const hPan, float newRoll);
void panner_setFlipYaw(void* const hPan, int newState);
void panner_setFlipPitch(void* const hPan, int newState);
void panner_setFlipRoll(void* const hPan, int newState);
/* ========================================================================== */
/* Get Functions */
/* ========================================================================== */
float panner_getProgressBar0_1(void* const hPan);
void panner_getProgressBarText(void* const hPan, char* text);
float panner_getSourceAzi_deg(void* const hPan, int index);
float panner_getSourceElev_deg(void* const hPan, int index);
int panner_getNumSources(void* const hPan);
float panner_getLoudspeakerAzi_deg(void* const hPan, int index);
float panner_getLoudspeakerElev_deg(void* const hPan, int index);
int panner_getNumLoudspeakers(void* const hPan);
int panner_getDAWsamplerate(void* const hPan);
float panner_getDTT(void* const hPan);
float panner_getSpread(void* const hPan);
float panner_getYaw(void* const hPan);
float panner_getPitch(void* const hPan);
float panner_getRoll(void* const hPan);
int panner_getFlipYaw(void* const hPan);
int panner_getFlipPitch(void* const hPan);
int panner_getFlipRoll(void* const hPan);
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif /* __PANNER_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
void panner_setNumSources(void *const hPan, int new_nSources)
Sets the number of inputs/sources to pan.
Definition panner.c:373
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
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
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
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