optek_hifi2_drc_vol.h
4.67 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
143
144
145
146
147
148
149
150
151
152
153
154
155
/*
Optek DRC & VOL
Copyright by Optek in June 9, 2016
*/
#ifndef _OPTEK_HIFI2_DRC_VOL_H
#define _OPTEK_HIFI2_DRC_VOL_H
/*
input->no input
return->string of optek_drc_vol build date,time and version
*/
const char *optek_drc_vol_data_get(void);
const char *optek_drc_vol_time_get(void);
const char *optek_drc_vol_version_get(void);
/*
input no
return->how many bytes needed for optek_drc
*/
int optek_drc_vol_alloc(void);
void optek_drc_vol_init (void);
/*
objmem->mem allocated for optek_drc_vol
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
clipping_enable-> 0 means no clipping, 1 means clipping
update_samples->DRC update time, about 1ms samples
return->return optek_drc_vol handle
*/
void * optek_drc_vol_open (void * objmem, int attack_threshold, int release_threshold, int attack_rate, int release_rate, int lev_detect_release_time,
uint8_t clipping_enable, uint8_t update_samples);
/*
handle->optek_drc_vol handle
master_vol->real vol = master_vol * vol, for different applications
vol_init_L->int vol for chan L
vol_init_R->int vol for chan R
up_rate->soft vol up step, should > 0db, vol* up_rate
down_rate->soft vol down step, should <0db, vol * down_rate
post_scale->0, not support post scale; 1, support post scale
L_R_same_vol->for soft vol, 0 means L/R vol is not same, 1 means L/R vol is same
return->no return
*/
void optek_drc_vol_open_vol (void * handle, int master_vol, int vol_init_L, int vol_init_R, int up_rate,
int down_rate, uint8_t post_scale, uint8_t L_R_same_vol);
/*
handle->optek_drc_vol handle
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
clipping_enable-> 0 means no clipping, 1 means clipping
update_samples->DRC update time, about 1ms samples
attack_hold_samples -> attack hold time,unit is samples
return->no return
*/
void optek_drc_vol_set_drc (void *handle, int attack_threshold, int release_threshold, int attack_rate, int release_rate,
int lev_detect_release_time,
uint8_t clipping_enable, uint8_t update_samples,uint32_t attack_hold_samples);
/*
handle->optek_drc_vol handle
return->no return
*/
void optek_drc_vol_set_mute_on (void *handle);
/*
handle->optek_drc_vol handle
return->no return
*/
void optek_drc_vol_set_mute_off (void *handle);
/*
handle->optek_drc_vol handle
vol_L->L vol
vol_R->R vol
return->no return
*/
void optek_drc_vol_set_vol (void *handle, int vol_L, int vol_R);
/*
handle->optek_drc_vol handle
master_vol->master vol
return->no return
*/
void optek_drc_vol_set_master_vol (void *handle, int master_vol);
/*
handle->optek_drc_vol handle
update_samples->update time
return->no return
*/
void optek_drc_vol_set_update_samples (void *handle, int update_samples);
/*
when opening, vol update time is same with drc update time
handle->optek_drc_vol handle
update_samples->update vol_time
return->no return
*/
void optek_drc_vol_set_vol_update_samples (void *handle, int update_samples);
/*
handle->optek_drc_vol handle
up_rate->vol up change rate
down_rate->vol down change rate
return->no return
*/
void optek_drc_vol_set_rate (void *handle, int up_rate, int down_rate);
/*
handle->optek_drc_vol
x->input
r->output
N->samples (L sampes + R samples for stereo)
return void
*/
//MCPS:3.69 Average: 3.73 Peak: 4.09
void optek_drc_zdt_vol_stereo_24b_process (void *handle, const int *x, int *r, int N) OPTEK_HIFI2_DSP_ATTIB;
/*
handle->optek_drc_vol
x->input
r->output
N->samples (L sampes + R samples for stereo)
return void
*/
//MCPS: 2.95 Average: 2.98 Peak: 3.24
void optek_drc_soft_vol_stereo_24b_process (void *handle, const int *x, int *r, int N) OPTEK_HIFI2_DSP_ATTIB;
#endif //_OPTEK_HIFI2_DRC_VOL_H