SAF
Loading...
Searching...
No Matches
ambi_enc.h

A basic Ambisonic encoder.

A basic Ambisonic encoder

Files

ambi_enc.h (include), ambi_enc_internal.h, ambi_enc.c, ambi_enc_internal.c

Include Header

/*
* Copyright 2016-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 __AMBI_ENC_H_INCLUDED__
#define __AMBI_ENC_H_INCLUDED__
#include "_common.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* ========================================================================== */
/* Main Functions */
/* ========================================================================== */
void ambi_enc_create(void** const phAmbi);
void ambi_enc_destroy(void** const phAmbi);
void ambi_enc_init(void* const hAmbi,
int samplerate);
void ambi_enc_process(void* const hAmbi,
const float *const * inputs,
float* const* outputs,
int nInputs,
int nOutputs,
int nSamples);
/* ========================================================================== */
/* Set Functions */
/* ========================================================================== */
void ambi_enc_refreshParams(void* const hAmbi);
void ambi_enc_setOutputOrder(void* const hAmbi, int newValue);
void ambi_enc_setSourceAzi_deg(void* const hAmbi, int index, float newAzi_deg);
void ambi_enc_setSourceElev_deg(void* const hAmbi, int index, float newElev_deg);
void ambi_enc_setNumSources(void* const hAmbi, int new_nSources);
void ambi_enc_setInputConfigPreset(void* const hAmbi, int newPresetID);
void ambi_enc_setChOrder(void* const hAmbi, int newOrder);
void ambi_enc_setNormType(void* const hAmbi, int newType);
void ambi_enc_setEnablePostScaling(void* const hAmbi, int newStatus);
void ambi_enc_setSourceGain(void* const hAmbi, int srcIdx, float newGain);
void ambi_enc_setSourceSolo(void* const hAmbi, int srcIdx);
void ambi_enc_setUnSolo(void* const hAmbi);
/* ========================================================================== */
/* Get Functions */
/* ========================================================================== */
int ambi_enc_getOutputOrder(void* const hAmbi);
float ambi_enc_getSourceAzi_deg(void* const hAmbi, int index);
float ambi_enc_getSourceElev_deg(void* const hAmbi, int index);
int ambi_enc_getNumSources(void* const hAmbi);
int ambi_enc_getNSHrequired(void* const hAmbi);
int ambi_enc_getChOrder(void* const hAmbi);
int ambi_enc_getNormType(void* const hAmbi);
int ambi_enc_getEnablePostScaling(void* const hAmbi);
#ifdef __cplusplus
} /* extern "C" { */
#endif /* __cplusplus */
#endif /* __AMBI_ENC_H_INCLUDED__ */
A bunch of things that are common to many of the saf examples.
void ambi_enc_setEnablePostScaling(void *const hAmbi, int newStatus)
By default, ambi_enc will scale the output signals by the number of input signals.
Definition ambi_enc.c:285
int ambi_enc_getFrameSize(void)
Returns the processing framesize (i.e., number of samples processed with every _process() call )
Definition ambi_enc.c:202
void ambi_enc_setOutputOrder(void *const hAmbi, int newValue)
Sets the encoding order (see SH_ORDERS enum)
Definition ambi_enc.c:215
int ambi_enc_getProcessingDelay(void)
Returns the processing delay in samples (may be used for delay compensation features)
Definition ambi_enc.c:371
void ambi_enc_refreshParams(void *const hAmbi)
Sets all intialisation flags to 1; re-initialising all settings/variables as ambi_enc is currently co...
Definition ambi_enc.c:207
int ambi_enc_getEnablePostScaling(void *const hAmbi)
Returns 0: if post scaling is disabled, 1: if post scaling is enabled.
Definition ambi_enc.c:365
int ambi_enc_getMaxNumSources(void)
Returns the maximum number of input signals/sources that can be encoded.
Definition ambi_enc.c:342
void ambi_enc_setSourceGain(void *const hAmbi, int srcIdx, float newGain)
Sets gain factor for an input source.
Definition ambi_enc.c:291
void ambi_enc_setSourceElev_deg(void *const hAmbi, int index, float newElev_deg)
Sets the elevation for a specific source index.
Definition ambi_enc.c:242
void ambi_enc_setNormType(void *const hAmbi, int newType)
Sets the Ambisonic normalisation convention to encode with (see NORM_TYPES enum)
Definition ambi_enc.c:278
void ambi_enc_setSourceSolo(void *const hAmbi, int srcIdx)
Set a source to solo.
Definition ambi_enc.c:297
void ambi_enc_init(void *const hAmbi, int samplerate)
Initialises an instance of ambi_enc with default settings.
Definition ambi_enc.c:69
int ambi_enc_getChOrder(void *const hAmbi)
Returns the Ambisonic channel ordering convention currently being used to encode with (see CH_ORDER e...
Definition ambi_enc.c:353
void ambi_enc_setUnSolo(void *const hAmbi)
Unsolo / unmute all sources.
Definition ambi_enc.c:309
void ambi_enc_setNumSources(void *const hAmbi, int new_nSources)
Sets the number of input signals/sources to encode.
Definition ambi_enc.c:251
void ambi_enc_setInputConfigPreset(void *const hAmbi, int newPresetID)
Sets the input configuration preset (see SOURCE_CONFIG_PRESETS enum)
Definition ambi_enc.c:261
void ambi_enc_setSourceAzi_deg(void *const hAmbi, int index, float newAzi_deg)
Sets the azimuth for a specific source index.
Definition ambi_enc.c:231
int ambi_enc_getNormType(void *const hAmbi)
Returns the Ambisonic normalisation convention currently being used to encode with (see NORM_TYPES en...
Definition ambi_enc.c:359
void ambi_enc_destroy(void **const phAmbi)
Destroys an instance of ambi_enc.
Definition ambi_enc.c:55
void ambi_enc_process(void *const hAmbi, const float *const *inputs, float *const *outputs, int nInputs, int nOutputs, int nSamples)
Encodes input signals into spherical harmonic signals, at the specified encoding directions.
Definition ambi_enc.c:89
void ambi_enc_create(void **const phAmbi)
Creates an instance of ambi_enc.
Definition ambi_enc.c:30
int ambi_enc_getNSHrequired(void *const hAmbi)
Returns the number of spherical harmonic signals required by the current decoding order: (current_ord...
Definition ambi_enc.c:347
float ambi_enc_getSourceElev_deg(void *const hAmbi, int index)
Returns the elevation for a specific source, in DEGREES.
Definition ambi_enc.c:330
float ambi_enc_getSourceAzi_deg(void *const hAmbi, int index)
Returns the azimuth for a specific source, in DEGREES.
Definition ambi_enc.c:324
void ambi_enc_setChOrder(void *const hAmbi, int newOrder)
Sets the Ambisonic channel ordering convention to encode with (see CH_ORDER enum)
Definition ambi_enc.c:271
int ambi_enc_getNumSources(void *const hAmbi)
Returns the number of input signals/sources to encode.
Definition ambi_enc.c:336
int ambi_enc_getOutputOrder(void *const hAmbi)
Returns the decoding order (see SH_ORDERS enum)
Definition ambi_enc.c:318