optek_hifi2_ebass.h
4.44 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/*
Optek EBASS
Copyright by Optek in May 24, 2016
*/
//#include "optek_vol_table.h"
#ifndef _OPTEK_HIFI2_EBASS_H
#define _OPTEK_HIFI2_EBASS_H
/*
input->no input
return->string of optek_ebass build date,time and version
*/
const char *optek_ebass_data_get(void);
const char *optek_ebass_time_get(void);
const char *optek_ebass_version_get(void);
//#define OPTEK_NLD_INTEGRATOR
#define OPTEK_EBASS_ATTACK_THESHOLD 0x7ffc3a50 //-0.999db
#define OPTEK_EBASS_RELEASE_THESHOLD 0x7100c4d8 //-1.0db
#define OPTEK_EBASS_ATTACK_RATE OPTEK_DRC_ATTACK_RATE_0P1DB
#define OPTEK_EBASS_RELEASE_RATE OPTEK_DRC_RELEASE_RATE_0P1DB
//The following Integrator Factor: input signal >= -62db NLD works, <-62db->zero out
#define INTEGRATOR_FACTOR_44100 0x0144960c //-40db //0x0066a4a5; //-50db, not overflow for 70Hz/-3db sine wave
#define INTEGRATOR_FACTOR_48000 0x0144960c //-40db //-50db, not overflow for 70Hz/-3db sine wave
#define INTEGRATOR_FACTOR_88200 (INTEGRATOR_FACTOR_44100/2) //-56db, not overflow for 70Hz sine wave
#define INTEGRATOR_FACTOR_96000 (INTEGRATOR_FACTOR_48000/2) //-56db, not overflow for 70Hz sine wave
#define OPTEK_EBASS_MIN_FREQ_SAMPLES 3000 /*48 * 16/1000, 16Hz*/
#define NLD_RISE_TIME ((int) (2147483648*0.1))
//#define NLD_FALL_TIME ((int) (2147483648*0.002))
//#define NLD_FALL_TIME ((int) (2147483648*0.003))
#define NLD_FALL_TIME ((int) (2147483648*0.004))
//#define NLD_FALL_TIME ((int) (2147483648*0.005))
/*
input->no input
return->string of optek_drc version
*/
const char *optek_ebass_get_version (void);
/*
input no
return->how many bytes needed for optek_drc
*/
int optek_ebass_alloc(void);
void optek_ebass_init (void);
#ifdef OPTEK_NLD_INTEGRATOR
/*
handle->optek_ebass handle
integrator_factor->integrator factor
attack_threshold->DRC attack level
release_threshold->DRC release level, should be < attack_threshold,
it is better = attack_threshold * down_rate (for example 1db) and it is better several times (for example 4 or 6) of attack_rate
attack_rate->in attack phase, drc_vol = drc_vol * attack_rate, it should be < 0db
release_rate->in release phase, drc_vol = drc_vol * release_rate, it should be > 0db
lev_detect_release_time->level detect release time, it should be < 0db,
it depends on input signal frequency, for example 1kHz signal, 0.04db down is ok, for 100Hz, 0.004db down is ok
update_samples->DRC update time, about 1ms samples
return->no return
*/
void optek_ebass_set (void *handle, int integrator_factor, uint32_t min_freq_cn, int attack_threshold, int release_threshold, int attack_rate, int release_rate,
int lev_detect_release_time,
uint8_t update_samples);
/*
objmem->mem allocated for optek_drc
integrator_factor->integrator factor
attack_threshold->DRC attack level
release_threshold->DRC release level, should be < attack_threshold,
it is better = attack_threshold * down_rate (for example 1db) and it is better several times (for example 4 or 6) of attack_rate
attack_rate->in attack phase, drc_vol = drc_vol * attack_rate, it should be < 0db
release_rate->in release phase, drc_vol = drc_vol * release_rate, it should be > 0db
lev_detect_release_time->level detect release time, it should be < 0db,
it depends on input signal frequency, for example 1kHz signal, 0.04db down is ok, for 100Hz, 0.004db down is ok
update_samples->DRC update time, about 1ms samples
return->optek_ebass ptr
*/
void * optek_ebass_open (void * objmem, int integrator_factor, uint32_t min_freq_cn,
int attack_threshold, int release_threshold, int attack_rate, int release_rate, int lev_detect_release_time,
uint8_t update_samples);
/*
handle->optek_ebass ptr
integrator_factor->integrator factor
return->no return
*/
void optek_ebass_reinit (void *handle,int integrator_factor);
#else //OPTEK_NLD_INTEGRATOR
/*
objmem->mem allocated for optek_drc
rise_t->NLD rise time
fall_t->NLD fall time
return->optek_ebass ptr
*/
void * optek_ebass_open (void * objmem, int rise_t, int fall_t);
/*
handle->optek_ebass handle
rise_t->NLD rise time
fall_t->NLD fall time
return->no return
*/
void optek_ebass_set (void *handle, int rise_t, int fall_t);
#endif //OPTEK_NLD_INTEGRATOR
/*
handle->optek_ebass ptr
r->output
x->input
hpf->hpf filter ptr
lpf->lpf filter ptr
N->samples (L sampes + R samples for stereo)
return void
*/
void optek_ebass_NLD (void * handle, int *r, int *x, void *ebass_band, int N);
#endif //_OPTEK_HIFI2_EBASS_H