Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/src/io/base-sink_custom.h

    r43ea60d r05774ba3  
    2626  char_t *sink_path = argv[2];
    2727
    28   aubio_source_t *src = NULL;
    29   aubio_sink_custom_t *snk = NULL;
    30 
    3128  if ( argc >= 4 ) samplerate = atoi(argv[3]);
    3229  if ( argc >= 5 ) hop_size = atoi(argv[4]);
    3330
    3431  fvec_t *vec = new_fvec(hop_size);
    35   if (!vec) { err = 1; goto failure; }
    3632
    37   src = new_aubio_source(source_path, samplerate, hop_size);
    38   if (!src) { err = 1; goto failure; }
    39   if (samplerate == 0 ) samplerate = aubio_source_get_samplerate(src);
     33  aubio_source_t *i = new_aubio_source(source_path, samplerate, hop_size);
     34  if (samplerate == 0 ) samplerate = aubio_source_get_samplerate(i);
    4035
    41   snk = new_aubio_sink_custom(sink_path, samplerate);
    42   if (!snk) { err = 1; goto failure; }
     36  aubio_sink_custom_t *o = new_aubio_sink_custom(sink_path, samplerate);
     37
     38  if (!vec || !i || !o) { err = 1; goto failure; }
    4339
    4440  do {
    45     aubio_source_do(src, vec, &read);
    46     aubio_sink_custom_do(snk, vec, read);
     41    aubio_source_do(i, vec, &read);
     42    aubio_sink_custom_do(o, vec, read);
    4743    n_frames += read;
    4844  } while ( read == hop_size );
     
    5349
    5450  // close sink now (optional)
    55   aubio_sink_custom_close(snk);
     51  aubio_sink_custom_close(o);
    5652
    5753failure:
    58   if (snk)
    59     del_aubio_sink_custom(snk);
    60   if (src)
    61     del_aubio_source(src);
     54  if (o)
     55    del_aubio_sink_custom(o);
     56  if (i)
     57    del_aubio_source(i);
    6258  if (vec)
    6359    del_fvec(vec);
Note: See TracChangeset for help on using the changeset viewer.