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
29
30#ifndef __SAF_REVERB_H_INCLUDED__
31#define __SAF_REVERB_H_INCLUDED__
32
33#ifdef __cplusplus
34extern "C" {
35#endif /* __cplusplus */
36
38
39/* ========================================================================== */
40/* IMS Shoebox Room Simulator */
41/* ========================================================================== */
42/*
43 * Note that this simulator is based on the shoebox-roomsim MATLAB library
44 * found here: https://github.com/polarch/shoebox-roomsim
45 * (Copyright (c) 2017, Archontis Politis, BSD-3-Clause License)
46 */
47
52
54#define IMS_MAX_NUM_SOURCES 128
55
57#define IMS_MAX_NUM_RECEIVERS 16
58
60typedef struct _ims_rir{
61 float* data;
62 int length, nChannels;
63} ims_rir;
64
107void ims_shoebox_create(void** phIms,
108 float roomDimensions[3],
109 float* abs_wall,
110 float lowestOctaveBand,
111 int nOctBands,
112 float c_ms,
113 float fs);
114
120void ims_shoebox_destroy(void** phIms);
121
138void ims_shoebox_computeEchograms(void* hIms,
139 int maxN,
140 float maxTime_s);
141
148void ims_shoebox_renderRIRs(void* hIms,
149 int fractionalDelaysFLAG);
150
167void ims_shoebox_applyEchogramTD(/* Input Arguments */
168 void* hIms,
169 long receiverID,
170 int nSamples,
171 int fractionalDelaysFLAG);
172
173
174/* =========================== Set/Get functions ============================ */
175
177void ims_shoebox_setRoomDimensions(void* hIms,
178 _Atomic_FLOAT32 new_roomDimensions[3]);
179
181void ims_shoebox_setWallAbsCoeffs(void* hIms,
182 _Atomic_FLOAT32* abs_wall);
183
184
185/* ================== Add/Remove/Update Objects functions ==================== */
186
204int ims_shoebox_addSource(void* hIms,
205 float position_xyz[3],
206 float** pSrc_sig);
207
226int ims_shoebox_addReceiverSH(void* hIms,
227 int sh_order,
228 float position_xyz[3],
229 float*** pSH_sigs);
230
232void ims_shoebox_updateSource(void* hIms,
233 int sourceID,
234 _Atomic_FLOAT32 position_xyz[3]);
235
237void ims_shoebox_updateReceiver(void* hIms,
238 int receiverID,
239 _Atomic_FLOAT32 position_xyz[3]);
240
246void ims_shoebox_removeSource(void* hIms,
247 int sourceID);
248
254void ims_shoebox_removeReceiver(void* hIms,
255 int receiverID);
256
257
258#ifdef __cplusplus
259} /* extern "C" */
260#endif /* __cplusplus */
261
262#endif /* __SAF_REVERB_H_INCLUDED__ */
263 /* doxygen addtogroup Reverb */
void ims_shoebox_removeSource(void *hIms, int sourceID)
Removes a specific source from the simulation.
Definition saf_reverb.c:793
void ims_shoebox_updateReceiver(void *hIms, int receiverID, _Atomic_FLOAT32 position_xyz[3])
Updates the position of a specific receiver in the simulation.
Definition saf_reverb.c:749
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_setWallAbsCoeffs(void *hIms, _Atomic_FLOAT32 *abs_wall)
Sets new wall absorption coefficients per wall and per band.
Definition saf_reverb.c:568
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_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_updateSource(void *hIms, int sourceID, _Atomic_FLOAT32 position_xyz[3])
Updates the position of a specific source in the simulation.
Definition saf_reverb.c:705
void ims_shoebox_setRoomDimensions(void *hIms, _Atomic_FLOAT32 new_roomDimensions[3])
Sets new room dimensions.
Definition saf_reverb.c:542
Main header for the utilities module (SAF_UTILITIES_MODULE)
Output format of the rendered room impulse responses (RIR)
Definition saf_reverb.h:60