1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
/* LV2 convolution engine
*
* Copyright (C) 2012 Robin Gareus <robin@gareus.org>
*
* Modified for C++:
* Copyright (C) 2017 Damien Zammit <damien@zamaudio.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef CONVOLUTION_H_
#define CONVOLUTION_H_
#include "../../lib/zita-convolver-4.0.0/zita-convolver.h"
#define MAX_CHANNEL_MAPS (4)
#define VERBOSE_printf(x, ...)
class LV2convolv {
public:
Convproc *convproc;
char *ir_fn;
int ir_preset;
unsigned int chn_inp[MAX_CHANNEL_MAPS];
unsigned int chn_out[MAX_CHANNEL_MAPS];
unsigned int ir_chan[MAX_CHANNEL_MAPS];
unsigned int ir_delay[MAX_CHANNEL_MAPS];
float ir_gain[MAX_CHANNEL_MAPS];
/* convolution settings*/
unsigned int size;
float density;
/* process settings */
unsigned int fragment_size;
/* static methods */
static int resample_read_presets (const float *in, unsigned int in_frames, const int sample_rate, float **buf, unsigned int *n_ch, unsigned int *n_sp);
static void silent_output(float * const * outbuf, size_t n_channels, size_t n_samples);
/* convolution specific methods */
LV2convolv();
~LV2convolv();
void clv_alloc(void);
void clv_release (void);
void clv_clone_settings(LV2convolv *clv_new);
void clv_free (void);
int clv_configure (const char *key, const char *value);
char *clv_dump_settings (void);
int clv_query_setting (const char *key, char *value, size_t val_max_len);
int clv_initialize (
const unsigned int sample_rate,
const unsigned int in_channel_cnt,
const unsigned int out_channel_cnt,
const unsigned int buffersize
);
int clv_is_active (void);
int clv_convolve (
const float * const * inbuf,
float * const * outbuf,
const unsigned int in_channel_cnt,
const unsigned int out_channel_cnt,
const unsigned int n_samples,
const float output_gain
);
};
#endif
|