SAF
Loading...
Searching...
No Matches
tvconv_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
24#ifndef __TVCONV_INTERNAL_H_INCLUDED__
25#define __TVCONV_INTERNAL_H_INCLUDED__
26
27#include <stdio.h>
28#include <math.h>
29#include <string.h>
30#include <assert.h>
31#include "tvconv.h"
32#include "saf.h"
33#include "saf_externals.h" /* to also include saf dependencies (cblas etc.) */
34
35#ifdef __cplusplus
36extern "C" {
37#endif /* __cplusplus */
38
39/* ========================================================================== */
40/* Internal Parameters */
41/* ========================================================================== */
42
43#define MIN_FRAME_SIZE ( 512 )
44#define MAX_FRAME_SIZE ( 8192 )
45#define NUM_DIMENSIONS ( 3 )
46
47/* ========================================================================== */
48/* Structures */
49/* ========================================================================== */
50
52typedef float vectorND[NUM_DIMENSIONS];
53
55typedef struct _tvconv
56{
57 /* FIFO buffers */
58 int FIFO_idx;
59 float** inFIFO;
60 float** outFIFO;
61
62 /* Internal buffers */
63 float** inputFrameTD;
64 float** outputFrameTD;
65
66 /* internal */
67 void* hTVConv;
70 int host_fs;
74 int ir_fs;
75 float** irs;
77 int ir_length;
78
79 /* positions */
81 int nListenerPositions;
84 int position_idx;
85 vectorND sourcePosition;
86
87 /* flags/status */
88 CODEC_STATUS codecStatus;
89 float progressBar0_1;
90 char* progressBarText;
91 PROC_STATUS procStatus;
92
93 /* user parameters */
95 vectorND targetPosition;
96 char* sofa_filepath;
97 SAF_TVCONV_ERROR_CODES sofa_file_error;
98
100
101/* ========================================================================== */
102/* Internal Functions */
103/* ========================================================================== */
104
106void tvconv_setCodecStatus(void* const hTVCnv,
107 CODEC_STATUS newStatus);
109void tvconv_findNearestNeigbour(void* const hTVCnv);
110
115void tvconv_setMinMaxDimensions(void* const hTVCnv);
116
117
118#ifdef __cplusplus
119} /* extern "C" { */
120#endif /* __cplusplus */
121
122#endif /* __TVCONV_INTERNAL_H_INCLUDED__ */
PROC_STATUS
Current status of the processing loop.
Definition _common.h:219
CODEC_STATUS
Current status of the codec.
Definition _common.h:201
Main include header for the Spatial_Audio_Framework (SAF)
Include header for SAF externals.
Main structure for tvconv
int host_fs
current samplerate of the host
int nOutputChannels
number of output channels (same as the number of channels in the loaded wav)
int reInitFilters
FLAG: 0: do not reinit, 1: reinit, 2: reinit in progress.
int hostBlockSize
current host block size
float ** irs
npositionsx x (FLAT: nfilters x filter_length)
int nIrChannels
number of filters per position
vectorND minDimensions
Minimum values across all dimensions.
int hostBlockSize_clamped
Clamped between MIN and MAX_FRAME_SIZE.
void * hTVConv
saf_TVConv handle
int nInputChannels
number of input channels
vectorND maxDimensions
Maximum values across all dimensions.
vectorND * listenerPositions
The listener positions; nListenerPositions x 3.
A time-varying multi-channel convolver.
SAF_TVCONV_ERROR_CODES
SOFA loader error codes.
Definition tvconv.h:34
float vectorND[NUM_DIMENSIONS]
Structure for a vector.
void tvconv_findNearestNeigbour(void *const hTVCnv)
Finds the index holding the nearest neigbour to the selected position.
void tvconv_setCodecStatus(void *const hTVCnv, CODEC_STATUS newStatus)
Sets codec status (see CODEC_STATUS enum)
void tvconv_setMinMaxDimensions(void *const hTVCnv)
Sets the smallest and the highest position of each dimension from the list of positions.