SAF
Loading...
Searching...
No Matches
ambi_roomsim.h
Go to the documentation of this file.
1/*
2 * Copyright 2020 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
36#ifndef __AMBI_ROOMSIM_H_INCLUDED__
37#define __AMBI_ROOMSIM_H_INCLUDED__
38
39#include "_common.h"
40
41#ifdef __cplusplus
42extern "C" {
43#endif /* __cplusplus */
44
46#define ROOM_SIM_MAX_NUM_RECEIVERS ( 16 )
48#define ROOM_SIM_MAX_NUM_SOURCES ( 16 )
49
50/* ========================================================================== */
51/* Main Functions */
52/* ========================================================================== */
53
59void ambi_roomsim_create(void** const phAmbi);
60
66void ambi_roomsim_destroy(void** const phAmbi);
67
74void ambi_roomsim_init(void* const hAmbi,
75 int samplerate);
76
87void ambi_roomsim_process(void* const hAmbi,
88 const float *const * inputs,
89 float* const* outputs,
90 int nInputs,
91 int nOutputs,
92 int nSamples);
93
94
95/* ========================================================================== */
96/* Set Functions */
97/* ========================================================================== */
98
103void ambi_roomsim_refreshParams(void* const hAmbi);
104
106void ambi_roomsim_setEnableIMSflag(void* const hAmbi, int newValue);
107
109void ambi_roomsim_setMaxReflectionOrder(void* const hAmbi, int newValue);
110
112void ambi_roomsim_setOutputOrder(void* const hAmbi, int newValue);
113
115void ambi_roomsim_setNumSources(void* const hAmbi, int new_nSources);
116
124void ambi_roomsim_setSourceX(void* const hAmbi, int index, float newValue);
125
133void ambi_roomsim_setSourceY(void* const hAmbi, int index, float newValue);
134
142void ambi_roomsim_setSourceZ(void* const hAmbi, int index, float newValue);
143
145void ambi_roomsim_setNumReceivers(void* const hAmbi, int new_nReceievers);
146
154void ambi_roomsim_setReceiverX(void* const hAmbi, int index, float newValue);
155
163void ambi_roomsim_setReceiverY(void* const hAmbi, int index, float newValue);
164
172void ambi_roomsim_setReceiverZ(void* const hAmbi, int index, float newValue);
173
175void ambi_roomsim_setRoomDimX(void* const hAmbi, float newValue);
176
178void ambi_roomsim_setRoomDimY(void* const hAmbi, float newValue);
179
181void ambi_roomsim_setRoomDimZ(void* const hAmbi, float newValue);
182
184void ambi_roomsim_setWallAbsCoeff(void* const hAmbi, int xyz_idx, int posNeg_idx, float new_value);
185
190void ambi_roomsim_setChOrder(void* const hAmbi, int newOrder);
191
196void ambi_roomsim_setNormType(void* const hAmbi, int newType);
197
198
199/* ========================================================================== */
200/* Get Functions */
201/* ========================================================================== */
202
208
210int ambi_roomsim_getEnableIMSflag(void* const hAmbi);
211
213int ambi_roomsim_getMaxReflectionOrder(void* const hAmbi);
214
222int ambi_roomsim_getOutputOrder(void* const hAmbi);
223
225int ambi_roomsim_getNumSources(void* const hAmbi);
226
229
234int ambi_roomsim_getNSHrequired(void* const hAmbi);
235
237float ambi_roomsim_getSourceX(void* const hAmbi, int index);
238
240float ambi_roomsim_getSourceY(void* const hAmbi, int index);
241
243float ambi_roomsim_getSourceZ(void* const hAmbi, int index);
244
246int ambi_roomsim_getNumReceivers(void* const hAmbi);
247
250
252float ambi_roomsim_getReceiverX(void* const hAmbi, int index);
253
255float ambi_roomsim_getReceiverY(void* const hAmbi, int index);
256
258float ambi_roomsim_getReceiverZ(void* const hAmbi, int index);
259
261float ambi_roomsim_getRoomDimX(void* const hAmbi);
262
264float ambi_roomsim_getRoomDimY(void* const hAmbi);
265
267float ambi_roomsim_getRoomDimZ(void* const hAmbi);
268
270float ambi_roomsim_getWallAbsCoeff(void* const hAmbi,
271 int xyz_idx,
272 int posNeg_idx);
273
278int ambi_roomsim_getChOrder(void* const hAmbi);
279
284int ambi_roomsim_getNormType(void* const hAmbi);
285
291
292
293#ifdef __cplusplus
294} /* extern "C" { */
295#endif /* __cplusplus */
296
297#endif /* __AMBI_ROOMSIM_H_INCLUDED__ */
A bunch of things that are common to many of the saf examples.
void ambi_roomsim_setRoomDimY(void *const hAmbi, float newValue)
Sets the room length along the y dimension.
float ambi_roomsim_getSourceZ(void *const hAmbi, int index)
Returns the 'z' coordinate for a specific source index.
void ambi_roomsim_setReceiverZ(void *const hAmbi, int index, float newValue)
Sets the 'z' coordinate for a specific receiver index.
int ambi_roomsim_getEnableIMSflag(void *const hAmbi)
Returns whether to include image sources (1) or not (0)
int ambi_roomsim_getMaxNumReceivers(void)
Returns the maximum number of receivers.
int ambi_roomsim_getNSHrequired(void *const hAmbi)
Returns the number of spherical harmonic signals required by the current decoding order: (current_ord...
void ambi_roomsim_setNumSources(void *const hAmbi, int new_nSources)
Sets the number of input signals/sources to encode.
float ambi_roomsim_getWallAbsCoeff(void *const hAmbi, int xyz_idx, int posNeg_idx)
Returns wall absorption coefficients.
float ambi_roomsim_getReceiverZ(void *const hAmbi, int index)
Returns the 'z' coordinate for a specific receiver index.
void ambi_roomsim_setOutputOrder(void *const hAmbi, int newValue)
Sets the encoding order (see SH_ORDERS enum)
float ambi_roomsim_getRoomDimZ(void *const hAmbi)
Returns the room length along the z dimension.
void ambi_roomsim_setReceiverX(void *const hAmbi, int index, float newValue)
Sets the 'x' coordinate for a specific receiver index.
float ambi_roomsim_getRoomDimY(void *const hAmbi)
Returns the room length along the y dimension.
void ambi_roomsim_setRoomDimZ(void *const hAmbi, float newValue)
Sets the room length along the z dimension.
void ambi_roomsim_create(void **const phAmbi)
Creates an instance of ambi_roomsim.
int ambi_roomsim_getNumReceivers(void *const hAmbi)
Returns the number of SH receivers.
float ambi_roomsim_getSourceY(void *const hAmbi, int index)
Returns the 'y' coordinate for a specific source index.
void ambi_roomsim_setNormType(void *const hAmbi, int newType)
Sets the Ambisonic normalisation convention to encode with (see NORM_TYPES enum)
void ambi_roomsim_destroy(void **const phAmbi)
Destroys an instance of ambi_roomsim.
void ambi_roomsim_setSourceX(void *const hAmbi, int index, float newValue)
Sets the 'x' coordinate for a specific source index.
float ambi_roomsim_getReceiverX(void *const hAmbi, int index)
Returns the 'x' coordinate for a specific receiver index.
int ambi_roomsim_getNumSources(void *const hAmbi)
Returns the number of input signals/sources to encode.
void ambi_roomsim_setEnableIMSflag(void *const hAmbi, int newValue)
Sets whether to include image sources (1) or not (0)
void ambi_roomsim_setChOrder(void *const hAmbi, int newOrder)
Sets the Ambisonic channel ordering convention to encode with (see CH_ORDER enum)
void ambi_roomsim_process(void *const hAmbi, const float *const *inputs, float *const *outputs, int nInputs, int nOutputs, int nSamples)
Processes audio.
void ambi_roomsim_setRoomDimX(void *const hAmbi, float newValue)
Sets the room length along the x dimension.
void ambi_roomsim_setNumReceivers(void *const hAmbi, int new_nReceievers)
Sets the number of input SH receivers.
void ambi_roomsim_refreshParams(void *const hAmbi)
Sets all intialisation flags to 1; re-initialising all settings/variables as ambi_roomsim is currentl...
void ambi_roomsim_setSourceZ(void *const hAmbi, int index, float newValue)
Sets the 'z' coordinate for a specific source index.
int ambi_roomsim_getProcessingDelay(void)
Returns the processing delay in samples (may be used for delay compensation features)
int ambi_roomsim_getOutputOrder(void *const hAmbi)
Returns the decoding order (see SH_ORDERS enum)
float ambi_roomsim_getSourceX(void *const hAmbi, int index)
Returns the 'x' coordinate for a specific source index.
int ambi_roomsim_getChOrder(void *const hAmbi)
Returns the Ambisonic channel ordering convention currently being used to encode with (see CH_ORDER e...
float ambi_roomsim_getRoomDimX(void *const hAmbi)
Returns the room length along the x dimension.
void ambi_roomsim_init(void *const hAmbi, int samplerate)
Initialises an instance of ambi_roomsim with default settings.
void ambi_roomsim_setReceiverY(void *const hAmbi, int index, float newValue)
Sets the 'y' coordinate for a specific receiver index.
int ambi_roomsim_getMaxReflectionOrder(void *const hAmbi)
Returns the maximum reflection order.
void ambi_roomsim_setWallAbsCoeff(void *const hAmbi, int xyz_idx, int posNeg_idx, float new_value)
Sets wall absorption coefficients.
int ambi_roomsim_getFrameSize(void)
Returns the processing framesize (i.e., number of samples processed with every _process() call )
void ambi_roomsim_setSourceY(void *const hAmbi, int index, float newValue)
Sets the 'y' coordinate for a specific source index.
int ambi_roomsim_getMaxNumSources(void)
Returns the maximum number of input signals/sources that can be encoded.
int ambi_roomsim_getNormType(void *const hAmbi)
Returns the Ambisonic normalisation convention currently being used to encode with (see NORM_TYPES en...
void ambi_roomsim_setMaxReflectionOrder(void *const hAmbi, int newValue)
Sets the maximum reflection order.
float ambi_roomsim_getReceiverY(void *const hAmbi, int index)
Returns the 'y' coordinate for a specific receiver index.