ref: 9af07aa2479802801ede3488493b92b777000010
parent: b91fe6ec6c51eff8ad2a7803c2ddef0fedfc9ae3
author: Paul Brossier <piem@altern.org>
date: Fri Jul 21 09:58:26 EDT 2006
exit from examples when woodblock or input files not found exit from examples when woodblock or input files not found
--- a/examples/utils.c
+++ b/examples/utils.c
@@ -253,6 +253,10 @@
isonset = (onsetfile = new_aubio_sndfile_ro(onset_filename)) ||
(onsetfile = new_aubio_sndfile_ro("sounds/woodblock.aiff")) ||
(onsetfile = new_aubio_sndfile_ro("../sounds/woodblock.aiff"));
+ if (onsetfile == NULL) {
+ outmsg("Could not find woodblock.aiff\n");
+ exit(1);
+ }
}
if (onsetfile) {
/* read the output sound once */
@@ -263,6 +267,10 @@
{
debug("Opening files ...\n");
file = new_aubio_sndfile_ro (input_filename);
+ if (file == NULL) {
+ outmsg("Could not open input file %s.\n", input_filename);
+ exit(1);
+ }
if (verbose) aubio_sndfile_info(file);
channels = aubio_sndfile_channels(file);
samplerate = aubio_sndfile_samplerate(file);