annotate libaf/af_equalizer.c @ 8085:ce06bf810d5a

Simpler.
author rguyom
date Sun, 03 Nov 2002 15:56:58 +0000
parents c0e556f9986b
children e8832e66babd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8073
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
1 /*=============================================================================
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
2 //
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
3 // This software has been released under the terms of the GNU Public
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
4 // license. See http://www.gnu.org/copyleft/gpl.html for details.
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
5 //
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
6 // Copyright 2001 Anders Johansson ajh@atri.curtin.edu.au
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
7 //
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
8 //=============================================================================
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
9 */
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
10
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
11 /* Equalizer filter, implementation of a 10 band time domain graphic
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
12 equalizer using IIR filters. The IIR filters are implemented using a
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
13 Direct Form II approach, but has been modified (b1 == 0 always) to
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
14 save computation.
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
15 */
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
16
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
17 #include <stdio.h>
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
18 #include <stdlib.h>
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
19
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
20 #include <unistd.h>
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
21 #include <inttypes.h>
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
22 #include <math.h>
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
23
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
24 #include "../config.h"
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
25 #include "../mp_msg.h"
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
26 #include "../libao2/afmt.h"
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
27
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
28 #include "af.h"
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
29 #include "equalizer.h"
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
30
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
31 #define NCH 6 // Max number of channels
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
32 #define L 2 // Storage for filter taps
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
33 #define KM 10 // Max number of bands
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
34
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
35 #define Q 1.2247449 /* Q value for band-pass filters 1.2247=(3/2)^(1/2)
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
36 gives 4dB suppression @ Fc*2 and Fc/2 */
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
37
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
38 // Center frequencies for band-pass filters
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
39 #define CF {31.25,62.5,125,250,500,1000,2000,4000,8000,16000}
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
40
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
41 // Maximum and minimum gain for the bands
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
42 #define G_MAX +12.0
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
43 #define G_MIN -12.0
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
44
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
45 // Data for specific instances of this filter
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
46 typedef struct af_equalizer_s
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
47 {
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
48 float a[KM][L]; // A weights
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
49 float b[KM][L]; // B weights
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
50 float wq[NCH][KM][L]; // Circular buffer for W data
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
51 float g[NCH][KM]; // Gain factor for each channel and band
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
52 int K; // Number of used eq bands
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
53 int channels; // Number of channels
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
54 } af_equalizer_t;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
55
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
56 // 2nd order Band-pass Filter design
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
57 static void bp2(float* a, float* b, float fc, float q){
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
58 double th= 2.0 * M_PI * fc;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
59 double C = (1.0 - tan(th*q/2.0))/(1.0 + tan(th*q/2.0));
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
60
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
61 a[0] = (1.0 + C) * cos(th);
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
62 a[1] = -1 * C;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
63
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
64 b[0] = (1.0 - C)/2.0;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
65 b[1] = -1.0050;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
66 }
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
67
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
68 // Initialization and runtime control
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
69 static int control(struct af_instance_s* af, int cmd, void* arg)
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
70 {
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
71 af_equalizer_t* s = (af_equalizer_t*)af->setup;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
72
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
73 switch(cmd){
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
74 case AF_CONTROL_REINIT:{
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
75 int k =0;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
76 float F[KM] = CF;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
77
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
78 // Sanity check
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
79 if(!arg) return AF_ERROR;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
80
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
81 af->data->rate = ((af_data_t*)arg)->rate;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
82 af->data->nch = ((af_data_t*)arg)->nch;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
83 af->data->format = AFMT_S16_LE;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
84 af->data->bps = 2;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
85
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
86 // Calculate number of active filters
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
87 s->K=KM;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
88 while(F[s->K-1] > (float)af->data->rate/2.0)
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
89 s->K--;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
90
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
91 // Generate filter taps
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
92 for(k=0;k<s->K;k++)
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
93 bp2(s->a[k],s->b[k],F[k]/((float)af->data->rate),Q);
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
94
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
95 // Calculate how much this plugin adds to the overall time delay
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
96 af->delay += 2000.0/((float)af->data->rate);
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
97
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
98 // Only AFMT_S16_LE is supported
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
99 if(af->data->format != ((af_data_t*)arg)->format ||
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
100 af->data->bps != ((af_data_t*)arg)->bps)
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
101 return AF_FALSE;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
102 return AF_OK;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
103 }
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
104 case AF_CONTROL_COMMAND_LINE:{
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
105 float g[10]={0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0};
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
106 int i,j;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
107 sscanf((char*)arg,"%f:%f:%f:%f:%f:%f:%f:%f:%f:%f", &g[0], &g[1],
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
108 &g[2], &g[3], &g[4], &g[5], &g[6], &g[7], &g[8] ,&g[9]);
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
109 for(i=0;i<NCH;i++){
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
110 for(j=0;j<KM;j++){
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
111 ((af_equalizer_t*)af->setup)->g[i][j] =
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
112 pow(10.0,clamp(g[j],G_MIN,G_MAX)/20.0)-1.0;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
113 }
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
114 }
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
115 return AF_OK;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
116 }
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
117 case AF_CONTROL_EQUALIZER_SET_GAIN:{
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
118 float gain = ((equalizer_t*)arg)->gain;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
119 int ch = ((equalizer_t*)arg)->channel;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
120 int band = ((equalizer_t*)arg)->band;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
121 if(ch > NCH || ch < 0 || band > KM || band < 0)
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
122 return AF_ERROR;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
123
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
124 s->g[ch][band] = pow(10.0,clamp(gain,G_MIN,G_MAX)/20.0)-1.0;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
125 return AF_OK;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
126 }
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
127 case AF_CONTROL_EQUALIZER_GET_GAIN:{
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
128 int ch =((equalizer_t*)arg)->channel;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
129 int band =((equalizer_t*)arg)->band;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
130 if(ch > NCH || ch < 0 || band > KM || band < 0)
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
131 return AF_ERROR;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
132
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
133 ((equalizer_t*)arg)->gain = log10(s->g[ch][band]+1.0) * 20.0;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
134 return AF_OK;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
135 }
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
136 }
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
137 return AF_UNKNOWN;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
138 }
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
139
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
140 // Deallocate memory
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
141 static void uninit(struct af_instance_s* af)
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
142 {
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
143 if(af->data)
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
144 free(af->data);
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
145 if(af->setup)
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
146 free(af->setup);
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
147 }
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
148
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
149 // Filter data through filter
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
150 static af_data_t* play(struct af_instance_s* af, af_data_t* data)
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
151 {
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
152 af_data_t* c = data; // Current working data
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
153 af_equalizer_t* s = (af_equalizer_t*)af->setup; // Setup
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
154 uint32_t ci = af->data->nch; // Index for channels
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
155 uint32_t nch = af->data->nch; // Number of channels
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
156
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
157 while(ci--){
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
158 float* g = s->g[ci]; // Gain factor
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
159 int16_t* in = ((int16_t*)c->audio)+ci;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
160 int16_t* out = ((int16_t*)c->audio)+ci;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
161 int16_t* end = in + c->len/2; // Block loop end
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
162
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
163 while(in < end){
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
164 register uint32_t k = 0; // Frequency band index
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
165 register float yt = (float)(*in); // Current input sample
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
166 in+=nch;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
167
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
168 // Run the filters
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
169 for(;k<s->K;k++){
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
170 // Pointer to circular buffer wq
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
171 register float* wq = s->wq[ci][k];
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
172 // Calculate output from AR part of current filter
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
173 register float w=yt*s->b[k][0] + wq[0]*s->a[k][0] + wq[1]*s->a[k][1];
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
174 // Calculate output form MA part of current filter
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
175 yt+=(w + wq[1]*s->b[k][1])*g[k];
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
176 // Update circular buffer
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
177 wq[1] = wq[0];
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
178 wq[0] = w;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
179 }
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
180 // Calculate output
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
181 *out=(int16_t)(yt/(4.0*10.0));
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
182 out+=nch;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
183 }
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
184 }
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
185 return c;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
186 }
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
187
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
188 // Allocate memory and set function pointers
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
189 static int open(af_instance_t* af){
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
190 af->control=control;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
191 af->uninit=uninit;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
192 af->play=play;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
193 af->mul.n=1;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
194 af->mul.d=1;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
195 af->data=calloc(1,sizeof(af_data_t));
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
196 af->setup=calloc(1,sizeof(af_equalizer_t));
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
197 if(af->data == NULL || af->setup == NULL)
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
198 return AF_ERROR;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
199 return AF_OK;
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
200 }
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
201
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
202 // Description of this filter
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
203 af_info_t af_info_equalizer = {
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
204 "Equalizer audio filter",
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
205 "equalizer",
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
206 "Anders",
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
207 "",
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
208 AF_FLAGS_NOT_REENTRANT,
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
209 open
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
210 };
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
211
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
212
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
213
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
214
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
215
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
216
c0e556f9986b Adding equalizer filter + some cosmetics
anders
parents:
diff changeset
217