Changeset e24378a


Ignore:
Timestamp:
Nov 13, 2007, 9:15:35 AM (12 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, pitchshift, sampler, timestretch, yinfft+
Children:
ec0d43c
Parents:
941801f
Message:

examples/utils.{c,h}, examples/aubioonset.c: added process_flush function to get last onset at the end of file, added frames_delay parameter

Location:
examples
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • examples/aubioonset.c

    r941801f re24378a  
    7272      if (isonset && output_filename == NULL) {
    7373        if(frames >= 4) {
    74           outmsg("%f\n",(frames-4)*overlap_size/(float)samplerate);
    75         } else if (frames < 4) {
     74          outmsg("%f\n",(frames-frames_delay)*overlap_size/(float)samplerate);
     75        } else if (frames < frames_delay) {
    7676          outmsg("%f\n",0.);
    7777        }
     
    8080
    8181int main(int argc, char **argv) {
     82  frames_delay = 4;
    8283  examples_common_init(argc,argv);
    8384  examples_common_process(aubio_process,process_print);
  • examples/utils.c

    r941801f re24378a  
    2222void save_data (void);
    2323void restore_data(lash_config_t * lash_config);
     24void flush_process(aubio_process_func_t process_func, aubio_print_func_t print);
    2425pthread_t lash_thread;
    2526#endif /* LASH_SUPPORT */
     
    3334int usejack = 0;
    3435int usedoubled = 1;
     36int frames_delay = 0;
    3537
    3638
     
    395397
    396398    debug("Processed %d frames of %d samples.\n", frames, buffer_size);
     399
     400    flush_process(process_func, print);
    397401    del_aubio_sndfile(file);
    398402
     
    403407}
    404408
     409void flush_process(aubio_process_func_t process_func, aubio_print_func_t print){
     410  uint i,j;
     411  for (i = 0; i < channels; i++) {
     412    for (j = 0; j < obuf->length; j++) {
     413      fvec_write_sample(obuf,0.,i,j);
     414    }
     415  }
     416  for (i = 0; i < frames_delay; i++) {
     417    process_func(ibuf->data, obuf->data, overlap_size);
     418    print();
     419  }
     420}
    405421
    406422
  • examples/utils.h

    r941801f re24378a  
    4242extern int usejack;
    4343extern int usedoubled;
     44extern int frames_delay;
    4445extern unsigned int median;
    4546extern const char * output_filename;
Note: See TracChangeset for help on using the changeset viewer.