SAF
Loading...
Searching...
No Matches
tvconv.h File Reference

A time-varying multi-channel convolver. More...

#include "_common.h"

Go to the source code of this file.

Enumerations

enum  SAF_TVCONV_ERROR_CODES {
  SAF_TVCONV_NOT_INIT , SAF_TVCONV_SOFA_LOADING , SAF_TVCONV_SOFA_OK , SAF_TVCONV_SOFA_ERROR_INVALID_FILE_OR_FILE_PATH ,
  SAF_TVCONV_SOFA_ERROR_DIMENSIONS_UNEXPECTED , SAF_TVCONV_SOFA_ERROR_FORMAT_UNEXPECTED , SAF_TVCONV_SOFA_ERROR_NETCDF_IN_USE
}
 SOFA loader error codes. More...
 

Functions

void tvconv_create (void **const phTVCnv)
 Creates an instance of tvconv.
 
void tvconv_destroy (void **const phTVCnv)
 Destroys an instance of tvconv.
 
void tvconv_init (void *const hTVCnv, int samplerate, int hostBlockSize)
 Initialises an instance of tvconv with default settings.
 
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.
 
void tvconv_refreshParams (void *const hTVCnv)
 Sets all intialisation flags to 1.
 
void tvconv_checkReInit (void *const hTVCnv)
 Checks whether things have to be reinitialised, and does so if it is needed.
 
void tvconv_setFiltersAndPositions (void *const hTVCnv)
 Reads IRs and positions from the current sofa file path.
 
void tvconv_setSofaFilePath (void *const hTVCnv, const char *path)
 Sets current sofa file path.
 
void tvconv_setTargetPosition (void *const hTVCnv, float position, int dim)
 Sets the target listener position.
 
int tvconv_getFrameSize (void)
 Returns the processing framesize (i.e., number of samples processed with every _process() call )
 
int tvconv_getNumInputChannels (void *const hTVCnv)
 Returns the number input channels.
 
int tvconv_getNumOutputChannels (void *const hTVCnv)
 Returns the number of output channels (the same as the number of channels in the loaded sofa file)
 
int tvconv_getHostBlockSize (void *const hTVCnv)
 Returns the currect host block size.
 
int tvconv_getNumIRs (void *const hTVCnv)
 Returns the number of IR channels in the loaded sofa file.
 
int tvconv_getNumListenerPositions (void *const hTVCnv)
 Returns the number of listener positions in the loaded sofa file.
 
float tvconv_getListenerPosition (void *const hTVCnv, int index, int dim)
 Returns the current coordinate of dimension dim (0 ... NUM_DIMENSIONS-1)
 
int tvconv_getListenerPositionIdx (void *const hTVCnv)
 Returns the index of the current IR position.
 
float tvconv_getTargetPosition (void *const hTVCnv, int dim)
 Returns the current coordinate of dimension dim (0 ... NUM_DIMENSIONS-1)
 
float tvconv_getSourcePosition (void *const hTVCnv, int dim)
 Returns the source coordinate of dimension dim (0 ... NUM_DIMENSIONS-1)
 
float tvconv_getMinDimension (void *const hTVCnv, int dim)
 Returns minimum cooridinate of dimension dim (0 ... NUM_DIMENSIONS-1)
 
float tvconv_getMaxDimension (void *const hTVCnv, int dim)
 Returns minimum cooridinate of dimension dim (0 ... NUM_DIMENSIONS-1)
 
int tvconv_getIRLength (void *const hTVCnv)
 Returns the current filter length, in samples.
 
int tvconv_getIRFs (void *const hTVCnv)
 Returns the samplerate of the loaded filters

 
int tvconv_getHostFs (void *const hTVCnv)
 Returns the samperate of the host.
 
int tvconv_getProcessingDelay (void *const hTVCnv)
 Returns the processing delay in samples (may be used for delay compensation features)
 
char * tvconv_getSofaFilePath (void *const hTVCnv)
 Returns the current Sofa file path.
 
SAF_TVCONV_ERROR_CODES tvconv_getSofaErrorState (void *const hTVCnv)
 Returns the current Sofa file error state.
 
CODEC_STATUS tvconv_getCodecStatus (void *const hTVCnv)
 Returns current codec status (see CODEC_STATUS enum)
 

Detailed Description

A time-varying multi-channel convolver.

Author
Rapolas Daugintis
Date
13.07.2021

Definition in file tvconv.h.

Enumeration Type Documentation

◆ SAF_TVCONV_ERROR_CODES

SOFA loader error codes.

Enumerator
SAF_TVCONV_NOT_INIT 

Not initialized.

SAF_TVCONV_SOFA_LOADING 

Loading file.

SAF_TVCONV_SOFA_OK 

None of the error checks failed.

SAF_TVCONV_SOFA_ERROR_INVALID_FILE_OR_FILE_PATH 

Not a SOFA file, or no such file was found in the specified location.

SAF_TVCONV_SOFA_ERROR_DIMENSIONS_UNEXPECTED 

Dimensions of the SOFA data were not as expected.

SAF_TVCONV_SOFA_ERROR_FORMAT_UNEXPECTED 

The data-type of the SOFA data was not as expected.

SAF_TVCONV_SOFA_ERROR_NETCDF_IN_USE 

NetCDF is not thread safe!

Definition at line 34 of file tvconv.h.

Function Documentation

◆ tvconv_checkReInit()

void tvconv_checkReInit ( void *const hTVCnv)

Checks whether things have to be reinitialised, and does so if it is needed.

Definition at line 203 of file tvconv.c.

◆ tvconv_create()

void tvconv_create ( void **const phTVCnv)

Creates an instance of tvconv.

Parameters
[in]phTVCnv(&) address of tvconv handle

Definition at line 27 of file tvconv.c.

◆ tvconv_destroy()

void tvconv_destroy ( void **const phTVCnv)

Destroys an instance of tvconv.

Parameters
[in]phTVCnv(&) address of tvconv handle

Definition at line 79 of file tvconv.c.

◆ tvconv_getCodecStatus()

CODEC_STATUS tvconv_getCodecStatus ( void *const hTVCnv)

Returns current codec status (see CODEC_STATUS enum)

Definition at line 469 of file tvconv.c.

◆ tvconv_getHostBlockSize()

int tvconv_getHostBlockSize ( void *const hTVCnv)

Returns the currect host block size.

Definition at line 371 of file tvconv.c.

◆ tvconv_getHostFs()

int tvconv_getHostFs ( void *const hTVCnv)

Returns the samperate of the host.

Definition at line 442 of file tvconv.c.

◆ tvconv_getIRFs()

int tvconv_getIRFs ( void *const hTVCnv)

Returns the samplerate of the loaded filters

Definition at line 436 of file tvconv.c.

◆ tvconv_getIRLength()

int tvconv_getIRLength ( void *const hTVCnv)

Returns the current filter length, in samples.

Definition at line 430 of file tvconv.c.

◆ tvconv_getListenerPosition()

float tvconv_getListenerPosition ( void *const hTVCnv,
int index,
int dim )

Returns the current coordinate of dimension dim (0 ... NUM_DIMENSIONS-1)

Definition at line 390 of file tvconv.c.

◆ tvconv_getListenerPositionIdx()

int tvconv_getListenerPositionIdx ( void *const hTVCnv)

Returns the index of the current IR position.

Definition at line 396 of file tvconv.c.

◆ tvconv_getMaxDimension()

float tvconv_getMaxDimension ( void *const hTVCnv,
int dim )

Returns minimum cooridinate of dimension dim (0 ... NUM_DIMENSIONS-1)

Definition at line 423 of file tvconv.c.

◆ tvconv_getMinDimension()

float tvconv_getMinDimension ( void *const hTVCnv,
int dim )

Returns minimum cooridinate of dimension dim (0 ... NUM_DIMENSIONS-1)

Definition at line 416 of file tvconv.c.

◆ tvconv_getNumInputChannels()

int tvconv_getNumInputChannels ( void *const hTVCnv)

Returns the number input channels.

Definition at line 359 of file tvconv.c.

◆ tvconv_getNumIRs()

int tvconv_getNumIRs ( void *const hTVCnv)

Returns the number of IR channels in the loaded sofa file.

Definition at line 377 of file tvconv.c.

◆ tvconv_getNumListenerPositions()

int tvconv_getNumListenerPositions ( void *const hTVCnv)

Returns the number of listener positions in the loaded sofa file.

Definition at line 383 of file tvconv.c.

◆ tvconv_getNumOutputChannels()

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 at line 365 of file tvconv.c.

◆ tvconv_getProcessingDelay()

int tvconv_getProcessingDelay ( void *const hTVCnv)

Returns the processing delay in samples (may be used for delay compensation features)

Definition at line 448 of file tvconv.c.

◆ tvconv_getSofaErrorState()

SAF_TVCONV_ERROR_CODES tvconv_getSofaErrorState ( void *const hTVCnv)

Returns the current Sofa file error state.

Definition at line 463 of file tvconv.c.

◆ tvconv_getSofaFilePath()

char * tvconv_getSofaFilePath ( void *const hTVCnv)

Returns the current Sofa file path.

Definition at line 454 of file tvconv.c.

◆ tvconv_getSourcePosition()

float tvconv_getSourcePosition ( void *const hTVCnv,
int dim )

Returns the source coordinate of dimension dim (0 ... NUM_DIMENSIONS-1)

Definition at line 409 of file tvconv.c.

◆ tvconv_getTargetPosition()

float tvconv_getTargetPosition ( void *const hTVCnv,
int dim )

Returns the current coordinate of dimension dim (0 ... NUM_DIMENSIONS-1)

Definition at line 402 of file tvconv.c.

◆ tvconv_init()

void tvconv_init ( void *const hTVCnv,
int samplerate,
int hostBlockSize )

Initialises an instance of tvconv with default settings.

Parameters
[in]hTVCnvtvconv handle
[in]samplerateHost samplerate.
[in]hostBlockSizeHost frame/block size

Definition at line 105 of file tvconv.c.

◆ tvconv_process()

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.

Parameters
[in]hTVCnvtvconv handle
[in]inputsInput channel buffers; 2-D array: nInputs x nSamples
[in]outputsOutput channel buffers; 2-D array: nOutputs x nSamples
[in]nInputsNumber of input channels
[in]nOutputsNumber of output channels
[in]nSamplesNumber of samples in 'inputs'/'output' matrices (block size)

Definition at line 125 of file tvconv.c.

◆ tvconv_refreshParams()

void tvconv_refreshParams ( void *const hTVCnv)

Sets all intialisation flags to 1.

Re-initialising all settings/variables, as tvconv is currently configured, at next available opportunity.

Definition at line 196 of file tvconv.c.

◆ tvconv_setFiltersAndPositions()

void tvconv_setFiltersAndPositions ( void *const hTVCnv)

Reads IRs and positions from the current sofa file path.

None of the error checks failed

Not a SOFA file, or no such file was found in the specified location

Dimensions of the SOFA data were not as expected

The data-type of the SOFA data was not as expected

NetCDF is not thread safe!

Definition at line 243 of file tvconv.c.

◆ tvconv_setSofaFilePath()

void tvconv_setSofaFilePath ( void *const hTVCnv,
const char * path )

Sets current sofa file path.

Definition at line 338 of file tvconv.c.

◆ tvconv_setTargetPosition()

void tvconv_setTargetPosition ( void *const hTVCnv,
float position,
int dim )

Sets the target listener position.

Parameters
[in]dimdimension of the coordinate to be set (0 is x, 1 is y,
  • and 2 is z).
[in]positionnew position to be set.

Definition at line 349 of file tvconv.c.