start fixing woodblock filepaty
authorPaul Brossier <piem@altern.org>
Mon, 23 May 2005 16:32:42 +0000 (16:32 +0000)
committerPaul Brossier <piem@altern.org>
Mon, 23 May 2005 16:32:42 +0000 (16:32 +0000)
start fixing woodblock filepaty

examples/utils.c
ext/sndfileio.c

index 55807db..5455bd7 100644 (file)
@@ -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 */
index 53af1e8..ae2b442 100644 (file)
@@ -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;