Changes in / [eadd8d5:af27265]


Ignore:
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/io/sink_sndfile.c

    readd8d5 raf27265  
    7171    /* show libsndfile err msg */
    7272    AUBIO_ERR("Failed opening %s. %s\n", s->path, sf_strerror (NULL));
     73    AUBIO_FREE(s);
    7374    return NULL;
    7475  }     
     
    7980    AUBIO_ERR("%d x %d exceeds maximum aubio_sink_sndfile buffer size %d\n",
    8081        s->max_size, s->channels, MAX_CHANNELS * MAX_CHANNELS);
     82    AUBIO_FREE(s);
    8183    return NULL;
    8284  }
  • tests/src/io/test-sink.c

    readd8d5 raf27265  
    99    err = 2;
    1010    PRINT_ERR("not enough arguments\n");
    11     PRINT_MSG("usage: %s <input_path> <output_path> [samplerate]\n", argv[0]);
     11    PRINT_MSG("usage: %s <input_path> <output_path> [samplerate] [hop_size]\n", argv[0]);
    1212    return err;
    1313  }
    1414
    15   uint_t samplerate = 44100;
    16   uint_t hop_size = 512;
    17   uint_t n_frames = 0, read = 0;
    18 
    1915  char_t *source_path = argv[1];
    2016  char_t *sink_path = argv[2];
    21   if ( argc == 4 ) samplerate = atoi(argv[3]);
     17
     18  uint_t samplerate = 0;
     19  uint_t hop_size = 256;
     20  if ( argc >= 4 ) samplerate = atoi(argv[3]);
     21  if ( argc >= 5 ) hop_size = atoi(argv[4]);
     22  if ( argc >= 6 ) {
     23    err = 2;
     24    PRINT_ERR("too many arguments\n");
     25    return err;
     26  }
    2227
    2328  fvec_t *vec = new_fvec(hop_size);
     29  if (!vec) { err = 1; goto beach_fvec; }
     30
    2431  aubio_source_t *i = new_aubio_source(source_path, samplerate, hop_size);
     32  if (!i) { err = 1; goto beach_source; }
     33
    2534  if (samplerate == 0 ) samplerate = aubio_source_get_samplerate(i);
     35
    2636  aubio_sink_t *o = new_aubio_sink(sink_path, samplerate);
     37  if (!o) { err = 1; goto beach_sink; }
    2738
    28   if (!i || !o) { err = 1; goto beach; }
     39  uint_t n_frames = 0, read = 0;
    2940
    3041  do {
     
    3445  } while ( read == hop_size );
    3546
    36   PRINT_MSG("wrote %d frames at %dHz from %s written to %s\n",
    37       n_frames, samplerate, source_path, sink_path);
     47  PRINT_MSG("read %d frames at %dHz (%d blocks) from %s written to %s\n",
     48      n_frames, samplerate, n_frames / hop_size,
     49      source_path, sink_path);
    3850
    39 beach:
     51  del_aubio_sink(o);
     52beach_sink:
    4053  del_aubio_source(i);
    41   del_aubio_sink(o);
     54beach_source:
    4255  del_fvec(vec);
     56beach_fvec:
    4357  return err;
    4458}
Note: See TracChangeset for help on using the changeset viewer.