Changeset a41b1ef for src


Ignore:
Timestamp:
Apr 25, 2016, 4:26:39 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:
b1d2be8
Parents:
8bffcff
Message:

src/io/source_apple_audio.h: add _get_duration

Location:
src/io
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/io/source_apple_audio.c

    r8bffcff ra41b1ef  
    312312  }
    313313  // check if we are not seeking out of the file
    314   SInt64 fileLengthFrames = 0;
    315   UInt32 propSize = sizeof(fileLengthFrames);
    316   ExtAudioFileGetProperty(s->audioFile,
    317       kExtAudioFileProperty_FileLengthFrames, &propSize, &fileLengthFrames);
     314  uint_t fileLengthFrames = aubio_source_apple_audio_get_duration(s);
    318315  // compute position in the source file, before resampling
    319316  smpl_t ratio = s->source_samplerate * 1. / s->samplerate;
     
    364361}
    365362
     363uint_t aubio_source_apple_audio_get_duration(const aubio_source_apple_audio_t * s) {
     364  SInt64 fileLengthFrames = 0;
     365  UInt32 propSize = sizeof(fileLengthFrames);
     366  OSStatus err = ExtAudioFileGetProperty(s->audioFile,
     367      kExtAudioFileProperty_FileLengthFrames, &propSize, &fileLengthFrames);
     368  if (err) {
     369    char_t errorstr[20];
     370    AUBIO_ERROR("source_apple_audio: Failed getting %s duration, "
     371        "error in ExtAudioFileGetProperty (%s)\n", s->path,
     372        getPrintableOSStatusError(errorstr, err));
     373    return err;
     374  }
     375  return (uint_t)fileLengthFrames;
     376}
     377
    366378#endif /* HAVE_SOURCE_APPLE_AUDIO */
  • src/io/source_apple_audio.h

    r8bffcff ra41b1ef  
    110110/**
    111111
     112  get the duration of source object, in frames
     113
     114  \param s source object, created with ::new_aubio_source_apple_audio
     115  \return number of frames in file
     116
     117*/
     118uint_t aubio_source_apple_audio_get_duration(const aubio_source_apple_audio_t * s);
     119
     120/**
     121
    112122  seek source object
    113123
Note: See TracChangeset for help on using the changeset viewer.