Changeset 61a1e5d for examples


Ignore:
Timestamp:
Oct 3, 2016, 6:59:12 PM (8 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, sampler, yinfft+
Children:
ffd10fb
Parents:
82ae9d7
Message:

examples/: return 1 if object creation failed

Location:
examples
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • examples/aubiomfcc.c

    r82ae9d7 r61a1e5d  
    4949
    5050int main(int argc, char **argv) {
     51  int ret = 0;
    5152  // change some default params
    5253  buffer_size  = 512;
     
    6364  mfcc = new_aubio_mfcc(buffer_size, n_filters, n_coefs, samplerate);
    6465  mfcc_out = new_fvec(n_coefs);
     66  if (pv == NULL || fftgrain == NULL || mfcc == NULL || mfcc_out == NULL) {
     67    ret = 1;
     68    goto beach;
     69  }
    6570
    6671  examples_common_process((aubio_process_func_t)process_block, process_print);
     
    7176  del_fvec(mfcc_out);
    7277
     78beach:
    7379  examples_common_del();
    74   return 0;
     80  return ret;
    7581}
    76 
  • examples/aubionotes.c

    r82ae9d7 r61a1e5d  
    5151
    5252int main(int argc, char **argv) {
     53  int ret = 0;
     54
    5355  examples_common_init(argc,argv);
    5456
     
    6668
    6769  notes = new_aubio_notes ("default", buffer_size, hop_size, samplerate);
     70  if (notes == NULL) { ret = 1; goto beach; }
    6871
    6972  examples_common_process((aubio_process_func_t)process_block, process_print);
     
    7477  del_aubio_notes (notes);
    7578
     79beach:
    7680  examples_common_del();
    77   return 0;
     81  return ret;
    7882}
    79 
  • examples/aubioonset.c

    r82ae9d7 r61a1e5d  
    5959
    6060int main(int argc, char **argv) {
     61  int ret = 0;
    6162  examples_common_init(argc,argv);
    6263
     
    6970
    7071  o = new_aubio_onset (onset_method, buffer_size, hop_size, samplerate);
     72  if (o == NULL) { ret = 1; goto beach; }
    7173  if (onset_threshold != 0.)
    7274    aubio_onset_set_threshold (o, onset_threshold);
     
    8991  del_fvec (onset);
    9092
     93beach:
    9194  examples_common_del();
    92   return 0;
     95  return ret;
    9396}
  • examples/aubiopitch.c

    r82ae9d7 r61a1e5d  
    5353
    5454int main(int argc, char **argv) {
     55  int ret = 0;
    5556
    5657  buffer_size = 2048;
     
    6667
    6768  o = new_aubio_pitch (pitch_method, buffer_size, hop_size, samplerate);
     69  if (o == NULL) { ret = 1; goto beach; }
    6870  if (pitch_tolerance != 0.)
    6971    aubio_pitch_set_tolerance (o, pitch_tolerance);
     
    8486  del_fvec (pitch);
    8587
     88beach:
    8689  examples_common_del();
    87   return 0;
     90  return ret;
    8891}
    89 
  • examples/aubiotrack.c

    r82ae9d7 r61a1e5d  
    6161
    6262int main(int argc, char **argv) {
     63  int ret = 0;
    6364  // override general settings from utils.c
    6465  buffer_size = 1024;
     
    7677  tempo_out = new_fvec(2);
    7778  tempo = new_aubio_tempo(tempo_method, buffer_size, hop_size, samplerate);
     79  if (tempo == NULL) { ret = 1; goto beach; }
    7880  // set silence threshold very low to output beats even during silence
    7981  // aubio_tempo_set_silence(tempo, -1000.);
     
    9395  del_fvec(tempo_out);
    9496
     97beach:
    9598  examples_common_del();
    96   return 0;
     99  return ret;
    97100}
    98 
Note: See TracChangeset for help on using the changeset viewer.