Codebase documentation

Table of Contents

struct AZEL

Public Members

double az
double el
struct BRIR

Public Members

double fs
int nChannels
int nSamples
double *sample
struct CFileSetup

Public Members

CFileSetupItem root
unsigned long buflen
char *buf
struct CFileSetupItem

Public Types

enum [anonymous]

Values:

enumerator SI_FIELD
enumerator SI_STRUCT

Public Members

enum CFileSetupItem::[anonymous] type
char *name
char *value
struct CFileSetupItem *field
union CFileSetupItem::[anonymous] data
struct CFileSetupItem *next
struct CFileSetupItem *prev
struct CFileSetupItem *parent
struct CMinPhaseFIRplan

Plan for creating minimum phase FIR filters.

Public Members

unsigned int nFFT

Full FFT size.

unsigned int nFFThalf

Half FFT size.

unsigned int *idx0

Freq. interpolation: left index.

unsigned int *idx1

Freq. interpolation: right index.

double *weight0

Freq. interpolation: left weight.

double *weight1

Freq. interpolation: right weight.

fftw_plan fftwplanr2hc

Real to half-complex forward FFTW plan.

fftw_plan fftwplanhc2r

Half-complex to real inverse FFTW plan.

double *fftwbufhc

FFTW buffer for half-complex FFT output.

double *fftwbufr

FFTW buffer for real FFT output.

double *lifterzerostart

Pointer to lifter’s first 0.

unsigned int lifterzerosize

Number of 0’s in lifter.

unsigned int liftermul2end

Index of last 2 in lifter.

unsigned int complexexpend

Index.

unsigned int realexpnyquist

Index.

struct CRoomCallbackArg

Public Members

int order
int rx
int ry
int rz
int surfacecount[6]
const CRoomSetup *pSetup
CRoomsimInternal *pSimulation
struct CRoomsimInternal

Internal simulation data structure.

Public Members

double fs
double duration
int length
double diffusetimestep
double c

speed of sound (m/s)

double csample

speed of sound (m/sample)

int nBands

Number of frequency bands in simulation.

double *frequency

Center frequencies of simulation frequency bands.

double *logairattenuation

Frequency dependent air attenuation coefficients.

double *logreflection

Frequency dependent surface reflection coefficients.

double *logabsorption

Frequency dependent surface absorption coefficients.

double *logdiffusion

Frequency dependent surface diffusion coefficients.

double *logdiffusereflection
double *logspecularreflection
double *diffusioncoefficient
double *surfaceattenuation

Attenuation of surfaces on virtual-to-real room.

double *attenuation

Total attenuation of image source to receiver path.

double *h

Buffer for impulse responses.

double *convbuf

Convolution buffer.

double *htv
int *htvidx
unsigned int *noise
double *shapednoise
double *directionalshapednoise
CMinPhaseFIRplan *minphaseplan

Design plan for minimum phase FIR filter from attenuation.

int nSources
CSensorInternal *source
int nReceivers
CSensorInternal *receiver
BRIR *brir
struct CSensorDefinition

Public Types

enum [anonymous]

Values:

enumerator ST_LOGGAIN
enumerator ST_LOGWEIGHTS
enumerator ST_IMPULSERESPONSE

Public Members

enum CSensorDefinition::[anonymous] type
CSensorProbeFunction probe
double fs
int nChannels
int nEntries
int nSamples
int nBands
double *frequency
double *responsedata
void *sensordata
int nSimulationBands
double *simulationfrequency
double *simulationlogweights
struct MYSOFA_EASY *sofahandle
float *responsedatafloat
float *delays
bool interpolation
bool normalization
bool resampling
struct CSensorDefinitionListItem

Public Members

CSensorDefinitionListItem *next
CSensorDefinitionListItem *prev
char sensorid[32]
char subid[256]
CSensorDefinition definition
struct CSensorInternal

Internal data structure holding data for a sensor.

Public Members

const YPRT r2s_yprt

Room-to-sensor coordinate transformation matrix.

const YPRT s2r_yprt

Sensor-to-room coordinate transformation matrix.

CSensorDefinition *definition

Sensor definition

double *TFShist
double *FirstTOA
int nTbin
int nFbin
int nSbin
struct CSensorListItem

Public Members

char *name
CSensorInitFunction init
union CSensorProbeFunction
struct CSensorResponse

Public Types

enum [anonymous]

Values:

enumerator SR_LOGGAIN
enumerator SR_LOGWEIGHTS
enumerator SR_IMPULSERESPONSE

Public Members

enum CSensorResponse::[anonymous] type
double loggain
double *logweights
double *impulseresponse
union CSensorResponse::[anonymous] data
struct CUnittest

Public Members

char *name
void (*run)(void)
struct XYZ

Public Members

double x
double y
double z
struct YPR

Public Members

double yaw
double pitch
double roll
file build.c

Variables

char *builddate = __DATE__
char *buildtime = __TIME__
file build.h

Defines

SOFAMYROOM_NAME
SOFAMYROOM_VERSION

Variables

char *builddate
char *buildtime
file libroomsim.h
#include “types.h”#include “interface.h”

Room simulation function prototypes.

Functions

void ValidateSetup(const CRoomSetup *pSetup)
BRIR *Roomsim(const CRoomSetup *pSetup)
void ReleaseBRIR(BRIR *brir)
void ClearAllSensors(void)
file 3D.h
#include “types.h”

Three-dimensional transformation function prototypes.

Functions

void ComputeSensor2RoomYPRT(const YPR *ypr, YPRT *yprt)

Compute sensor-to-room coordinate transformation matrix.

Parameters
  • [in] ypr: Sensor orientation (yaw, pitch, roll) in degrees.

  • [inout] yprT: Sensor-to-room coordinate transformation matrix.

void ComputeRoom2SensorYPRT(const YPR *ypr, YPRT *yprt)

Compute room-to-sensor coordinate transformation matrix.

Parameters
  • [in] ypr: Sensor orientation (yaw, pitch, roll) in degrees.

  • [inout] yprT: Room-to-sensor coordinate transformation matrix.

void YawPitchRoll(const XYZ *xyz, const YPRT *yprt, XYZ *xyzhat)

Apply yaw-pitch-roll coordinate transformation.

void YawPitchRoll_InPlace(XYZ *xyz, const YPRT *yprt)

Apply yaw-pitch-roll coordinate transformation (in place).

void azel_vp(const XYZ *xyz, AZEL *vp)

Convert (x,y,z) coordinates to vertical polar azimuth/elevation coordinates.

Parameters
  • [in] xyz: pointer to XYZ structure containing (x,y,z) coordinates.

  • [inout] vp: pointer to AZEL structure for vertical polar azimuth/elevation.

file defs.h

Project-wide preprocessor defines.

Defines

EPS0

Reasonably small double >0.

PI

Mathematical constant, \pi.

TWOPI

Mathematical constant, 2\pi.

ANY_FS

Value signaling that a sensor can be used at any sampling frequency.

EMPTY_GAIN

Gain sensor return value signaling that the response at the specified XYZ is not defined.

LOGFN
LOGINFO(s)
LOG(s)
LOGDEBUG(s)
MAX(x, y)
MIN(x, y)
ROUND(x)
DEG2RAD(degree)
LOGMINIMUM
LOGEPS
LOGDOMAIN(x)
LOGDOMAINSAFE(x)
LINDOMAIN(x)
CHECKPOINT(TXT)
LOG2(x)
UNREFERENCED_PARAMETER(P)
stricmp
strnicmp
file dsp.h

Digital Signal Processing routines.

Typedefs

typedef struct CMinPhaseFIRplan CMinPhaseFIRplan

Opague type for minimum-phase FIR conversion routine.

Functions

void FIRfilter(const double *h, int hlen, const double *x, int xlen, double *y, double *state)

Finite impulse response filter. The sequence x[0…xlen - 1] is filtered by the sequence h[0…hlen - 1], and the result is stored in the output sequence y[0…xlen-1]. When state is not NULL, the filter’s internal state is initialized to state, and state is updated after filtering.

Warning

The output sequence y is expected to hold xlen elements

Warning

The state variable must contain hlen - 1 elements.

Warning

Requires that xlen > hlen.

Parameters
  • [in] h: Filter coefficients

  • [in] hlen: Filter length.

  • [in] x: Input sequence.

  • [in] xlen: Length of input sequence.

  • [out] y: Output sequence.

  • [inout] state: Filter’s internal state.

void Conv(const double *h, int hlen, const double *x, int xlen, double *y)

Convolution. The sequence h[0…hlen - 1] is convolved with the sequence x[0…xlen - 1], and the result is stored in y[0…hlen +xlen - 1].

Warning

The output sequence y is expected to hold hlen + xlen - 1 elements.

Note

Both the case that hlen <= xlen and hlen > xlen are handled correctly. Internally, if hlen > xlen then h,hlen and x,xlen are swapped.

Parameters
  • [in] h: First input sequence.

  • [in] hlen: Length of first input sequence.

  • [in] x: Second input sequence.

  • [in] xlen: Length of second input sequence.

  • [out] y: Output sequence

void FreqzLogMagnitude(double *h, int hlen, double *w, int wlen, double *logmag)

Log-magnitude frequency response of FIR filter h.

Note

The in/out array logmag is expected to hold wlen elements.

Parameters
  • [in] h: FIR filter samples.

  • [in] hlen: Number of samples in h.

  • [in] w: Normalized frequencies (radians/sample) at which to evaluate H(e^{jw}).

  • [in] wlen: Number of frequency samples in w.

  • [inout] logmag: Log-magnitude, log |H(e^{jw})|, at w.

CMinPhaseFIRplan *AllocMinPhaseFIRplan(unsigned int nFFT, double *F, unsigned int nF)

Allocate and initialize a minimum phase FIR filter design plan.

Note

F[nF-1] is assumed to be the Nyquist frequency F_N, i.e., F_s = 2 F_N.

Parameters
  • [in] nFFT: number of FFT samples, also number of filter taps.

  • [in] F: array of frequencies of log-magnitude response.

  • [in] nF: number of frequencies in array F.

void LogMagFreqResp2MinPhaseFIR(const double *logmag, double *h, CMinPhaseFIRplan *plan)

Design minimum phase FIR filter with desired log-magnitude frequency response.

Parameters
  • [in] logmag: array containing desired log-magnitude frequency response.

  • [inout] h: memory location for filter coefficients.

  • [in] plan: filter design plan, obtained from AllocMinPhaseFIRplan.

void FreeMinPhaseFIRplan(CMinPhaseFIRplan *plan)

Release memory associated with minimum phase FIR filter design plan.

Parameters
  • [in] plan: filter design plan, obtained from AllocMinPhaseFIRplan.

void TimeVaryingConv(const double *hh, int hlen, const int *idx, int nidx, const unsigned int *x, int xlen, int xstart, unsigned int xthreshold, double *y)
file global.h

Variables

double g_fs
file interface.h
#include “mstruct.h”

MATLAB-C interface data types and function prototypes.

Defines

MSTRUCT_DECLARE
MSTRUCT_PROTOTYPE
file interp.h

Interpolation function prototypes.

Functions

void ExecuteLinearInterpolate(const double *yi, double *yo, int olen, const unsigned int *idx0, const unsigned int *idx1, const double *weight0, const double *weight1)
void PrepareLinearInterpolate(const double *xi, int ilen, const double *xo, int olen, unsigned int *idx0, unsigned int *idx1, double *weight0, double *weight1)
void LinearInterpolate(const double *xi, const double *yi, int ilen, const double *xo, double *yo, int olen)

Resample a piecewise-linear function. The piecewise linear function (xi[0…ilen-1], yi[0…ilen-1]) is sampled at the points xo[0…olen-1]. If xo[i]<xi[0] then yo[i]=yi[0]. If xo[i]>xi[ilen-1], then yo[i]=yi[ilen-1]. The result is returned in yo[0…olen-1].

Warning

The values of xi and xo are assumed to be strictly increasing.

Warning

The output array yo is assumed to be able to hold olen elements.

Parameters
  • [in] xi: x-coordinates of the piecewise linear function.

  • [in] yi: y-coordinates of the piecewise linear function.

  • [in] ilen: number of elements in xi and yi.

  • [in] xo: x-coordinates of the new sample points.

  • [out] yo: y-coordinates of the resampled function.

  • [in] olen: number of elements in xo and yo.

file mem.h
#include <stdlib.h>

Defines for memory allocation routines.

Defines

MemMalloc(s)
MemCalloc(n, s)
MemFree(p)
file msg.h
#include <stdio.h>#include <stdlib.h>

Defines for messaging routines.

Defines

MsgPrintf
MsgRelax
MsgErrorExit(msg)
file mstruct.h
#include <stdbool.h>

Macros for MATLAB-C types, prototypes and conversion routines.

file rng.h
#include “types.h”#include “SFMT.h”

Random number generation function prototypes.

Defines

RngFill_uint32(sfmt, array, size)

Functions

void RngInit(sfmt_t *sfmt)

void RngLambert(sfmt_t *sfmt, XYZ *xyz)
file sensor.h
#include “types.h”

Sensor load function and interactive functions prototypes.

Functions

CSensorDefinition *LoadSensor(const char *description)
int SensorGetResponse(const CSensorDefinition *sensor, const XYZ *xyz, CSensorResponse *response)
double SensorGetLogGain(CSensorDefinition *sensor, XYZ *xyz, int band)
void CmdListSensors(void)
void CmdLoadSensor(const char *description)
void CmdWhosSensors(void)
void CmdClearSensor(const char *description)
void CmdClearAllSensors(void)
file setup.h

Setup routine prototypes.

Typedefs

typedef struct CFileSetupItem CFileSetupItem

Functions

int ReadSetup(char *filename, CFileSetup *pSetup)
void PrintSetup(CFileSetupItem *item)
void SetupPrintItem(CFileSetupItem *item)
void SetupPrintItemName(CFileSetupItem *item)
CFileSetupItem *SetupFindField(CFileSetupItem *item, char *name)
CFileSetupItem *SetupFindStruct(CFileSetupItem *item, char *name)

file types.h
#include “mysofa.h”

Project-wide typedefs.

Typedefs

typedef double YPRT[3][3]
typedef struct CSensorDefinition CSensorDefinition
typedef void (*CSensorInitFunction)(const char*, CSensorDefinition*)
typedef double (*CSensorProbeLogGainFunction)(const CSensorDefinition*, const XYZ*)
typedef int (*CSensorProbeXyz2IdxFunction)(const CSensorDefinition*, const XYZ*)
typedef union CSensorProbeFunction CSensorProbeFunction
typedef struct CSensorResponse CSensorResponse
file 3D.c
#include <math.h>#include “3D.h”#include “defs.h”#include “types.h”

Three-dimensional transformation routines.

Functions

void ComputeSensor2RoomYPRT(const YPR *ypr, YPRT *yprt)

Compute sensor-to-room coordinate transformation matrix.

Parameters
  • [in] ypr: Sensor orientation (yaw, pitch, roll) in degrees.

  • [inout] yprT: Sensor-to-room coordinate transformation matrix.

void ComputeRoom2SensorYPRT(const YPR *ypr, YPRT *yprt)

Compute room-to-sensor coordinate transformation matrix.

Parameters
  • [in] ypr: Sensor orientation (yaw, pitch, roll) in degrees.

  • [inout] yprT: Room-to-sensor coordinate transformation matrix.

void YawPitchRoll(const XYZ *xyz, const YPRT *yprt, XYZ *xyzhat)

Apply yaw-pitch-roll coordinate transformation.

void YawPitchRoll_InPlace(XYZ *xyz, const YPRT *yprt)

Apply yaw-pitch-roll coordinate transformation (in place).

void azel_vp(const XYZ *xyz, AZEL *vp)

Convert (x,y,z) coordinates to vertical polar azimuth/elevation coordinates.

Parameters
  • [in] xyz: pointer to XYZ structure containing (x,y,z) coordinates.

  • [inout] vp: pointer to AZEL structure for vertical polar azimuth/elevation.

file dsp.c
#include <math.h>#include <string.h>#include “fftw3.h”#include “defs.h”#include “dsp.h”#include “interp.h”#include “mem.h”

Digital Signal Processing routines.

Functions

void Conv(const double *h, int hlen, const double *x, int xlen, double *y)

Convolution. The sequence h[0…hlen - 1] is convolved with the sequence x[0…xlen - 1], and the result is stored in y[0…hlen +xlen - 1].

Warning

The output sequence y is expected to hold hlen + xlen - 1 elements.

Note

Both the case that hlen <= xlen and hlen > xlen are handled correctly. Internally, if hlen > xlen then h,hlen and x,xlen are swapped.

Parameters
  • [in] h: First input sequence.

  • [in] hlen: Length of first input sequence.

  • [in] x: Second input sequence.

  • [in] xlen: Length of second input sequence.

  • [out] y: Output sequence

void FIRfilter(const double *h, int hlen, const double *x, int xlen, double *y, double *state)

Finite impulse response filter. The sequence x[0…xlen - 1] is filtered by the sequence h[0…hlen - 1], and the result is stored in the output sequence y[0…xlen-1]. When state is not NULL, the filter’s internal state is initialized to state, and state is updated after filtering.

Warning

The output sequence y is expected to hold xlen elements

Warning

The state variable must contain hlen - 1 elements.

Warning

Requires that xlen > hlen.

Parameters
  • [in] h: Filter coefficients

  • [in] hlen: Filter length.

  • [in] x: Input sequence.

  • [in] xlen: Length of input sequence.

  • [out] y: Output sequence.

  • [inout] state: Filter’s internal state.

void FreqzLogMagnitude(double *h, int hlen, double *w, int wlen, double *logmag)

Log-magnitude frequency response of FIR filter h.

Note

The in/out array logmag is expected to hold wlen elements.

Parameters
  • [in] h: FIR filter samples.

  • [in] hlen: Number of samples in h.

  • [in] w: Normalized frequencies (radians/sample) at which to evaluate H(e^{jw}).

  • [in] wlen: Number of frequency samples in w.

  • [inout] logmag: Log-magnitude, log |H(e^{jw})|, at w.

CMinPhaseFIRplan *AllocMinPhaseFIRplan(unsigned int nFFT, double *F, unsigned int nF)

Allocate and initialize a minimum phase FIR filter design plan.

Note

F[nF-1] is assumed to be the Nyquist frequency F_N, i.e., F_s = 2 F_N.

Parameters
  • [in] nFFT: number of FFT samples, also number of filter taps.

  • [in] F: array of frequencies of log-magnitude response.

  • [in] nF: number of frequencies in array F.

void LogMagFreqResp2MinPhaseFIR(const double *logmag, double *h, CMinPhaseFIRplan *plan)

Design minimum phase FIR filter with desired log-magnitude frequency response.

Parameters
  • [in] logmag: array containing desired log-magnitude frequency response.

  • [inout] h: memory location for filter coefficients.

  • [in] plan: filter design plan, obtained from AllocMinPhaseFIRplan.

void FreeMinPhaseFIRplan(CMinPhaseFIRplan *plan)

Release memory associated with minimum phase FIR filter design plan.

Parameters
  • [in] plan: filter design plan, obtained from AllocMinPhaseFIRplan.

void TimeVaryingConv(const double *hh, int hlen, const int *idx, int nidx, const unsigned int *x, int xlen, int xstart, unsigned int xthreshold, double *y)
file interface.c
#include “interface.h”#include “mstruct.h”

MATLAB-C interface support routines.

Defines

MSTRUCT_LOAD
file interp.c
#include “interp.h”

Interpolation routines.

Functions

void ExecuteLinearInterpolate(const double *yi, double *yo, int olen, const unsigned int *idx0, const unsigned int *idx1, const double *weight0, const double *weight1)
void PrepareLinearInterpolate(const double *xi, int ilen, const double *xo, int olen, unsigned int *idx0, unsigned int *idx1, double *weight0, double *weight1)
void LinearInterpolate(const double *xi, const double *yi, int ilen, const double *xo, double *yo, int olen)

Resample a piecewise-linear function. The piecewise linear function (xi[0…ilen-1], yi[0…ilen-1]) is sampled at the points xo[0…olen-1]. If xo[i]<xi[0] then yo[i]=yi[0]. If xo[i]>xi[ilen-1], then yo[i]=yi[ilen-1]. The result is returned in yo[0…olen-1].

Warning

The values of xi and xo are assumed to be strictly increasing.

Warning

The output array yo is assumed to be able to hold olen elements.

Parameters
  • [in] xi: x-coordinates of the piecewise linear function.

  • [in] yi: y-coordinates of the piecewise linear function.

  • [in] ilen: number of elements in xi and yi.

  • [in] xo: x-coordinates of the new sample points.

  • [out] yo: y-coordinates of the resampled function.

  • [in] olen: number of elements in xo and yo.

file rng.c
#include “types.h”#include “SFMT.h”

Random number generation routines.

Defines

UNIFORM(a, b, c)
UNIFORM01(a)

Functions

void RngInit(sfmt_t *sfmt)

void RngSeed(void)
void RngLambert(sfmt_t *sfmt, XYZ *xyz)
file roomsim.c
#include <math.h>#include <string.h>#include “fftw3.h”#include “3D.h”#include “defs.h”#include “dsp.h”#include “interface.h”#include “interp.h”#include “mem.h”#include “msg.h”#include “rng.h”#include “sensor.h”#include “types.h”#include “global.h”

Room simulation routines.

Defines

NFFT_SIZE
RECV_TFS_BIN(r, t, f, s)
SURFACELOGREFLECTION(v, s, b)
SURFACELOGABSORPTION(v, s, b)
SURFACELOGDIFFUSION(v, s, b)
SURFACEDIFFUSIONCOEFFICIENT(v, s, b)
XYZ_NEGATE(v)
LOGLIMIT(v)

Resamples the surface absorption and diffusion coefficients at the simulation band frequencies.

Note

Requires that the pSetup structure contains meaningful values, and that the pSimulation->nBands and pSimulation->frequency fields are initialized.

IMGF(x)
IMGS(x)
VALIDATE(a, s)

Typedefs

typedef void (*CVirtualRoomCallback)(const CRoomCallbackArg*)

Functions

void ComputeBandFrequencies(const CRoomSetup *pSetup, CRoomsimInternal *pSimulation)
void PrintAbsorptionAndDiffusion(const CRoomSetup *pSetup, CRoomsimInternal *pSimulation)
void InterpolateAbsorptionAndDiffusion(const CRoomSetup *pSetup, CRoomsimInternal *pSimulation)
void ComputeAirAbsorption(const CRoomSetup *pSetup, CRoomsimInternal *pSimulation)
void roomcallback(const CRoomCallbackArg *arg)
void EnumerateVirtualRooms(const CRoomSetup *pSetup, CRoomsimInternal *pSimulation, int maxx, int maxy, int maxz, CVirtualRoomCallback callback)
void InitSimulationWeights(CRoomsimInternal *pSimulation, CSensorDefinition *pSensor)
CRoomsimInternal *RoomsimInit(const CRoomSetup *pSetup, sfmt_t *sfmt)
BRIR *RoomsimRelease(CRoomsimInternal *pSimulation)
void ReleaseBRIR(BRIR *brir)
XYZ *GenerateRays(int nDesiredRays, int *pnActualRays)

Generates unit vectors equally distributed around a sphere.

Return

XYZ array of unit vectors.

Note

The number of rays N that is actually generated satisfies N = 20*k*k, where k is the smallest integer such that N >= nDesiredRays.

Note

The generating algorithm subdivides each face of a regular icosahedron into a triangular grid, whose granularity is determined by the number of desired rays. The algorithm then enumerates the triangular cells of the grid and takes the center of the grid cell as a ray direction.

       C             Triangle ABC is one face of the icosahedron, which 
     ./_\.           is subdivided into a triangular grid. The grid is 
   ./_\./_\          enumerated from left-to-right, bottom-to-top, 
 ./_\./_\./_\.       starting at A.
A             B

Parameters
  • [in] nDesiredRays: Number of desired rays.

  • [out] pnActualRays: Number of rays actually generated.

void AddDiffuseEnergy(CRoomsimInternal *pSimulation, int iReceiver, double recv_timeofarrival, XYZ *recvrayvector, int iBand, double recv_logenergy)
void MakeUnitVector(XYZ *xyz)
void RoomsimDiffuse(const CRoomSetup *pSetup, CRoomsimInternal *pSimulation, sfmt_t *sfmt)
BRIR *Roomsim(const CRoomSetup *pSetup)
void ValidateSetup(CRoomSetup *pSetup)

Variables

double g_fs = -1
const XYZ SpaceBinCenter[6] = {{1, 0, 0}, {-1, 0, 0}, {0, 1, 0}, {0, -1, 0}, {0, 0, 1}, {0, 0, -1}}
file sensor.c
#include <math.h>#include <string.h>#include <stdio.h>#include “3D.h”#include “defs.h”#include “mem.h”#include “msg.h”#include “types.h”#include “sensor.h”#include “mysofa.h”#include “global.h”

Sensor init, probe, and exit routines.

Typedefs

typedef struct CSensorDefinitionListItem CSensorDefinitionListItem

Functions

void MexAtExitCallback(void)
int SensorGetResponse(const CSensorDefinition *sensor, const XYZ *xyz, CSensorResponse *response)
double SensorGetLogGain(CSensorDefinition *sensor, XYZ *xyz, int band)
void SensorInitDefault(CSensorDefinition *definition)
double sensor_bidirectional_probe(const CSensorDefinition *sensor, const XYZ *xyz)
void sensor_bidirectional_init(const char *datafile, CSensorDefinition *definition)
double sensor_cardioid_probe(const CSensorDefinition *sensor, const XYZ *xyz)
void sensor_cardioid_init(const char *datafile, CSensorDefinition *definition)
double sensor_dipole_probe(const CSensorDefinition *sensor, const XYZ *xyz)
void sensor_dipole_init(const char *datafile, CSensorDefinition *definition)
double sensor_hemisphere_probe(const CSensorDefinition *sensor, const XYZ *xyz)
void sensor_hemisphere_init(const char *datafile, CSensorDefinition *definition)
double sensor_hypercardioid_probe(const CSensorDefinition *sensor, const XYZ *xyz)
void sensor_hypercardioid_init(const char *datafile, CSensorDefinition *definition)
double sensor_omnidirectional_probe(const CSensorDefinition *sensor, const XYZ *xyz)
void sensor_omnidirectional_init(const char *datafile, CSensorDefinition *definition)
double sensor_subcardioid_probe(const CSensorDefinition *sensor, const XYZ *xyz)
void sensor_subcardioid_init(const char *datafile, CSensorDefinition *definition)
double sensor_supercardioid_probe(const CSensorDefinition *sensor, const XYZ *xyz)
void sensor_supercardioid_init(const char *datafile, CSensorDefinition *definition)
double sensor_unidirectional_probe(const CSensorDefinition *sensor, const XYZ *xyz)
void sensor_unidirectional_init(const char *datafile, CSensorDefinition *definition)
void ClearSofaSensor(CSensorDefinition *definition)
void getMysofaErrorString(int error, char *buffer)
int sensor_SOFA_probe_nointerp(const CSensorDefinition *sensor, const XYZ *xyz)
int sensor_SOFA_probe(const CSensorDefinition *sensor, const XYZ *xyz)
void getOptions(char *options, CSensorDefinition *definition)
void sensor_SOFA_init(const char *datafile, CSensorDefinition *definition)
int FindSensor(const char *description)
char *FindSubID(const char *description)
CSensorDefinitionListItem *FindSensorData(const char *name, const char *subid)
CSensorDefinition *LoadSensor(const char *description)
void ClearSensor(CSensorDefinitionListItem *item)
void ClearAllSensors(void)
void CmdListSensors(void)
void CmdLoadSensor(const char *description)
void CmdWhosSensors(void)
void CmdClearSensor(const char *description)
void CmdClearAllSensors(void)

Variables

CSensorListItem sensor[] = {{"bidirectional", sensor_bidirectional_init}, {"cardioid", sensor_cardioid_init}, {"dipole", sensor_dipole_init}, {"hemisphere", sensor_hemisphere_init}, {"hypercardioid", sensor_hypercardioid_init}, {"omnidirectional", sensor_omnidirectional_init}, {"subcardioid", sensor_subcardioid_init}, {"supercardioid", sensor_supercardioid_init}, {"unidirectional", sensor_unidirectional_init}, {"SOFA", sensor_SOFA_init}}
int nSensors = sizeof(sensor) / sizeof(CSensorListItem)
CSensorDefinitionListItem *g_pSensordefinitionlist = NULL
file setup.c
#include <stdio.h>#include <stdlib.h>#include <string.h>#include “setup.h”#include “defs.h”

Setup routines.

Functions

CFileSetupItem *SetupFindStruct(CFileSetupItem *item, char *name)

CFileSetupItem *SetupFindField(CFileSetupItem *item, char *name)
void SetupPrintItem(CFileSetupItem *item)
void SetupPrintItemName(CFileSetupItem *item)
CFileSetupItem *AddItem(CFileSetupItem *item, char *name, char *value)
char *SkipWhite(char *p)
char *ParseField(char *p, CFileSetupItem *pRootSetupItem)
int ReadSetup(char *filename, CFileSetup *pSetup)
void PrintSetup(CFileSetupItem *item)
file main.c
#include <stdio.h>#include <stdlib.h>#include “libroomsim.h”#include “interface.h”#include “setup.h”#include “msg.h”#include “build.h”#include “wavwriter.h”

Basic room simulator in C.

Defines

FWVAR(v)
FWDBLARR(v, c)

Functions

int main(int argc, char **argv)
file unittest.c
#include <math.h>#include <string.h>#include “defs.h”#include “dsp.h”#include “interp.h”#include “msg.h”#include “sensor.h”#include “libroomsim.h”

Unit test routines.

Defines

EPSILON
EPSEQ(x, y)
CLEAROUTPUT
ASSERTOUTPUT(out, r)
ERROR(MSG)
LENGTH(x)
DBLLEN(x)
INTLEN(x)
DISPDBL(x)
DISPINT(x)
NORMFREQ
PI
RAYORDER

Functions

void uterror(char *msg, char *file, unsigned int line)
void PrintConv(double *h, int hlen, double *x, int xlen, double *y)
void testConvolution(void)
void testLinearInterpolation(void)
void testMinPhaseFIR(void)
void testFreqzLogMagnitude(void)
void Roomsetup(CRoomSetup *par)
void testEmptyRoom(void)

Variables

CUnittest unittest[] = {{"convolution", testConvolution}, {"linear interpolation", testLinearInterpolation}, {"minimum phase FIR filter design", testMinPhaseFIR}, {"freqz log magnitude frequency response", testFreqzLogMagnitude}, {"empty room", testEmptyRoom},}
int nUnittests = sizeof(unittest) / sizeof(CUnittest)
page todo

dir /home/robaru/repos/sofamyroom_gitlab/src/libroomsim/include
dir /home/robaru/repos/sofamyroom_gitlab/src/libroomsim
dir /home/robaru/repos/sofamyroom_gitlab/src/libroomsim/source
dir /home/robaru/repos/sofamyroom_gitlab/src