shithub: aubio

Download patch

ref: 0de816c453f27180a8ab916618521601e0b18c36
parent: 9ffa590069497578bfdf079435c6d7df2663faab
author: Paul Brossier <piem@piem.org>
date: Thu Nov 29 13:36:22 EST 2018

[tests] fix argument parsing in onset and wavetable

--- a/tests/src/onset/test-onset.c
+++ b/tests/src/onset/test-onset.c
@@ -17,8 +17,8 @@
   uint_t win_s = 1024; // window size
   uint_t hop_size = win_s / 4;
   uint_t n_frames = 0, read = 0;
-  if ( argc == 3 ) samplerate = atoi(argv[2]);
-  if ( argc == 4 ) hop_size = atoi(argv[3]);
+  if ( argc >= 3 ) samplerate = atoi(argv[2]);
+  if ( argc >= 4 ) hop_size = atoi(argv[3]);
 
   char_t *source_path = argv[1];
   aubio_source_t * source = new_aubio_source(source_path, samplerate, hop_size);
--- a/tests/src/synth/test-wavetable.c
+++ b/tests/src/synth/test-wavetable.c
@@ -17,8 +17,8 @@
   smpl_t freq = 440.;
 
   char_t *sink_path = argv[1];
-  if ( argc == 4 ) samplerate = atoi(argv[3]);
-  if ( argc == 3 ) freq = atof(argv[2]);
+  if ( argc >= 4 ) samplerate = atoi(argv[3]);
+  if ( argc >= 3 ) freq = atof(argv[2]);
 
   fvec_t *vec = new_fvec(hop_size);
   aubio_sink_t *sink = new_aubio_sink(sink_path, samplerate);