Changeset 155cc10 for src/io/source.c
- Timestamp:
- Mar 10, 2017, 2:26:32 PM (8 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/applefworks, fix/ffmpeg5, master, sampler
- Children:
- ee8a57c
- Parents:
- 00d0275 (diff), 67b6618 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/io/source.c
r00d0275 r155cc10 19 19 */ 20 20 21 #include "config.h"22 21 #include "aubio_priv.h" 23 22 #include "fvec.h" … … 41 40 typedef uint_t (*aubio_source_get_samplerate_t)(aubio_source_t * s); 42 41 typedef uint_t (*aubio_source_get_channels_t)(aubio_source_t * s); 42 typedef uint_t (*aubio_source_get_duration_t)(aubio_source_t * s); 43 43 typedef uint_t (*aubio_source_seek_t)(aubio_source_t * s, uint_t seek); 44 44 typedef uint_t (*aubio_source_close_t)(aubio_source_t * s); … … 51 51 aubio_source_get_samplerate_t s_get_samplerate; 52 52 aubio_source_get_channels_t s_get_channels; 53 aubio_source_get_duration_t s_get_duration; 53 54 aubio_source_seek_t s_seek; 54 55 aubio_source_close_t s_close; … … 56 57 }; 57 58 58 aubio_source_t * new_aubio_source(c har_t * uri, uint_t samplerate, uint_t hop_size) {59 aubio_source_t * new_aubio_source(const char_t * uri, uint_t samplerate, uint_t hop_size) { 59 60 aubio_source_t * s = AUBIO_NEW(aubio_source_t); 60 #if HAVE_LIBAV61 #ifdef HAVE_LIBAV 61 62 s->source = (void *)new_aubio_source_avcodec(uri, samplerate, hop_size); 62 63 if (s->source) { … … 65 66 s->s_get_channels = (aubio_source_get_channels_t)(aubio_source_avcodec_get_channels); 66 67 s->s_get_samplerate = (aubio_source_get_samplerate_t)(aubio_source_avcodec_get_samplerate); 68 s->s_get_duration = (aubio_source_get_duration_t)(aubio_source_avcodec_get_duration); 67 69 s->s_seek = (aubio_source_seek_t)(aubio_source_avcodec_seek); 68 70 s->s_close = (aubio_source_close_t)(aubio_source_avcodec_close); … … 78 80 s->s_get_channels = (aubio_source_get_channels_t)(aubio_source_apple_audio_get_channels); 79 81 s->s_get_samplerate = (aubio_source_get_samplerate_t)(aubio_source_apple_audio_get_samplerate); 82 s->s_get_duration = (aubio_source_get_duration_t)(aubio_source_apple_audio_get_duration); 80 83 s->s_seek = (aubio_source_seek_t)(aubio_source_apple_audio_seek); 81 84 s->s_close = (aubio_source_close_t)(aubio_source_apple_audio_close); … … 84 87 } 85 88 #endif /* HAVE_SOURCE_APPLE_AUDIO */ 86 #if HAVE_SNDFILE89 #ifdef HAVE_SNDFILE 87 90 s->source = (void *)new_aubio_source_sndfile(uri, samplerate, hop_size); 88 91 if (s->source) { … … 91 94 s->s_get_channels = (aubio_source_get_channels_t)(aubio_source_sndfile_get_channels); 92 95 s->s_get_samplerate = (aubio_source_get_samplerate_t)(aubio_source_sndfile_get_samplerate); 96 s->s_get_duration = (aubio_source_get_duration_t)(aubio_source_sndfile_get_duration); 93 97 s->s_seek = (aubio_source_seek_t)(aubio_source_sndfile_seek); 94 98 s->s_close = (aubio_source_close_t)(aubio_source_sndfile_close); … … 97 101 } 98 102 #endif /* HAVE_SNDFILE */ 99 #if HAVE_WAVREAD103 #ifdef HAVE_WAVREAD 100 104 s->source = (void *)new_aubio_source_wavread(uri, samplerate, hop_size); 101 105 if (s->source) { … … 104 108 s->s_get_channels = (aubio_source_get_channels_t)(aubio_source_wavread_get_channels); 105 109 s->s_get_samplerate = (aubio_source_get_samplerate_t)(aubio_source_wavread_get_samplerate); 110 s->s_get_duration = (aubio_source_get_duration_t)(aubio_source_wavread_get_duration); 106 111 s->s_seek = (aubio_source_seek_t)(aubio_source_wavread_seek); 107 112 s->s_close = (aubio_source_close_t)(aubio_source_wavread_close); … … 110 115 } 111 116 #endif /* HAVE_WAVREAD */ 112 AUBIO_ERROR("source: failed creating aubio source with %s" 113 " at samplerate %d with hop_size %d\n", uri, samplerate, hop_size); 117 #if !defined(HAVE_WAVREAD) && \ 118 !defined(HAVE_LIBAV) && \ 119 !defined(HAVE_SOURCE_APPLE_AUDIO) && \ 120 !defined(HAVE_SNDFILE) 121 AUBIO_ERROR("source: failed creating with %s at %dHz with hop size %d" 122 " (no source built-in)\n", uri, samplerate, hop_size); 123 #endif 114 124 AUBIO_FREE(s); 115 125 return NULL; … … 142 152 } 143 153 154 uint_t aubio_source_get_duration(aubio_source_t *s) { 155 return s->s_get_duration((void *)s->source); 156 } 157 144 158 uint_t aubio_source_seek (aubio_source_t * s, uint_t seek ) { 145 159 return s->s_seek((void *)s->source, seek);
Note: See TracChangeset
for help on using the changeset viewer.