bpmprocess/sample_to_time.c

Go to the documentation of this file.
00001 
00005 #include <bpm/bpm_messages.h>
00006 #include <bpm/bpm_process.h>
00007 
00018 int sample_to_time( double fs, int ns, int iS, double *t ) {
00019 
00020   if ( iS < 0. ) {
00021     *t = 0.;
00022     return BPM_SUCCESS;
00023   }
00024   
00025   if ( iS >= ns ) {
00026     *t = ( (double) ns - 0.5 ) / fs; // return time of last sample
00027     return BPM_SUCCESS;
00028   }
00029 
00030   *t = ( (double) iS + 0.5 ) / fs;
00031   
00032   return BPM_SUCCESS;
00033 }

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