bpmprocess/downmix_waveform.c

Go to the documentation of this file.
00001 
00006 #include <math.h>
00007 #include <bpm/bpm_messages.h>
00008 #include <bpm/bpm_process.h>
00009 
00021 int downmix_waveform( double *wf, int ns, double fs, double freq, double t0, double **out ) {
00022 
00023 
00024   int i;
00025   double ti, ped, rms;
00026 
00027   if ( ! wf || ! out ) {
00028     bpm_error( "Invalid pointer arguments in downmix_waveform(...)",
00029                __FILE__, __LINE__ );
00030     return BPM_FAILURE;
00031   }
00032 
00033   // get pedestal
00034   //if ( get_pedestal( wf, ns, 20, &ped, &rms ) == BPM_FAILURE ) {
00035   //  bpm_error( "Unable to retreive the pedestal in downmix_waveform(...)",
00036   //           __FILE__, __LINE__ );
00037   //  return BPM_FAILURE;
00038   //}
00039 
00040   // dowmixing
00041   for ( i=0; i<ns; i++ ) {
00042     //if ( sample_to_time( fs, ns, i, &ti ) == BPM_FAILURE ) {
00043     //  bpm_error( "Unable to convert sample to time in downmix_waveform(...)",
00044 //               __FILE__, __LINE__ );
00045     //  return BPM_FAILURE;
00046     //}
00047 
00048     out[i][Re] = wf[i] * cos( 2. * PI * freq * i / fs );
00049     out[i][Im] = wf[i] * sin( 2. * PI * freq * i / fs );
00050   }
00051 
00052   return BPM_SUCCESS;
00053 }

Generated on Thu Jan 10 10:18:04 2008 for libbpm by  doxygen 1.5.1