initial import
[ICEs.git] / 218158 / af_volnorm.i.3
CommitLineData
45516216 1typedef struct af_data_s {
2} af_data_t;
3typedef 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;
11typedef 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;
15typedef 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;
23static 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}
31static 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}
36static int af_open(af_instance_t * af)
37{
38 af->play = play;
39}
40
41af_info_t af_info_volnorm = {
42 "Volume normalizer filter", "volnorm",
43 "Alex Beregszaszi & Pierre Lombard", "", 0x00000001, af_open
44};