SAF
Loading...
Searching...
No Matches
ambi_enc.c File Reference

A basic Ambisonic encoder. More...

#include "ambi_enc.h"
#include "ambi_enc_internal.h"

Go to the source code of this file.

Functions

void ambi_enc_create (void **const phAmbi)
 Creates an instance of ambi_enc.
 
void ambi_enc_destroy (void **const phAmbi)
 Destroys an instance of ambi_enc.
 
void ambi_enc_init (void *const hAmbi, int sampleRate)
 Initialises an instance of ambi_enc with default settings.
 
void ambi_enc_process (void *const hAmbi, const float *const *inputs, float *const *const outputs, int nInputs, int nOutputs, int nSamples)
 Encodes input signals into spherical harmonic signals, at the specified encoding directions.
 
int ambi_enc_getFrameSize (void)
 Returns the processing framesize (i.e., number of samples processed with every _process() call )
 
void ambi_enc_refreshParams (void *const hAmbi)
 Sets all intialisation flags to 1; re-initialising all settings/variables as ambi_enc is currently configured, at next available opportunity.
 
void ambi_enc_setOutputOrder (void *const hAmbi, int newOrder)
 Sets the encoding order (see SH_ORDERS enum)
 
void ambi_enc_setSourceAzi_deg (void *const hAmbi, int index, float newAzi_deg)
 Sets the azimuth for a specific source index.
 
void ambi_enc_setSourceElev_deg (void *const hAmbi, int index, float newElev_deg)
 Sets the elevation for a specific source index.
 
void ambi_enc_setNumSources (void *const hAmbi, int new_nSources)
 Sets the number of input signals/sources to encode.
 
void ambi_enc_setInputConfigPreset (void *const hAmbi, int newPresetID)
 Sets the input configuration preset (see SOURCE_CONFIG_PRESETS enum)
 
void ambi_enc_setChOrder (void *const hAmbi, int newOrder)
 Sets the Ambisonic channel ordering convention to encode with (see CH_ORDER enum)
 
void ambi_enc_setNormType (void *const hAmbi, int newType)
 Sets the Ambisonic normalisation convention to encode with (see NORM_TYPES enum)
 
void ambi_enc_setEnablePostScaling (void *const hAmbi, int newStatus)
 By default, ambi_enc will scale the output signals by the number of input signals.
 
void ambi_enc_setSourceGain (void *const hAmbi, int srcIdx, float newGain)
 Sets gain factor for an input source.
 
void ambi_enc_setSourceSolo (void *const hAmbi, int srcIdx)
 Set a source to solo.
 
void ambi_enc_setUnSolo (void *const hAmbi)
 Unsolo / unmute all sources.
 
int ambi_enc_getOutputOrder (void *const hAmbi)
 Returns the decoding order (see SH_ORDERS enum)
 
float ambi_enc_getSourceAzi_deg (void *const hAmbi, int index)
 Returns the azimuth for a specific source, in DEGREES.
 
float ambi_enc_getSourceElev_deg (void *const hAmbi, int index)
 Returns the elevation for a specific source, in DEGREES.
 
int ambi_enc_getNumSources (void *const hAmbi)
 Returns the number of input signals/sources to encode.
 
int ambi_enc_getMaxNumSources ()
 Returns the maximum number of input signals/sources that can be encoded.
 
int ambi_enc_getNSHrequired (void *const hAmbi)
 Returns the number of spherical harmonic signals required by the current decoding order: (current_order+1)^2.
 
int ambi_enc_getChOrder (void *const hAmbi)
 Returns the Ambisonic channel ordering convention currently being used to encode with (see CH_ORDER enum)
 
int ambi_enc_getNormType (void *const hAmbi)
 Returns the Ambisonic normalisation convention currently being used to encode with (see NORM_TYPES enum)
 
int ambi_enc_getEnablePostScaling (void *const hAmbi)
 Returns 0: if post scaling is disabled, 1: if post scaling is enabled.
 
int ambi_enc_getProcessingDelay ()
 Returns the processing delay in samples (may be used for delay compensation features)
 

Detailed Description

A basic Ambisonic encoder.

Author
Leo McCormack
Date
07.10.2016
License
ISC

Definition in file ambi_enc.c.

Function Documentation

◆ ambi_enc_create()

void ambi_enc_create ( void **const phAmbi)

Creates an instance of ambi_enc.

Parameters
[in]phAmbi(&) address of ambi_enc handle

Definition at line 29 of file ambi_enc.c.

◆ ambi_enc_destroy()

void ambi_enc_destroy ( void **const phAmbi)

Destroys an instance of ambi_enc.

Parameters
[in]phAmbi(&) address of ambi_enc handle

Definition at line 54 of file ambi_enc.c.

◆ ambi_enc_getChOrder()

int ambi_enc_getChOrder ( void *const hAmbi)

Returns the Ambisonic channel ordering convention currently being used to encode with (see CH_ORDER enum)

Definition at line 353 of file ambi_enc.c.

◆ ambi_enc_getEnablePostScaling()

int ambi_enc_getEnablePostScaling ( void *const hAmbi)

Returns 0: if post scaling is disabled, 1: if post scaling is enabled.

Definition at line 365 of file ambi_enc.c.

◆ ambi_enc_getFrameSize()

int ambi_enc_getFrameSize ( void )

Returns the processing framesize (i.e., number of samples processed with every _process() call )

Definition at line 202 of file ambi_enc.c.

◆ ambi_enc_getMaxNumSources()

int ambi_enc_getMaxNumSources ( void )

Returns the maximum number of input signals/sources that can be encoded.

Definition at line 342 of file ambi_enc.c.

◆ ambi_enc_getNormType()

int ambi_enc_getNormType ( void *const hAmbi)

Returns the Ambisonic normalisation convention currently being used to encode with (see NORM_TYPES enum)

Definition at line 359 of file ambi_enc.c.

◆ ambi_enc_getNSHrequired()

int ambi_enc_getNSHrequired ( void *const hAmbi)

Returns the number of spherical harmonic signals required by the current decoding order: (current_order+1)^2.

Definition at line 347 of file ambi_enc.c.

◆ ambi_enc_getNumSources()

int ambi_enc_getNumSources ( void *const hAmbi)

Returns the number of input signals/sources to encode.

Definition at line 336 of file ambi_enc.c.

◆ ambi_enc_getOutputOrder()

int ambi_enc_getOutputOrder ( void *const hAmbi)

Returns the decoding order (see SH_ORDERS enum)

If decoding order is higher than the input signal order, the extra required channels are filled with zeros. If the decoding order is lower than the input signal order, the number input signals is truncated accordingly.

Definition at line 318 of file ambi_enc.c.

◆ ambi_enc_getProcessingDelay()

int ambi_enc_getProcessingDelay ( void )

Returns the processing delay in samples (may be used for delay compensation features)

Definition at line 371 of file ambi_enc.c.

◆ ambi_enc_getSourceAzi_deg()

float ambi_enc_getSourceAzi_deg ( void *const hAmbi,
int index )

Returns the azimuth for a specific source, in DEGREES.

Definition at line 324 of file ambi_enc.c.

◆ ambi_enc_getSourceElev_deg()

float ambi_enc_getSourceElev_deg ( void *const hAmbi,
int index )

Returns the elevation for a specific source, in DEGREES.

Definition at line 330 of file ambi_enc.c.

◆ ambi_enc_init()

void ambi_enc_init ( void *const hAmbi,
int samplerate )

Initialises an instance of ambi_enc with default settings.

Parameters
[in]hAmbiambi_enc handle
[in]samplerateHost samplerate.

Definition at line 68 of file ambi_enc.c.

◆ ambi_enc_process()

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.

Parameters
[in]hAmbiambi_enc handle
[in]inputsInput channel buffers; 2-D array: nInputs x nSamples
[in]outputsOutput channel buffers; 2-D array: nOutputs x nSamples
[in]nInputsNumber of input channels
[in]nOutputsNumber of output channels
[in]nSamplesNumber of samples in 'inputs'/'output' matrices

Definition at line 88 of file ambi_enc.c.

◆ ambi_enc_refreshParams()

void ambi_enc_refreshParams ( void *const hAmbi)

Sets all intialisation flags to 1; re-initialising all settings/variables as ambi_enc is currently configured, at next available opportunity.

Definition at line 207 of file ambi_enc.c.

◆ ambi_enc_setChOrder()

void ambi_enc_setChOrder ( void *const hAmbi,
int newOrder )

Sets the Ambisonic channel ordering convention to encode with (see CH_ORDER enum)

Definition at line 271 of file ambi_enc.c.

◆ ambi_enc_setEnablePostScaling()

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 at line 285 of file ambi_enc.c.

◆ ambi_enc_setInputConfigPreset()

void ambi_enc_setInputConfigPreset ( void *const hAmbi,
int newPresetID )

Sets the input configuration preset (see SOURCE_CONFIG_PRESETS enum)

Definition at line 261 of file ambi_enc.c.

◆ ambi_enc_setNormType()

void ambi_enc_setNormType ( void *const hAmbi,
int newType )

Sets the Ambisonic normalisation convention to encode with (see NORM_TYPES enum)

Definition at line 278 of file ambi_enc.c.

◆ ambi_enc_setNumSources()

void ambi_enc_setNumSources ( void *const hAmbi,
int new_nSources )

Sets the number of input signals/sources to encode.

Definition at line 251 of file ambi_enc.c.

◆ ambi_enc_setOutputOrder()

void ambi_enc_setOutputOrder ( void *const hAmbi,
int newOrder )

Sets the encoding order (see SH_ORDERS enum)

Definition at line 215 of file ambi_enc.c.

◆ ambi_enc_setSourceAzi_deg()

void ambi_enc_setSourceAzi_deg ( void *const hAmbi,
int index,
float newAzi_deg )

Sets the azimuth for a specific source index.

Parameters
[in]hAmbiambi_enc handle
[in]indexSource index
[in]newAzi_degNew azimuth, in DEGREES

Definition at line 231 of file ambi_enc.c.

◆ ambi_enc_setSourceElev_deg()

void ambi_enc_setSourceElev_deg ( void *const hAmbi,
int index,
float newElev_deg )

Sets the elevation for a specific source index.

Parameters
[in]hAmbiambi_enc handle
[in]indexSource index
[in]newElev_degNew elevation, in DEGREES

Definition at line 242 of file ambi_enc.c.

◆ ambi_enc_setSourceGain()

void ambi_enc_setSourceGain ( void *const hAmbi,
int srcIdx,
float newGain )

Sets gain factor for an input source.

Definition at line 291 of file ambi_enc.c.

◆ ambi_enc_setSourceSolo()

void ambi_enc_setSourceSolo ( void *const hAmbi,
int srcIdx )

Set a source to solo.

Definition at line 297 of file ambi_enc.c.

◆ ambi_enc_setUnSolo()

void ambi_enc_setUnSolo ( void *const hAmbi)

Unsolo / unmute all sources.

Definition at line 309 of file ambi_enc.c.