bpmdsp/print_filter.c

Go to the documentation of this file.
00001 
00006 #include "bpm/bpm_dsp.h"
00007 
00008 void print_filter( FILE *of, filter_t *f ) {
00009 
00010   int i = 0;
00011 
00012   if ( ! of || ! f ) {
00013     bpm_error( "Invalid pointer in print_filter()", __FILE__, __LINE__  );
00014     return;
00015   }
00016 
00017   fprintf( of, "Filter: %s\n", f->name );
00018 
00019   // print some more bla bla here if i find the time...
00020 
00021   print_filter_representation( of, f->cplane );
00022   fprintf( of, "\n" );
00023 
00024   fprintf( of, " - filter gains: %s\n", f->name );
00025   fprintf( of, "   DC mag= %f, phase= %f pi\n", c_abs(f->dc_gain), c_arg(f->dc_gain)/PI );
00026   fprintf( of, "   FC mag= %f, phase= %f pi\n", c_abs(f->fc_gain), c_arg(f->fc_gain)/PI );
00027   fprintf( of, "   HF mag= %f, phase= %f pi\n", c_abs(f->hf_gain), c_arg(f->hf_gain)/PI );
00028   fprintf( of, "\n" );
00029 
00030   fprintf( of, " - Recurrence relation :\n" );
00031   fprintf( of, "   y[n] = \n" );
00032   for ( i=0; i<f->nxc; i++ ) {
00033     if ( fabs( f->xc[i]) > FILT_EPS ) {
00034       fprintf( of, "        %s %14.10f * x[n-%d]\n", 
00035                f->xc[i]>=0.?"+":"-", fabs(f->xc[i]), f->nxc-1-i );
00036     }
00037   }
00038 
00039   for ( i=0; i<f->nyc-1; i++ ) {
00040     if ( fabs(f->yc[i]) > FILT_EPS ) {
00041       fprintf( of, "        %s %14.10f * y[n-%d]\n", f->yc[i]>=0.?"+":"-", 
00042                fabs(f->yc[i]), f->nyc-1-i );
00043     }
00044   }
00045 
00046   fprintf( of, "\n" );
00047 
00048   return;
00049 }

Generated on Fri Nov 9 21:17:10 2007 for libbpm by  doxygen 1.5.1