SAF
Loading...
Searching...
No Matches
saf_reverb.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
30#ifndef __SAF_REVERB_H_INCLUDED__
31#define __SAF_REVERB_H_INCLUDED__
32
33#ifdef __cplusplus
34extern "C" {
35#endif /* __cplusplus */
36
37/* ========================================================================== */
38/* IMS Shoebox Room Simulator */
39/* ========================================================================== */
40/*
41 * Note that this simulator is based on the shoebox-roomsim MATLAB library
42 * found here: https://github.com/polarch/shoebox-roomsim
43 * (Copyright (c) 2017, Archontis Politis, BSD-3-Clause License)
44 */
45
52#define IMS_MAX_NUM_SOURCES 128
53
55#define IMS_MAX_NUM_RECEIVERS 16
56
58typedef struct _ims_rir{
59 float* data;
60 int length, nChannels;
61} ims_rir;
62
105void ims_shoebox_create(void** phIms,
106 float roomDimensions[3],
107 float* abs_wall,
108 float lowestOctaveBand,
109 int nOctBands,
110 float c_ms,
111 float fs);
112
118void ims_shoebox_destroy(void** phIms);
119
136void ims_shoebox_computeEchograms(void* hIms,
137 int maxN,
138 float maxTime_s);
139
146void ims_shoebox_renderRIRs(void* hIms,
147 int fractionalDelaysFLAG);
148
165void ims_shoebox_applyEchogramTD(/* Input Arguments */
166 void* hIms,
167 long receiverID,
168 int nSamples,
169 int fractionalDelaysFLAG);
170
171
172/* =========================== Set/Get functions ============================ */
173
175void ims_shoebox_setRoomDimensions(void* hIms,
176 float new_roomDimensions[3]);
177
179void ims_shoebox_setWallAbsCoeffs(void* hIms,
180 float* abs_wall);
181
182
183/* ================== Add/Remove/Update Objects functions ==================== */
184
202int ims_shoebox_addSource(void* hIms,
203 float position_xyz[3],
204 float** pSrc_sig);
205
224int ims_shoebox_addReceiverSH(void* hIms,
225 int sh_order,
226 float position_xyz[3],
227 float*** pSH_sigs);
228
230void ims_shoebox_updateSource(void* hIms,
231 int sourceID,
232 float position_xyz[3]);
233
235void ims_shoebox_updateReceiver(void* hIms,
236 int receiverID,
237 float position_xyz[3]);
238
244void ims_shoebox_removeSource(void* hIms,
245 int sourceID);
246
252void ims_shoebox_removeReceiver(void* hIms,
253 int receiverID);
254
255
256#ifdef __cplusplus
257} /* extern "C" */
258#endif /* __cplusplus */
259
260#endif /* __SAF_REVERB_H_INCLUDED__ */
261
262 /* doxygen addtogroup Reverb */
void ims_shoebox_setRoomDimensions(void *hIms, float new_roomDimensions[3])
Sets new room dimensions.
Definition saf_reverb.c:542
void ims_shoebox_removeSource(void *hIms, int sourceID)
Removes a specific source from the simulation.
Definition saf_reverb.c:793
int ims_shoebox_addReceiverSH(void *hIms, int sh_order, float position_xyz[3], float ***pSH_sigs)
Adds a spherical harmonic (SH) receiver object to the simulator of a given order, and returns a uniqu...
Definition saf_reverb.c:650
int ims_shoebox_addSource(void *hIms, float position_xyz[3], float **pSrc_sig)
Adds a source object to the simulator, and returns a unique ID corresponding to it.
Definition saf_reverb.c:599
void ims_shoebox_applyEchogramTD(void *hIms, long receiverID, int nSamples, int fractionalDelaysFLAG)
Applies the currently computed echograms in the time-domain, for all sources, for one specified recei...
Definition saf_reverb.c:298
void ims_shoebox_updateSource(void *hIms, int sourceID, float position_xyz[3])
Updates the position of a specific source in the simulation.
Definition saf_reverb.c:705
void ims_shoebox_computeEchograms(void *hIms, int maxN, float maxTime_s)
Computes echograms for all active source/receiver combinations.
Definition saf_reverb.c:185
void ims_shoebox_updateReceiver(void *hIms, int receiverID, float position_xyz[3])
Updates the position of a specific receiver in the simulation.
Definition saf_reverb.c:749
void ims_shoebox_destroy(void **phIms)
Destroys an instance of ims_shoebox room simulator.
Definition saf_reverb.c:141
void ims_shoebox_renderRIRs(void *hIms, int fractionalDelaysFLAG)
Renders room impulse responses for all active source/receiver combinations.
Definition saf_reverb.c:260
void ims_shoebox_removeReceiver(void *hIms, int receiverID)
Removes a specific receiver from the simulation.
Definition saf_reverb.c:826
void ims_shoebox_create(void **phIms, float roomDimensions[3], float *abs_wall, float lowestOctaveBand, int nOctBands, float c_ms, float fs)
Creates an instance of ims_shoebox room simulator.
Definition saf_reverb.c:37
void ims_shoebox_setWallAbsCoeffs(void *hIms, float *abs_wall)
Sets new wall absorption coefficients per wall and per band.
Definition saf_reverb.c:568
Output format of the rendered room impulse responses (RIR)
Definition saf_reverb.h:58