SAF
Loading...
Searching...
No Matches
ambi_enc.h
Go to the documentation of this file.
1/*
2 * Copyright 2016-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
25
36
37#ifndef __AMBI_ENC_H_INCLUDED__
38#define __AMBI_ENC_H_INCLUDED__
39
40#include "_common.h"
41
42#ifdef __cplusplus
43extern "C" {
44#endif /* __cplusplus */
45
46/* ========================================================================== */
47/* Presets + Constants */
48/* ========================================================================== */
49
51extern const int ambi_enc_defaultNumSources;
52
55
56
57/* ========================================================================== */
58/* Main Functions */
59/* ========================================================================== */
60
66void ambi_enc_create(void** const phAmbi);
67
73void ambi_enc_destroy(void** const phAmbi);
74
81void ambi_enc_init(void* const hAmbi,
82 int samplerate);
83
95void ambi_enc_process(void* const hAmbi,
96 const float *const * inputs,
97 float* const* outputs,
98 int nInputs,
99 int nOutputs,
100 int nSamples);
101
102
103/* ========================================================================== */
104/* Set Functions */
105/* ========================================================================== */
106
111void ambi_enc_refreshParams(void* const hAmbi);
112
116void ambi_enc_setOutputOrder(void* const hAmbi, int newValue);
117
125void ambi_enc_setSourceAzi_deg(void* const hAmbi, int index, float newAzi_deg);
126
134void ambi_enc_setSourceElev_deg(void* const hAmbi, int index, float newElev_deg);
135
137void ambi_enc_setNumSources(void* const hAmbi, int new_nSources);
138
140void ambi_enc_setInputConfigPreset(void* const hAmbi, int newPresetID);
141
146void ambi_enc_setChOrder(void* const hAmbi, int newOrder);
147
152void ambi_enc_setNormType(void* const hAmbi, int newType);
153
158void ambi_enc_setEnablePostScaling(void* const hAmbi, int newStatus);
159
160
164void ambi_enc_setSourceGain(void* const hAmbi, int srcIdx, float newGain);
165
169void ambi_enc_setSourceSolo(void* const hAmbi, int srcIdx);
170
174void ambi_enc_setUnSolo(void* const hAmbi);
175
176
177/* ========================================================================== */
178/* Get Functions */
179/* ========================================================================== */
180
185int ambi_enc_getFrameSize(void);
186
194int ambi_enc_getOutputOrder(void* const hAmbi);
195
197float ambi_enc_getSourceAzi_deg(void* const hAmbi, int index);
198
200float ambi_enc_getSourceElev_deg(void* const hAmbi, int index);
201
203int ambi_enc_getNumSources(void* const hAmbi);
204
207
212int ambi_enc_getNSHrequired(void* const hAmbi);
213
218int ambi_enc_getChOrder(void* const hAmbi);
219
224int ambi_enc_getNormType(void* const hAmbi);
225
227int ambi_enc_getEnablePostScaling(void* const hAmbi);
228
234
235
236#ifdef __cplusplus
237} /* extern "C" { */
238#endif /* __cplusplus */
239
240#endif /* __AMBI_ENC_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
const int ambi_enc_defaultNumSources
Default number of Sources.
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
const float ambi_enc_defaultSourceDirections[MAX_NUM_INPUTS][2]
Default Loudspeaker directions.
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:88
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