Changeset 857f8871


Ignore:
Timestamp:
Apr 25, 2016, 5:49:10 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:
6e765ed
Parents:
691791e
Message:

src/io/source.*: add _get_duration

Location:
src/io
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/io/source.c

    r691791e r857f8871  
    4141typedef uint_t (*aubio_source_get_samplerate_t)(aubio_source_t * s);
    4242typedef uint_t (*aubio_source_get_channels_t)(aubio_source_t * s);
     43typedef uint_t (*aubio_source_get_duration_t)(aubio_source_t * s);
    4344typedef uint_t (*aubio_source_seek_t)(aubio_source_t * s, uint_t seek);
    4445typedef uint_t (*aubio_source_close_t)(aubio_source_t * s);
     
    5152  aubio_source_get_samplerate_t s_get_samplerate;
    5253  aubio_source_get_channels_t s_get_channels;
     54  aubio_source_get_duration_t s_get_duration;
    5355  aubio_source_seek_t s_seek;
    5456  aubio_source_close_t s_close;
     
    6567    s->s_get_channels = (aubio_source_get_channels_t)(aubio_source_avcodec_get_channels);
    6668    s->s_get_samplerate = (aubio_source_get_samplerate_t)(aubio_source_avcodec_get_samplerate);
     69    s->s_get_duration = (aubio_source_get_duration_t)(aubio_source_avcodec_get_duration);
    6770    s->s_seek = (aubio_source_seek_t)(aubio_source_avcodec_seek);
    6871    s->s_close = (aubio_source_close_t)(aubio_source_avcodec_close);
     
    7881    s->s_get_channels = (aubio_source_get_channels_t)(aubio_source_apple_audio_get_channels);
    7982    s->s_get_samplerate = (aubio_source_get_samplerate_t)(aubio_source_apple_audio_get_samplerate);
     83    s->s_get_duration = (aubio_source_get_duration_t)(aubio_source_apple_audio_get_duration);
    8084    s->s_seek = (aubio_source_seek_t)(aubio_source_apple_audio_seek);
    8185    s->s_close = (aubio_source_close_t)(aubio_source_apple_audio_close);
     
    9195    s->s_get_channels = (aubio_source_get_channels_t)(aubio_source_sndfile_get_channels);
    9296    s->s_get_samplerate = (aubio_source_get_samplerate_t)(aubio_source_sndfile_get_samplerate);
     97    s->s_get_duration = (aubio_source_get_duration_t)(aubio_source_sndfile_get_duration);
    9398    s->s_seek = (aubio_source_seek_t)(aubio_source_sndfile_seek);
    9499    s->s_close = (aubio_source_close_t)(aubio_source_sndfile_close);
     
    104109    s->s_get_channels = (aubio_source_get_channels_t)(aubio_source_wavread_get_channels);
    105110    s->s_get_samplerate = (aubio_source_get_samplerate_t)(aubio_source_wavread_get_samplerate);
     111    s->s_get_duration = (aubio_source_get_duration_t)(aubio_source_wavread_get_duration);
    106112    s->s_seek = (aubio_source_seek_t)(aubio_source_wavread_seek);
    107113    s->s_close = (aubio_source_close_t)(aubio_source_wavread_close);
     
    142148}
    143149
     150uint_t aubio_source_get_duration(aubio_source_t *s) {
     151  return s->s_get_duration((void *)s->source);
     152}
     153
    144154uint_t aubio_source_seek (aubio_source_t * s, uint_t seek ) {
    145155  return s->s_seek((void *)s->source, seek);
  • src/io/source.h

    r691791e r857f8871  
    150150/**
    151151
     152  get the duration of source object, in frames
     153
     154  \param s source object, created with ::new_aubio_source
     155  \return number of frames in file
     156
     157*/
     158uint_t aubio_source_get_duration (aubio_source_t * s);
     159
     160/**
     161
    152162  close source object
    153163
Note: See TracChangeset for help on using the changeset viewer.