00001
00006 #include <math.h>
00007 #include <bpm/bpm_messages.h>
00008 #include <bpm/bpm_process.h>
00009
00010 int downmix_waveform( doublewf_t *w, double freq, complexwf_t *out ) {
00011
00012 int i;
00013
00014 if ( ! w || ! out ) {
00015 bpm_error( "Invalid pointer arguments in downmix_waveform(...)",
00016 __FILE__, __LINE__ );
00017 return BPM_FAILURE;
00018 }
00019
00020
00021 for ( i=0; i<w->ns; i++ ) {
00022 out->wf[i].re = w->wf[i] * cos( 2. * PI * freq * (double) i / w->fs );
00023 out->wf[i].im = w->wf[i] * sin( 2. * PI * freq * (double) i / w->fs );
00024 }
00025
00026 return BPM_SUCCESS;
00027 }