From f382ac69f6bf8b07b53a44090b2dd24bc6764750 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Mon, 23 May 2005 16:32:42 +0000 Subject: [PATCH] start fixing woodblock filepaty start fixing woodblock filepaty --- examples/utils.c | 14 ++++++++++---- ext/sndfileio.c | 6 +++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/examples/utils.c b/examples/utils.c index 55807db5..5455bd77 100644 --- a/examples/utils.c +++ b/examples/utils.c @@ -200,10 +200,19 @@ int parse_args (int argc, char **argv) { void examples_common_init(int argc,char ** argv) { - aubio_file_t * onsetfile = new_file_ro(onset_filename); + aubio_file_t * onsetfile; /* parse command line arguments */ parse_args(argc, argv); + woodblock = new_fvec(buffer_size,1); + if (output_filename || usejack) { + (onsetfile = new_file_ro(onset_filename)) || + (onsetfile = new_file_ro("sounds/woodblock.aiff")) || + (onsetfile = new_file_ro("../sounds/woodblock.aiff")); + /* read the output sound once */ + file_read(onsetfile, overlap_size, woodblock); + } + if(!usejack) { debug("Opening files ...\n"); @@ -217,7 +226,6 @@ void examples_common_init(int argc,char ** argv) { ibuf = new_fvec(overlap_size, channels); obuf = new_fvec(overlap_size, channels); - woodblock = new_fvec(buffer_size,1); fftgrain = new_cvec(buffer_size, channels); if (usepitch) { @@ -229,8 +237,6 @@ void examples_common_init(int argc,char ** argv) { note_buffer2= new_fvec(median, 1); } } - /* read the output sound once */ - file_read(onsetfile, overlap_size, woodblock); /* phase vocoder */ pv = new_aubio_pvoc(buffer_size, overlap_size, channels); /* onsets */ diff --git a/ext/sndfileio.c b/ext/sndfileio.c index 53af1e85..ae2b4420 100644 --- a/ext/sndfileio.c +++ b/ext/sndfileio.c @@ -44,14 +44,14 @@ aubio_file_t * new_file_ro(const char* outputname) { AUBIO_MEMSET(&sfinfo, 0, sizeof (sfinfo)); if (! (f->handle = sf_open (outputname, SFM_READ, &sfinfo))) { - AUBIO_ERR("Not able to open input file %s.\n", outputname); + AUBIO_ERR("Unable to open input file %s.\n", outputname); AUBIO_ERR("%s\n",sf_strerror (NULL)); /* libsndfile err msg */ - AUBIO_QUIT(AUBIO_FAIL); + return NULL; } if (sfinfo.channels > MAX_CHANNELS) { AUBIO_ERR("Not able to process more than %d channels\n", MAX_CHANNELS); - AUBIO_QUIT(AUBIO_FAIL); + return NULL; } f->size = MAX_SIZE*sfinfo.channels; -- 2.26.2