SAF
Loading...
Searching...
No Matches
tvconv.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
24#ifndef __TVCONV_H_INCLUDED__
25#define __TVCONV_H_INCLUDED__
26
27#include "_common.h"
28
29#ifdef __cplusplus
30extern "C" {
31#endif /* __cplusplus */
32
51
52/* ========================================================================== */
53/* Main Functions */
54/* ========================================================================== */
55
61void tvconv_create(void** const phTVCnv);
62
68void tvconv_destroy(void** const phTVCnv);
69
77void tvconv_init(void* const hTVCnv,
78 int samplerate,
79 int hostBlockSize);
80
91void tvconv_process(void* const hTVCnv,
92 float* const* const inputs,
93 float* const* const outputs,
94 int nInputs,
95 int nOutputs,
96 int nSamples);
97
98
99/* ========================================================================== */
100/* Set Functions */
101/* ========================================================================== */
102
107void tvconv_refreshParams(void* const hTVCnv);
108
112void tvconv_checkReInit(void* const hTVCnv);
113
115void tvconv_setFiltersAndPositions(void* const hTVCnv);
116
118void tvconv_setSofaFilePath(void* const hTVCnv, const char* path);
119
127void tvconv_setTargetPosition(void* const hTVCnv, float position, int dim);
128
129
130/* ========================================================================== */
131/* Get Functions */
132/* ========================================================================== */
133
139
140
142int tvconv_getNumInputChannels(void* const hTVCnv);
143
148int tvconv_getNumOutputChannels(void* const hTVCnv);
149
151int tvconv_getHostBlockSize(void* const hTVCnv);
152
154int tvconv_getNumIRs(void* const hTVCnv);
155
157int tvconv_getNumListenerPositions(void* const hTVCnv);
158
160float tvconv_getListenerPosition(void* const hTVCnv, int index, int dim);
161
163int tvconv_getListenerPositionIdx(void* const hTVCnv);
164
166float tvconv_getTargetPosition(void* const hTVCnv, int dim);
167
169float tvconv_getSourcePosition(void* const hTVCnv, int dim);
170
172float tvconv_getMinDimension(void* const hTVCnv, int dim);
173
175float tvconv_getMaxDimension(void* const hTVCnv, int dim);
176
178int tvconv_getIRLength(void* const hTVCnv);
179
181int tvconv_getIRFs(void* const hTVCnv);
182
184int tvconv_getHostFs(void* const hTVCnv);
185
190int tvconv_getProcessingDelay(void* const hTVCnv);
191
193char* tvconv_getSofaFilePath(void* const hTVCnv);
194
197
199CODEC_STATUS tvconv_getCodecStatus(void* const hTVCnv);
200
201
202#ifdef __cplusplus
203} /* extern "C" { */
204#endif /* __cplusplus */
205
206#endif /* __TVCONV_H_INCLUDED__ */
A bunch of things that are common to many of the saf examples.
CODEC_STATUS
Current status of the codec.
Definition _common.h:201
float tvconv_getListenerPosition(void *const hTVCnv, int index, int dim)
Returns the current coordinate of dimension dim (0 ... NUM_DIMENSIONS-1)
Definition tvconv.c:390
SAF_TVCONV_ERROR_CODES
SOFA loader error codes.
Definition tvconv.h:34
@ SAF_TVCONV_SOFA_ERROR_INVALID_FILE_OR_FILE_PATH
Not a SOFA file, or no such file was found in the specified location.
Definition tvconv.h:42
@ SAF_TVCONV_SOFA_ERROR_NETCDF_IN_USE
NetCDF is not thread safe!
Definition tvconv.h:48
@ SAF_TVCONV_SOFA_ERROR_FORMAT_UNEXPECTED
The data-type of the SOFA data was not as expected.
Definition tvconv.h:46
@ SAF_TVCONV_SOFA_ERROR_DIMENSIONS_UNEXPECTED
Dimensions of the SOFA data were not as expected.
Definition tvconv.h:44
@ SAF_TVCONV_SOFA_OK
None of the error checks failed.
Definition tvconv.h:40
@ SAF_TVCONV_NOT_INIT
Not initialized.
Definition tvconv.h:36
@ SAF_TVCONV_SOFA_LOADING
Loading file.
Definition tvconv.h:38
void tvconv_process(void *const hTVCnv, float *const *const inputs, float *const *const outputs, int nInputs, int nOutputs, int nSamples)
Performs the time-varying convolution processing.
Definition tvconv.c:126
int tvconv_getIRFs(void *const hTVCnv)
Returns the samplerate of the loaded filters
Definition tvconv.c:436
void tvconv_refreshParams(void *const hTVCnv)
Sets all intialisation flags to 1.
Definition tvconv.c:196
int tvconv_getProcessingDelay(void *const hTVCnv)
Returns the processing delay in samples (may be used for delay compensation features)
Definition tvconv.c:448
CODEC_STATUS tvconv_getCodecStatus(void *const hTVCnv)
Returns current codec status (see CODEC_STATUS enum)
Definition tvconv.c:469
void tvconv_setFiltersAndPositions(void *const hTVCnv)
Reads IRs and positions from the current sofa file path.
Definition tvconv.c:243
char * tvconv_getSofaFilePath(void *const hTVCnv)
Returns the current Sofa file path.
Definition tvconv.c:454
void tvconv_create(void **const phTVCnv)
Creates an instance of tvconv.
Definition tvconv.c:28
float tvconv_getSourcePosition(void *const hTVCnv, int dim)
Returns the source coordinate of dimension dim (0 ... NUM_DIMENSIONS-1)
Definition tvconv.c:409
void tvconv_setTargetPosition(void *const hTVCnv, float position, int dim)
Sets the target listener position.
Definition tvconv.c:349
int tvconv_getIRLength(void *const hTVCnv)
Returns the current filter length, in samples.
Definition tvconv.c:430
int tvconv_getNumListenerPositions(void *const hTVCnv)
Returns the number of listener positions in the loaded sofa file.
Definition tvconv.c:383
int tvconv_getNumIRs(void *const hTVCnv)
Returns the number of IR channels in the loaded sofa file.
Definition tvconv.c:377
int tvconv_getHostBlockSize(void *const hTVCnv)
Returns the currect host block size.
Definition tvconv.c:371
void tvconv_init(void *const hTVCnv, int samplerate, int hostBlockSize)
Initialises an instance of tvconv with default settings.
Definition tvconv.c:106
int tvconv_getHostFs(void *const hTVCnv)
Returns the samperate of the host.
Definition tvconv.c:442
SAF_TVCONV_ERROR_CODES tvconv_getSofaErrorState(void *const hTVCnv)
Returns the current Sofa file error state.
Definition tvconv.c:463
void tvconv_setSofaFilePath(void *const hTVCnv, const char *path)
Sets current sofa file path.
Definition tvconv.c:338
int tvconv_getListenerPositionIdx(void *const hTVCnv)
Returns the index of the current IR position.
Definition tvconv.c:396
float tvconv_getMinDimension(void *const hTVCnv, int dim)
Returns minimum cooridinate of dimension dim (0 ... NUM_DIMENSIONS-1)
Definition tvconv.c:416
float tvconv_getTargetPosition(void *const hTVCnv, int dim)
Returns the current coordinate of dimension dim (0 ... NUM_DIMENSIONS-1)
Definition tvconv.c:402
float tvconv_getMaxDimension(void *const hTVCnv, int dim)
Returns minimum cooridinate of dimension dim (0 ... NUM_DIMENSIONS-1)
Definition tvconv.c:423
int tvconv_getNumInputChannels(void *const hTVCnv)
Returns the number input channels.
Definition tvconv.c:359
int tvconv_getNumOutputChannels(void *const hTVCnv)
Returns the number of output channels (the same as the number of channels in the loaded sofa file)
Definition tvconv.c:365
int tvconv_getFrameSize(void)
Returns the processing framesize (i.e., number of samples processed with every _process() call )
void tvconv_checkReInit(void *const hTVCnv)
Checks whether things have to be reinitialised, and does so if it is needed.
Definition tvconv.c:203
void tvconv_destroy(void **const phTVCnv)
Destroys an instance of tvconv.
Definition tvconv.c:80