-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathvirtual_bass.h
59 lines (46 loc) · 1.52 KB
/
virtual_bass.h
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
/*
Virtual bass plugin for DeaDBeeF
Copyright (C) 2015 Alexey Porotnikov <alexey.porotnikov@gmail.com>
The MIT License (MIT)
*/
#ifndef VIRTUAL_BASS_H_
#define VIRTUAL_BASS_H_
#include <deadbeef/deadbeef.h>
enum {
VIRTUAL_BASS_PARAM_CUTOFF,
VIRTUAL_BASS_PARAM_LEVEL,
VIRTUAL_BASS_PARAM_COUNT
};
#define N_STAGES 3
#define N_CHANNELS 2
typedef struct {
float a0, a1, a2, b0, b1, b2;
} biquad_z_coefs;
typedef struct {
float A, B, C, D, E, F;
} biquad_s_coefs;
typedef struct {
float x1, x2, y1, y2;
} biquad_buffer;
typedef struct {
ddb_dsp_context_t ctx;
int samplerate;
biquad_z_coefs coefs[N_STAGES];
biquad_buffer lpf_buffer[N_CHANNELS][N_STAGES];
int cutoff;
float level;
} ddb_virtual_bass_t;
ddb_dsp_context_t *virtual_bass_open(void);
void virtual_bass_close(ddb_dsp_context_t *ctx);
int virtual_bass_num_params(void);
void virtual_bass_set_param(ddb_dsp_context_t *ctx, int p, const char *val);
void virtual_bass_get_param(ddb_dsp_context_t *ctx, int p, char *val, int sz);
void bilinear_biquad_design_lpf(biquad_z_coefs *out, const biquad_s_coefs *in,
float omega);
void biquad_reset(biquad_buffer *buf);
float biquad_process(biquad_buffer *buf, const biquad_z_coefs *coefs, float x);
void lpf_butterworth6_design(biquad_z_coefs *coefs, int samplerate, int cutout);
float lpf_butterworth6_process(biquad_buffer *buf, const biquad_z_coefs *coefs,
float x);
float shaitan_function(float x);
#endif // VIRTUAL_BASS_H_