00001 00005 #include <bpm/bpm_messages.h> 00006 #include <bpm/bpm_process.h> 00007 00020 int sample_to_freq( double fs, int ns, int iS, double *f ) { 00021 00022 if ( iS < 0. ) { 00023 *f = 0.; 00024 return BPM_SUCCESS; 00025 } 00026 00027 if ( iS >= ns ) { 00028 *f = fs; // return sampling freq 00029 return BPM_SUCCESS; 00030 } 00031 00032 *f = ( (double) iS + 0.5 ) / ((double)ns) * fs; 00033 00034 return BPM_SUCCESS; 00035 }