2 (c)2006 MPlayer / Reynaldo H. Verdejo Pinochet
3 Based on code by Alex Beregszaszi for his 'center' filter
7 Simple voice removal filter
16 // Data for specific instances of this filter
18 // Initialization and runtime control
19 static int control(struct af_instance_s
* af
, int cmd
, void* arg
)
22 case AF_CONTROL_REINIT
:
23 af
->data
->rate
= ((af_data_t
*)arg
)->rate
;
24 af
->data
->nch
= ((af_data_t
*)arg
)->nch
;
25 af
->data
->format
= AF_FORMAT_FLOAT_NE
;
27 return af_test_output(af
,(af_data_t
*)arg
);
33 static void uninit(struct af_instance_s
* af
)
39 // Filter data through filter
40 static af_data_t
* play(struct af_instance_s
* af
, af_data_t
* data
)
42 af_data_t
* c
= data
; // Current working data
43 float* a
= c
->audio
; // Audio data
44 int len
= c
->len
/4; // Number of samples in current audio block
45 int nch
= c
->nch
; // Number of channels
49 FIXME1 add a low band pass filter to avoid suppressing
51 FIXME2 better calculated* attenuation factor
56 a
[i
] = (a
[i
] - a
[i
+1]) * 0.7;
63 // Allocate memory and set function pointers
64 static int af_open(af_instance_t
* af
){
65 af
->control
= control
;
69 af
->data
= calloc(1,sizeof(af_data_t
));
77 // Description of this filter
78 af_info_t af_info_karaoke
= {
79 "Simple karaoke/voice-removal audio filter",
81 "Reynaldo H. Verdejo Pinochet",
83 AF_FLAGS_NOT_REENTRANT
,