more
[ICEs.git] / 218158 / af_volnorm.i.4
1 typedef struct af_data_s {
2 } af_data_t;
3 typedef struct af_info_s {
4 int (*open) (struct af_instance_s * vf);
5 } af_info_t;
6 typedef struct af_instance_s {
7 af_data_t *(*play) (struct af_instance_s * af, af_data_t * data);
8 void *setup;
9 } af_instance_t;
10 typedef struct af_volume_s {
11 float mul;
12 struct {
13 float avg;
14 int len;
15 } *mem;
16 float mid_s16;
17 } af_volnorm_t;
18 void method2_int16(af_volnorm_t * s, af_data_t * c)
19 {
20 register int i = 0;
21 float avg = 0.0;
22 for (i = 0; i < 100; ++i)
23 avg += s->mem[i].avg * (float)s->mem[i].len;
24 s->mul = avg;
25 }
26 void play(struct af_instance_s *af, af_data_t * data)
27 {
28 af_volnorm_t *s = af->setup;
29 method2_int16(s, data);
30 }
31 void af_open(af_instance_t * af)
32 {
33 af->play = play;
34 }
35
36 af_info_t af_info_volnorm = {
37 af_open
38 };