Changeset 682:6cf3ae19ffd3 in roaraudio
- Timestamp:
- 08/27/08 15:46:45 (16 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
roarclients/roarfilt.c
r669 r682 24 24 25 25 #include <roaraudio.h> 26 #include <libroardsp/libroardsp.h> 26 27 #include <math.h> 27 28 … … 49 50 " --div VAL - Set div\n" 50 51 " --lowpass freq - lowpass filter\n" 52 " --filter name - add filter name\n" 53 " --ffreq freq - set filter freq\n" 51 54 ); 52 55 … … 131 134 float lp = 0; 132 135 char buf[BUFSIZE]; 136 struct roardsp_filterchain fc; 137 struct roardsp_filter filter; 138 struct roar_stream stream; 133 139 134 140 memset(&g_lowpass, 0, sizeof(g_lowpass)); 141 142 roardsp_fchain_init(&fc); 135 143 136 144 for (i = 1; i < argc; i++) { … … 162 170 g_lowpass.a = 65536 - lp; 163 171 // printf("lowpass: A=%i, B=%i\n", g_lowpass.a, g_lowpass.b); 172 } else if ( strcmp(k, "--filter") == 0 ) { 173 stream.info.channels = channels; 174 stream.info.bits = bits; 175 stream.info.rate = rate; 176 roardsp_filter_init(&filter, &stream, roardsp_filter_str2id(argv[++i])); 177 roardsp_fchain_add(&fc, &filter); 178 } else if ( strcmp(k, "--ffreq") == 0 ) { 179 lp = atof(argv[++i]); 180 roardsp_filter_ctl(&filter, ROARDSP_FCTL_FREQ, &lp); 164 181 } else if ( strcmp(k, "--help") == 0 ) { 165 182 usage(); … … 177 194 } 178 195 179 if ( mul == div && logscale == 0 && lp== 0 ) {196 if ( mul == div && logscale == 0 && g_lowpass.a == 0 && roardsp_fchain_num(&fc) == 0 ) { 180 197 fprintf(stderr, "Error: filter is useless!\n"); 181 198 return 0; … … 190 207 if ( g_lowpass.a ) 191 208 lowpass2((void*)buf, i, channels); 209 roardsp_fchain_calc(&fc, (void*)buf, (8*i)/bits); 192 210 if (write(fh, buf, i) != i) 193 211 break; … … 206 224 roar_simple_close(fh); 207 225 226 roardsp_fchain_uninit(&fc); 227 208 228 return 0; 209 229 }
Note: See TracChangeset
for help on using the changeset viewer.