initial import
[ICEs.git] / 218158 / af_volnorm.i.4
CommitLineData
45516216 1typedef struct af_data_s {
2} af_data_t;
3typedef struct af_info_s {
4 int (*open) (struct af_instance_s * vf);
5} af_info_t;
6typedef 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;
10typedef 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;
18void 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}
26void play(struct af_instance_s *af, af_data_t * data)
27{
28 af_volnorm_t *s = af->setup;
29 method2_int16(s, data);
30}
31void af_open(af_instance_t * af)
32{
33 af->play = play;
34}
35
36af_info_t af_info_volnorm = {
37 af_open
38};