SAF
Loading...
Searching...
No Matches
decorrelator_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
27#ifndef __DECORRELATOR_INTERNAL_H_INCLUDED__
28#define __DECORRELATOR_INTERNAL_H_INCLUDED__
29
30#include "decorrelator.h" /* Include header for this example */
31#include "saf.h" /* Main include header for SAF */
32#include "saf_externals.h" /* To also include SAF dependencies (cblas etc.) */
33
34#ifdef __cplusplus
35extern "C" {
36#endif /* __cplusplus */
37
38/* ========================================================================== */
39/* Internal Parameters */
40/* ========================================================================== */
41
42#if !defined(DECORRELATOR_FRAME_SIZE)
43# if defined(FRAME_SIZE) /* Use the global framesize if it is specified: */
44# define DECORRELATOR_FRAME_SIZE ( FRAME_SIZE )
45# else /* Otherwise, the default framesize for this example is: */
46# define DECORRELATOR_FRAME_SIZE ( 128 )
47# endif
48#endif
49#define HOP_SIZE ( 128 )
50#define HYBRID_BANDS ( HOP_SIZE + 5 )
51#define TIME_SLOTS ( DECORRELATOR_FRAME_SIZE / HOP_SIZE )
53/* Checks: */
54#if (DECORRELATOR_FRAME_SIZE % HOP_SIZE != 0)
55# error "DECORRELATOR_FRAME_SIZE must be an integer multiple of HOP_SIZE"
56#endif
57
58/* ========================================================================== */
59/* Structures */
60/* ========================================================================== */
61
66typedef struct _decorrelator
67{
68 /* audio buffers + afSTFT time-frequency transform handle */
69 int fs;
70 float** InputFrameTD;
71 float** OutputFrameTD;
72 float_complex*** InputFrameTF;
73 float_complex*** transientFrameTF;
74 float_complex*** OutputFrameTF;
75 void* hSTFT;
77 float freqVector[HYBRID_BANDS];
79 /* our codec configuration */
80 void* hDecor;
81 void* hDucker;
86 /* internal variables */
90 /* user parameters */
97
98
99/* ========================================================================== */
100/* Internal Functions */
101/* ========================================================================== */
102
106void decorrelator_setCodecStatus(void* const hDecor,
107 CODEC_STATUS newStatus);
108
109
110#ifdef __cplusplus
111} /* extern "C" { */
112#endif /* __cplusplus */
113
114#endif /* __DECORRELATOR_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
#define HYBRID_BANDS
Number of frequency bands.
A multi-channel decorrelator.
void decorrelator_setCodecStatus(void *const hDecor, CODEC_STATUS newStatus)
Sets codec status.
Main include header for the Spatial_Audio_Framework (SAF)
Include header for SAF externals.
Main structure for decorrelator.
int fs
host sampling rate
int enableTransientDucker
1: transient extractor is enabled, 0: disabled
float ** InputFrameTD
Input time-domain signals; MAX_NUM_CHANNELS x DECORRELATOR_FRAME_SIZE.
int new_nChannels
New number of input/output channels (current value will be replaced by this after next re-init)
float progressBar0_1
Current (re)initialisation progress, between [0..1].
CODEC_STATUS codecStatus
see CODEC_STATUS
float_complex *** InputFrameTF
Input time-frequency domain signals; HYBRID_BANDS x MAX_NUM_CHANNELS x TIME_SLOTS.
float decorAmount
The mix between decorrelated signals and the input signals [0..1], 1: fully decorrelated 0: bypassed.
float_complex *** transientFrameTF
Transient time-frequency domain signals; HYBRID_BANDS x MAX_NUM_CHANNELS x TIME_SLOTS.
void * hSTFT
afSTFT handle
char * progressBarText
Current (re)initialisation step, string.
float ** OutputFrameTD
Output time-domain signals; MAX_NUM_CHANNELS x DECORRELATOR_FRAME_SIZE.
int afSTFTdelay
for host delay compensation
void * hDucker
Transient extractor/Ducker handle.
int nChannels
Current number of input/output channels.
int compensateLevel
1: apply a sqrt(nChannels)/nChannels scaling on the output signals, 0: disabled
float_complex *** OutputFrameTF
Output time-frequency domain signals; HYBRID_BANDS x MAX_NUM_CHANNELS x TIME_SLOTS.
PROC_STATUS procStatus
see PROC_STATUS
void * hDecor
Decorrelator handle.