ref: 61a1e5d4835dffd7f352e05e25f798fb3c178179
parent: 82ae9d701549a76f5a91c21be480daeab0ab23e7
author: Paul Brossier <piem@piem.org>
date: Mon Oct 3 14:59:12 EDT 2016
examples/: return 1 if object creation failed
--- a/examples/aubiomfcc.c
+++ b/examples/aubiomfcc.c
@@ -48,6 +48,7 @@
}
int main(int argc, char **argv) {
+ int ret = 0;
// change some default params
buffer_size = 512;
hop_size = 256;
@@ -62,6 +63,10 @@
fftgrain = new_cvec (buffer_size);
mfcc = new_aubio_mfcc(buffer_size, n_filters, n_coefs, samplerate);
mfcc_out = new_fvec(n_coefs);
+ if (pv == NULL || fftgrain == NULL || mfcc == NULL || mfcc_out == NULL) {
+ ret = 1;
+ goto beach;
+ }
examples_common_process((aubio_process_func_t)process_block, process_print);
@@ -70,7 +75,7 @@
del_aubio_mfcc(mfcc);
del_fvec(mfcc_out);
+beach:
examples_common_del();
- return 0;
+ return ret;
}
-
--- a/examples/aubionotes.c
+++ b/examples/aubionotes.c
@@ -50,6 +50,8 @@
}
int main(int argc, char **argv) {
+ int ret = 0;
+
examples_common_init(argc,argv);
verbmsg ("using source: %s at %dHz\n", source_uri, samplerate);
@@ -65,6 +67,7 @@
verbmsg ("tolerance: %f\n", pitch_tolerance);
notes = new_aubio_notes ("default", buffer_size, hop_size, samplerate);
+ if (notes == NULL) { ret = 1; goto beach; }
examples_common_process((aubio_process_func_t)process_block, process_print);
@@ -73,7 +76,7 @@
del_aubio_notes (notes);
+beach:
examples_common_del();
- return 0;
+ return ret;
}
-
--- a/examples/aubioonset.c
+++ b/examples/aubioonset.c
@@ -58,6 +58,7 @@
}
int main(int argc, char **argv) {
+ int ret = 0;
examples_common_init(argc,argv);
verbmsg ("using source: %s at %dHz\n", source_uri, samplerate);
@@ -68,6 +69,7 @@
verbmsg ("threshold: %f\n", onset_threshold);
o = new_aubio_onset (onset_method, buffer_size, hop_size, samplerate);
+ if (o == NULL) { ret = 1; goto beach; }
if (onset_threshold != 0.)
aubio_onset_set_threshold (o, onset_threshold);
if (silence_threshold != -90.)
@@ -88,6 +90,7 @@
del_aubio_wavetable (wavetable);
del_fvec (onset);
+beach:
examples_common_del();
- return 0;
+ return ret;
}
--- a/examples/aubiopitch.c
+++ b/examples/aubiopitch.c
@@ -52,6 +52,7 @@
}
int main(int argc, char **argv) {
+ int ret = 0;
buffer_size = 2048;
@@ -65,6 +66,7 @@
verbmsg ("tolerance: %f\n", pitch_tolerance);
o = new_aubio_pitch (pitch_method, buffer_size, hop_size, samplerate);
+ if (o == NULL) { ret = 1; goto beach; }
if (pitch_tolerance != 0.)
aubio_pitch_set_tolerance (o, pitch_tolerance);
if (silence_threshold != -90.)
@@ -83,7 +85,7 @@
del_aubio_wavetable (wavetable);
del_fvec (pitch);
+beach:
examples_common_del();
- return 0;
+ return ret;
}
-
--- a/examples/aubiotrack.c
+++ b/examples/aubiotrack.c
@@ -60,6 +60,7 @@
}
int main(int argc, char **argv) {
+ int ret = 0;
// override general settings from utils.c
buffer_size = 1024;
hop_size = 512;
@@ -75,6 +76,7 @@
tempo_out = new_fvec(2);
tempo = new_aubio_tempo(tempo_method, buffer_size, hop_size, samplerate);
+ if (tempo == NULL) { ret = 1; goto beach; }
// set silence threshold very low to output beats even during silence
// aubio_tempo_set_silence(tempo, -1000.);
if (onset_threshold != 0.) aubio_tempo_set_threshold (tempo, onset_threshold);
@@ -92,7 +94,7 @@
del_aubio_wavetable (wavetable);
del_fvec(tempo_out);
+beach:
examples_common_del();
- return 0;
+ return ret;
}
-