SAF
Loading...
Searching...
No Matches
ambi_roomsim_internal.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
25
26#ifndef __AMBI_ROOMSIM_INTERNAL_H_INCLUDED__
27#define __AMBI_ROOMSIM_INTERNAL_H_INCLUDED__
28
29#include "ambi_roomsim.h" /* Include header for this example */
30#include "saf.h" /* Main include header for SAF */
31#include "saf_externals.h" /* To also include SAF dependencies (cblas etc.) */
32
33#ifdef __cplusplus
34extern "C" {
35#endif /* __cplusplus */
36
37/* ========================================================================== */
38/* Internal Parameters */
39/* ========================================================================== */
40
41#if !defined(AMBI_ROOMSIM_FRAME_SIZE)
42# if defined(FRAME_SIZE) /* Use the global framesize if it is specified: */
43# define AMBI_ROOMSIM_FRAME_SIZE ( FRAME_SIZE )
44# else /* Otherwise, the default framesize for this example is: */
45# define AMBI_ROOMSIM_FRAME_SIZE ( 128 )
46# endif
47#endif
48
49/* ========================================================================== */
50/* Structures */
51/* ========================================================================== */
52
57typedef struct _ambi_roomsim
58{
59 /* Internals */
62 float fs;
63
64 /* Internal */
65 void* hIms;
68 float** src_sigs;
69 float*** rec_sh_outsigs;
70 _Atomic_INT32 reinit_room;
71 _Atomic_INT32 new_sh_order;
72 _Atomic_INT32 new_nSources;
73 _Atomic_INT32 new_nReceivers;
74
75 /* user parameters */
76 _Atomic_INT32 sh_order;
77 _Atomic_INT32 enableReflections;
78 _Atomic_INT32 refl_order;
79 _Atomic_INT32 nSources;
80 _Atomic_INT32 nReceivers;
81 _Atomic_FLOAT32 room_dims[3];
82 _Atomic_FLOAT32 abs_wall[6];
83 _Atomic_FLOAT32 src_pos[ROOM_SIM_MAX_NUM_SOURCES][3];
84 _Atomic_FLOAT32 rec_pos[ROOM_SIM_MAX_NUM_RECEIVERS][3];
85 _Atomic_CH_ORDER chOrdering;
86 _Atomic_NORM_TYPES norm;
87
89
90
91/* ========================================================================== */
92/* Internal Functions */
93/* ========================================================================== */
94
95
96#ifdef __cplusplus
97} /* extern "C" { */
98#endif /* __cplusplus */
99
100#endif /* __AMBI_ROOMSIM_INTERNAL_H_INCLUDED__ */
#define MAX_NUM_INPUTS
Maximum number of input channels supported.
Definition _common.h:237
#define MAX_NUM_SH_SIGNALS
Maximum number of spherical harmonic components/signals supported.
Definition _common.h:243
A simple shoebox room Ambisonic encoder.
#define ROOM_SIM_MAX_NUM_RECEIVERS
Maximum supported number of receivers for the room sim example.
#define ROOM_SIM_MAX_NUM_SOURCES
Maximum supported number of sources for the room sim example.
#define AMBI_ROOMSIM_FRAME_SIZE
Framesize, in time-domain samples.
Main include header for the Spatial_Audio_Framework (SAF)
Include header for SAF externals.
Main structure for ambi_roomsim.
_Atomic_FLOAT32 room_dims[3]
Room dimensions along the x,y,z axes in meters.
_Atomic_INT32 new_sh_order
New receiver SH order (current value will be replaced by this after next re-init)
_Atomic_NORM_TYPES norm
Ambisonic normalisation convention (see NORM_TYPES)
void * hIms
Image source implementation handle.
int receiverIDs[ROOM_SIM_MAX_NUM_RECEIVERS]
Unique IDs per receiver in the simulation.
_Atomic_CH_ORDER chOrdering
Ambisonic channel order convention (see CH_ORDER)
float fs
Host sampling rate, in Hz.
_Atomic_INT32 enableReflections
0: disabled, 1: enabled
int sourceIDs[ROOM_SIM_MAX_NUM_SOURCES]
Unique IDs per source in the simulation.
_Atomic_FLOAT32 abs_wall[6]
Absorption coefficients per wall, in the order in which the axis intersect walls: +x -x +y -y +z -z.
_Atomic_INT32 nReceivers
Current number of receivers.
_Atomic_INT32 new_nSources
New number of sources (current value will be replaced by this after next re-init)
_Atomic_INT32 new_nReceivers
New number of receivers (current value will be replaced by this after next re-init)
_Atomic_INT32 sh_order
Current SH order of receivers.
_Atomic_INT32 reinit_room
Flag, 1: re-init required, 0: not required.
float ** src_sigs
Source signal buffers; ROOM_SIM_MAX_NUM_SOURCES x AMBI_ROOMSIM_FRAME_SIZE.
_Atomic_INT32 nSources
Current number of sources.
float *** rec_sh_outsigs
Receiver signal buffers; ROOM_SIM_MAX_NUM_RECEIVERS x MAX_NUM_SH_SIGNALS x AMBI_ROOMSIM_FRAME_SIZE.
float inputFrameTD[MAX_NUM_INPUTS][AMBI_ROOMSIM_FRAME_SIZE]
Input frame of signals.
_Atomic_INT32 refl_order
Current maximum image source reflection order.
_Atomic_FLOAT32 rec_pos[ROOM_SIM_MAX_NUM_RECEIVERS][3]
Current receiver Cartesian coordinates, meters.
float outputFrameTD[MAX_NUM_SH_SIGNALS][AMBI_ROOMSIM_FRAME_SIZE]
Output frame of SH signals.
_Atomic_FLOAT32 src_pos[ROOM_SIM_MAX_NUM_SOURCES][3]
Current source Cartesian coordinates, meters.