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
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/* Main Functions */
48/* ========================================================================== */
49
55void ambi_enc_create(void** const phAmbi);
56
62void ambi_enc_destroy(void** const phAmbi);
63
70void ambi_enc_init(void* const hAmbi,
71 int samplerate);
72
84void ambi_enc_process(void* const hAmbi,
85 const float *const * inputs,
86 float* const* outputs,
87 int nInputs,
88 int nOutputs,
89 int nSamples);
90
91
92/* ========================================================================== */
93/* Set Functions */
94/* ========================================================================== */
95
100void ambi_enc_refreshParams(void* const hAmbi);
101
105void ambi_enc_setOutputOrder(void* const hAmbi, int newValue);
106
114void ambi_enc_setSourceAzi_deg(void* const hAmbi, int index, float newAzi_deg);
115
123void ambi_enc_setSourceElev_deg(void* const hAmbi, int index, float newElev_deg);
124
126void ambi_enc_setNumSources(void* const hAmbi, int new_nSources);
127
129void ambi_enc_setInputConfigPreset(void* const hAmbi, int newPresetID);
130
135void ambi_enc_setChOrder(void* const hAmbi, int newOrder);
136
141void ambi_enc_setNormType(void* const hAmbi, int newType);
142
147void ambi_enc_setEnablePostScaling(void* const hAmbi, int newStatus);
148
149
153void ambi_enc_setSourceGain(void* const hAmbi, int srcIdx, float newGain);
154
158void ambi_enc_setSourceSolo(void* const hAmbi, int srcIdx);
159
163void ambi_enc_setUnSolo(void* const hAmbi);
164
165
166/* ========================================================================== */
167/* Get Functions */
168/* ========================================================================== */
169
174int ambi_enc_getFrameSize(void);
175
183int ambi_enc_getOutputOrder(void* const hAmbi);
184
186float ambi_enc_getSourceAzi_deg(void* const hAmbi, int index);
187
189float ambi_enc_getSourceElev_deg(void* const hAmbi, int index);
190
192int ambi_enc_getNumSources(void* const hAmbi);
193
196
201int ambi_enc_getNSHrequired(void* const hAmbi);
202
207int ambi_enc_getChOrder(void* const hAmbi);
208
213int ambi_enc_getNormType(void* const hAmbi);
214
216int ambi_enc_getEnablePostScaling(void* const hAmbi);
217
223
224
225#ifdef __cplusplus
226} /* extern "C" { */
227#endif /* __cplusplus */
228
229#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