Changes in / [af27265:d67a08e]
- Files:
-
- 3 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/aubio.h
raf27265 rd67a08e 194 194 #include "io/source_sndfile.h" 195 195 #include "io/source_apple_audio.h" 196 #include "io/source_avcodec.h"197 196 #include "io/sink_sndfile.h" 198 197 #include "io/sink_apple_audio.h" -
src/io/source.c
raf27265 rd67a08e 24 24 #include "fmat.h" 25 25 #include "io/source.h" 26 #ifdef HAVE_AVCODEC27 #include "io/source_avcodec.h"28 #endif /* HAVE_AVCODEC */29 26 #ifdef __APPLE__ 30 27 #include "io/source_apple_audio.h" … … 32 29 #ifdef HAVE_SNDFILE 33 30 #include "io/source_sndfile.h" 34 #endif /* HAVE_SNDFILE */ 35 36 typedef void (*aubio_source_do_t)(aubio_source_t * s, fvec_t * data, uint_t * read); 37 typedef void (*aubio_source_do_multi_t)(aubio_source_t * s, fmat_t * data, uint_t * read); 38 typedef uint_t (*aubio_source_get_samplerate_t)(aubio_source_t * s); 39 typedef uint_t (*aubio_source_get_channels_t)(aubio_source_t * s); 40 typedef uint_t (*aubio_source_seek_t)(aubio_source_t * s, uint_t seek); 41 typedef uint_t (*del_aubio_source_t)(aubio_source_t * s); 31 #endif 42 32 43 33 struct _aubio_source_t { 44 34 void *source; 45 aubio_source_do_t s_do;46 aubio_source_do_multi_t s_do_multi;47 aubio_source_get_samplerate_t s_get_samplerate;48 aubio_source_get_channels_t s_get_channels;49 aubio_source_seek_t s_seek;50 del_aubio_source_t s_del;51 35 }; 52 36 53 37 aubio_source_t * new_aubio_source(char_t * uri, uint_t samplerate, uint_t hop_size) { 54 38 aubio_source_t * s = AUBIO_NEW(aubio_source_t); 55 #if HAVE_AVCODEC56 s->source = (void *)new_aubio_source_avcodec(uri, samplerate, hop_size);57 if (s->source) {58 s->s_do = (aubio_source_do_t)(aubio_source_avcodec_do);59 s->s_do_multi = (aubio_source_do_multi_t)(aubio_source_avcodec_do_multi);60 s->s_get_channels = (aubio_source_get_channels_t)(aubio_source_avcodec_get_channels);61 s->s_get_samplerate = (aubio_source_get_samplerate_t)(aubio_source_avcodec_get_samplerate);62 s->s_seek = (aubio_source_seek_t)(aubio_source_avcodec_seek);63 s->s_del = (del_aubio_source_t)(del_aubio_source_avcodec);64 return s;65 }66 #endif /* HAVE_AVCODEC */67 39 #ifdef __APPLE__ 68 40 s->source = (void *)new_aubio_source_apple_audio(uri, samplerate, hop_size); 69 if (s->source) { 70 s->s_do = (aubio_source_do_t)(aubio_source_apple_audio_do); 71 s->s_do_multi = (aubio_source_do_multi_t)(aubio_source_apple_audio_do_multi); 72 s->s_get_channels = (aubio_source_get_channels_t)(aubio_source_apple_audio_get_channels); 73 s->s_get_samplerate = (aubio_source_get_samplerate_t)(aubio_source_apple_audio_get_samplerate); 74 s->s_seek = (aubio_source_seek_t)(aubio_source_apple_audio_seek); 75 s->s_del = (del_aubio_source_t)(del_aubio_source_apple_audio); 76 return s; 77 } 78 #endif /* __APPLE__ */ 41 if (s->source) return s; 42 #else /* __APPLE__ */ 79 43 #if HAVE_SNDFILE 80 44 s->source = (void *)new_aubio_source_sndfile(uri, samplerate, hop_size); 81 if (s->source) { 82 s->s_do = (aubio_source_do_t)(aubio_source_sndfile_do); 83 s->s_do_multi = (aubio_source_do_multi_t)(aubio_source_sndfile_do_multi); 84 s->s_get_channels = (aubio_source_get_channels_t)(aubio_source_sndfile_get_channels); 85 s->s_get_samplerate = (aubio_source_get_samplerate_t)(aubio_source_sndfile_get_samplerate); 86 s->s_seek = (aubio_source_seek_t)(aubio_source_sndfile_seek); 87 s->s_del = (del_aubio_source_t)(del_aubio_source_sndfile); 88 return s; 89 } 45 if (s->source) return s; 90 46 #endif /* HAVE_SNDFILE */ 47 #endif /* __APPLE__ */ 91 48 AUBIO_ERROR("failed creating aubio source with %s\n", uri); 92 49 AUBIO_FREE(s); … … 95 52 96 53 void aubio_source_do(aubio_source_t * s, fvec_t * data, uint_t * read) { 97 s->s_do((void *)s->source, data, read); 54 #ifdef __APPLE__ 55 aubio_source_apple_audio_do((aubio_source_apple_audio_t *)s->source, data, read); 56 #else /* __APPLE__ */ 57 #if HAVE_SNDFILE 58 aubio_source_sndfile_do((aubio_source_sndfile_t *)s->source, data, read); 59 #endif /* HAVE_SNDFILE */ 60 #endif /* __APPLE__ */ 98 61 } 99 62 100 63 void aubio_source_do_multi(aubio_source_t * s, fmat_t * data, uint_t * read) { 101 s->s_do_multi((void *)s->source, data, read); 64 #ifdef __APPLE__ 65 aubio_source_apple_audio_do_multi((aubio_source_apple_audio_t *)s->source, data, read); 66 #else /* __APPLE__ */ 67 #if HAVE_SNDFILE 68 aubio_source_sndfile_do_multi((aubio_source_sndfile_t *)s->source, data, read); 69 #endif /* HAVE_SNDFILE */ 70 #endif /* __APPLE__ */ 102 71 } 103 72 104 73 void del_aubio_source(aubio_source_t * s) { 105 74 if (!s) return; 106 s->s_del((void *)s->source); 75 #ifdef __APPLE__ 76 del_aubio_source_apple_audio((aubio_source_apple_audio_t *)s->source); 77 #else /* __APPLE__ */ 78 #if HAVE_SNDFILE 79 del_aubio_source_sndfile((aubio_source_sndfile_t *)s->source); 80 #endif /* HAVE_SNDFILE */ 81 #endif /* __APPLE__ */ 107 82 AUBIO_FREE(s); 108 83 } 109 84 110 85 uint_t aubio_source_get_samplerate(aubio_source_t * s) { 111 return s->s_get_samplerate((void *)s->source); 86 #ifdef __APPLE__ 87 return aubio_source_apple_audio_get_samplerate((aubio_source_apple_audio_t *)s->source); 88 #else /* __APPLE__ */ 89 #if HAVE_SNDFILE 90 return aubio_source_sndfile_get_samplerate((aubio_source_sndfile_t *)s->source); 91 #endif /* HAVE_SNDFILE */ 92 #endif /* __APPLE__ */ 112 93 } 113 94 114 95 uint_t aubio_source_get_channels(aubio_source_t * s) { 115 return s->s_get_channels((void *)s->source); 96 #ifdef __APPLE__ 97 return aubio_source_apple_audio_get_channels((aubio_source_apple_audio_t *)s->source); 98 #else /* __APPLE__ */ 99 #if HAVE_SNDFILE 100 return aubio_source_sndfile_get_channels((aubio_source_sndfile_t *)s->source); 101 #endif /* HAVE_SNDFILE */ 102 #endif /* __APPLE__ */ 116 103 } 117 104 118 105 uint_t aubio_source_seek (aubio_source_t * s, uint_t seek ) { 119 return s->s_seek((void *)s->source, seek); 106 #ifdef __APPLE__ 107 return aubio_source_apple_audio_seek ((aubio_source_apple_audio_t *)s->source, seek); 108 #else /* __APPLE__ */ 109 #if HAVE_SNDFILE 110 return aubio_source_sndfile_seek ((aubio_source_sndfile_t *)s->source, seek); 111 #endif /* HAVE_SNDFILE */ 112 #endif /* __APPLE__ */ 120 113 } -
src/io/source_sndfile.c
raf27265 rd67a08e 74 74 s->path = path; 75 75 76 // try opening the file, get ting the info in sfinfo76 // try opening the file, geting the info in sfinfo 77 77 SF_INFO sfinfo; 78 78 AUBIO_MEMSET(&sfinfo, 0, sizeof (sfinfo)); -
src/wscript_build
raf27265 rd67a08e 6 6 uselib += ['SAMPLERATE'] 7 7 uselib += ['SNDFILE'] 8 uselib += ['AVCODEC']9 uselib += ['AVFORMAT']10 uselib += ['AVRESAMPLE']11 uselib += ['AVUTIL']12 8 uselib += ['JACK'] 13 9 uselib += ['LASH'] -
tests/src/io/test-source_sndfile.c
raf27265 rd67a08e 18 18 19 19 #ifdef HAVE_SNDFILE 20 uint_t samplerate = 0;20 uint_t samplerate = 32000; 21 21 uint_t hop_size = 256; 22 22 uint_t n_frames = 0, read = 0; … … 32 32 do { 33 33 aubio_source_sndfile_do(s, vec, &read); 34 fvec_print (vec);34 // fvec_print (vec); 35 35 n_frames += read; 36 36 } while ( read == hop_size ); -
wscript
raf27265 rd67a08e 57 57 add_option_enable_disable(ctx, 'sndfile', default = None, 58 58 help_str = 'compile with sndfile (auto)', help_disable_str = 'disable sndfile') 59 add_option_enable_disable(ctx, 'avcodec', default = None,60 help_str = 'compile with libavcodec (auto)', help_disable_str = 'disable libavcodec')61 59 add_option_enable_disable(ctx, 'samplerate', default = None, 62 60 help_str = 'compile with samplerate (auto)', help_disable_str = 'disable samplerate') … … 202 200 args = '--cflags --libs', uselib_store = 'LASH', mandatory = False) 203 201 204 if (ctx.options.enable_avcodec != False):205 ctx.check_cfg(package = 'libavcodec', atleast_version = '54.35.0',206 args = '--cflags --libs', uselib_store = 'AVCODEC', mandatory = False)207 ctx.check_cfg(package = 'libavformat', atleast_version = '52.3.0',208 args = '--cflags --libs', uselib_store = 'AVFORMAT', mandatory = False)209 ctx.check_cfg(package = 'libavutil', atleast_version = '52.3.0',210 args = '--cflags --libs', uselib_store = 'AVUTIL', mandatory = False)211 ctx.check_cfg(package = 'libavresample', atleast_version = '1.0.1',212 args = '--cflags --libs', uselib_store = 'AVRESAMPLE', mandatory = False)213 214 202 # write configuration header 215 203 ctx.write_config_header('src/config.h')
Note: See TracChangeset
for help on using the changeset viewer.