Changeset 1686fcf for src/synth


Ignore:
Timestamp:
Jun 27, 2017, 4:56:00 PM (7 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
sampler
Parents:
04d0c89
Message:

src/synth/sampler.h: add aubio_sampler_get_duration

Location:
src/synth
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/synth/sampler.c

    r04d0c89 r1686fcf  
    5757  uint_t samplerate;
    5858  uint_t blocksize;
     59  uint_t duration;
    5960  // current reading mode (can be a file or an array)
    6061  uint_t reading_from;
     
    129130  s->samplerate = samplerate;
    130131  s->blocksize = blocksize;
     132  s->duration = 0;
    131133  s->source = NULL;
    132134  s->playing = 0;
     
    279281    o->opened = 1;
    280282    ret = AUBIO_OK;
     283    o->duration = duration;
    281284    AUBIO_MSG("sampler: loaded %s\n", uri);
    282285#ifdef HAVE_THREADS
     
    811814
    812815uint_t
     816aubio_sampler_get_duration (aubio_sampler_t *o)
     817{
     818  if (o->duration !=0) {
     819    return o->duration;
     820  } else {
     821    AUBIO_WRN("sampler: failed getting duration for %s\n", o->uri);
     822    return 0;
     823  }
     824}
     825
     826uint_t
    813827aubio_sampler_get_opened (aubio_sampler_t *o)
    814828{
  • src/synth/sampler.h

    r04d0c89 r1686fcf  
    218218uint_t aubio_sampler_get_samplerate(aubio_sampler_t * o);
    219219
     220/** get duration
     221
     222  \param o sampler, created by new_aubio_sampler()
     223
     224  \return duration of the opened uri, in samples
     225
     226*/
     227uint_t aubio_sampler_get_duration(aubio_sampler_t * o);
     228
    220229/** get the number of samples that were set to zero while opening a file
    221230
Note: See TracChangeset for help on using the changeset viewer.