Changeset b4e1438 for src


Ignore:
Timestamp:
Apr 25, 2016, 4:45:22 PM (9 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
691791e
Parents:
c6e7ba1
Message:

src/io/source_wavread.h: add _get_duration

Location:
src/io
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/io/source_wavread.c

    rc6e7ba1 rb4e1438  
    5353  uint_t eof;
    5454
     55  uint_t duration;
     56
    5557  size_t seek_start;
    5658
     
    7274  size_t bytes_read = 0, bytes_expected = 44;
    7375  unsigned char buf[5];
    74   unsigned int format, channels, sr, byterate, blockalign, bitspersample;//, data_size;
     76  unsigned int format, channels, sr, byterate, blockalign, duration, bitspersample;//, data_size;
    7577
    7678  if (path == NULL) {
     
    216218  // Subchunk2Size
    217219  bytes_read += fread(buf, 1, 4, s->fid);
     220  duration = read_little_endian(buf, 4) / blockalign;
     221
    218222  //data_size = buf[0] + (buf[1] << 8) + (buf[2] << 16) + (buf[3] << 24);
    219223  //AUBIO_MSG("found %d frames in %s\n", 8 * data_size / bitspersample / channels, s->path);
     
    235239  s->blockalign= blockalign;
    236240  s->bitspersample = bitspersample;
     241
     242  s->duration = duration;
    237243
    238244  s->short_output = (unsigned char *)calloc(s->blockalign, AUBIO_WAVREAD_BUFSIZE);
     
    375381}
    376382
     383uint_t aubio_source_wavread_get_duration (const aubio_source_wavread_t * s) {
     384  if (s && s->duration) {
     385    return s->duration;
     386  }
     387  return 0;
     388}
     389
    377390uint_t aubio_source_wavread_close (aubio_source_wavread_t * s) {
    378391  if (!s->fid) {
  • src/io/source_wavread.h

    rc6e7ba1 rb4e1438  
    126126/**
    127127
     128  get the duration of source object, in frames
     129
     130  \param s source object, created with ::new_aubio_source_sndfile
     131  \return number of frames in file
     132
     133*/
     134uint_t aubio_source_wavread_get_duration (const aubio_source_wavread_t *s);
     135
     136/**
     137
    128138  close source
    129139
Note: See TracChangeset for help on using the changeset viewer.