initial import
[ICEs.git] / 218158 / af_volnorm.i.3
1 typedef struct af_data_s {
2 } af_data_t;
3 typedef struct af_info_s {
4 const char *info;
5 const char *name;
6 const char *author;
7 const char *comment;
8 const int flags;
9 int (*open) (struct af_instance_s * vf);
10 } af_info_t;
11 typedef struct af_instance_s {
12 af_data_t *(*play) (struct af_instance_s * af, af_data_t * data);
13 void *setup;
14 } af_instance_t;
15 typedef struct af_volume_s {
16 float mul;
17 struct {
18 float avg;
19 int len;
20 } mem[128];
21 float mid_s16;
22 } af_volnorm_t;
23 static void method2_int16(af_volnorm_t * s, af_data_t * c)
24 {
25 register int i = 0;
26 float avg = 0.0;
27 for (i = 0; i < 128; i++)
28 avg += s->mem[i].avg * (float)s->mem[i].len;
29 s->mul = s->mid_s16 / avg;
30 }
31 static af_data_t *play(struct af_instance_s *af, af_data_t * data)
32 {
33 af_volnorm_t *s = af->setup;
34 method2_int16(s, data);
35 }
36 static int af_open(af_instance_t * af)
37 {
38 af->play = play;
39 }
40
41 af_info_t af_info_volnorm = {
42 "Volume normalizer filter", "volnorm",
43 "Alex Beregszaszi & Pierre Lombard", "", 0x00000001, af_open
44 };