Ignore:
Timestamp:
Oct 10, 2016, 11:42:14 AM (8 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
sampler
Children:
2ca4b59
Parents:
f253b03
Message:

src/synth/sampler.c: remove debug variable, make sure source_blocksize >= blocksize, print a warning if sample duration is shorter than blocksize

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/synth/sampler.c

    rf253b03 ra006c5f  
    4545} aubio_sampler_reading_method;
    4646
    47 
    48 int check_wrote = 0;
    4947
    5048typedef enum {
     
    149147  s->threaded_read = 1;
    150148#endif
     149
     150  if (s->source_blocksize < s->blocksize) {
     151    s->source_blocksize = s->blocksize;
     152  }
    151153  // FIXME: perfectloop fails if source_blocksize > 2048 with source_avcodec
    152154  //s->source_blocksize = 8192;
     
    230232  newsource = new_aubio_source(uri, o->samplerate, o->source_blocksize);
    231233  if (newsource) {
     234    uint_t duration = aubio_source_get_duration(newsource);
     235    if (duration < o->blocksize) {
     236      AUBIO_WRN("sampler: %s is %d frames long, but blocksize is %d\n",
     237          uri, duration, o->blocksize);
     238    }
    232239    o->source = newsource;
    233240    if (oldsource) del_aubio_source(oldsource);
     
    392399  s->source_output = output;
    393400  *read = aubio_sampler_pull_from_source(s);
    394   check_wrote += s->source_blocksize;
    395401  if (*read < s->source_blocksize) {
    396402    //AUBIO_WRN("sampler: calling go_eof in _read_from_source()\n");
     
    443449    //AUBIO_MSG("sampler: pulling %d / %d from ringbuffer\n", s->blocksize, ring_avail);
    444450    aubio_ringbuffer_pull(s->ring, output, s->blocksize);
    445     check_wrote += s->blocksize;
    446451    *read = s->blocksize;
    447452    if (s->eof_remaining > 0) {
     
    454459    }
    455460  } else {
    456     AUBIO_MSG("sampler: last frame, pulling remaining %d left\n", ring_avail);
     461    //AUBIO_MSG("sampler: last frame, pulling remaining %d left\n", ring_avail);
    457462    *read = 0;
    458463    if (ring_avail > 0) {
    459464      // pull remaining frames in ring buffer
    460465      aubio_ringbuffer_pull(s->ring, output, ring_avail);
    461       check_wrote += ring_avail;
    462466      *read += ring_avail;
    463467    }
     
    491495    available = 0;
    492496  } else if (!s->finished) {
    493     //AUBIO_ERR("sampler: _read_from_source: waiting for read avail %d\n", s->started);
    494497    pthread_cond_signal(&s->read_request);
    495498    pthread_cond_wait(&s->read_avail, &s->read_mutex);
     
    518521    aubio_sampler_reading_from_source_ring_pull(s, output, read);
    519522  }
    520   //*read = s->available;
    521523}
    522524#endif
     
    719721void del_aubio_sampler( aubio_sampler_t * o )
    720722{
    721   AUBIO_MSG("sampler: check_wrote: %d\n", check_wrote);
    722723#ifdef HAVE_THREADS
    723724  // close opening thread
Note: See TracChangeset for help on using the changeset viewer.