From: Paul Brossier Date: Fri, 21 Jul 2006 13:58:26 +0000 (+0000) Subject: exit from examples when woodblock or input files not found X-Git-Tag: bzr2git~612 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9af07aa2479802801ede3488493b92b777000010;p=aubio.git exit from examples when woodblock or input files not found exit from examples when woodblock or input files not found --- diff --git a/examples/utils.c b/examples/utils.c index 616c9e3a..ba7fac39 100644 --- a/examples/utils.c +++ b/examples/utils.c @@ -253,6 +253,10 @@ void examples_common_init(int argc,char ** argv) { 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 @@ void examples_common_init(int argc,char ** argv) { { 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);