Changeset 4ed4b1f
- Timestamp:
- Feb 23, 2014, 5:07:57 PM (11 years ago)
- 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:
- 2eccf22
- Parents:
- c21553d
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/io/sink.c
rc21553d r4ed4b1f 1 1 /* 2 Copyright (C) 2012 Paul Brossier <piem@aubio.org>2 Copyright (C) 2012-2014 Paul Brossier <piem@aubio.org> 3 3 4 4 This file is part of aubio. … … 22 22 #include "aubio_priv.h" 23 23 #include "fvec.h" 24 #include "fmat.h" 24 25 #include "io/sink.h" 25 26 #ifdef __APPLE__ … … 34 35 35 36 typedef void (*aubio_sink_do_t)(aubio_sink_t * s, fvec_t * data, uint_t write); 36 #if 0 37 typedef void (*aubio_sink_do_multi_t)(aubio_sink_t * s, fmat_t * data, uint_t * read); 37 typedef void (*aubio_sink_do_multi_t)(aubio_sink_t * s, fmat_t * data, uint_t write); 38 typedef uint_t (*aubio_sink_preset_samplerate_t)(aubio_sink_t * s, uint_t samplerate); 39 typedef uint_t (*aubio_sink_preset_channels_t)(aubio_sink_t * s, uint_t channels); 38 40 typedef uint_t (*aubio_sink_get_samplerate_t)(aubio_sink_t * s); 39 41 typedef uint_t (*aubio_sink_get_channels_t)(aubio_sink_t * s); 40 #endif41 42 typedef uint_t (*aubio_sink_close_t)(aubio_sink_t * s); 42 43 typedef void (*del_aubio_sink_t)(aubio_sink_t * s); … … 45 46 void *sink; 46 47 aubio_sink_do_t s_do; 47 #if 048 48 aubio_sink_do_multi_t s_do_multi; 49 aubio_sink_preset_samplerate_t s_preset_samplerate; 50 aubio_sink_preset_channels_t s_preset_channels; 49 51 aubio_sink_get_samplerate_t s_get_samplerate; 50 52 aubio_sink_get_channels_t s_get_channels; 51 #endif52 53 aubio_sink_close_t s_close; 53 54 del_aubio_sink_t s_del; … … 60 61 if (s->sink) { 61 62 s->s_do = (aubio_sink_do_t)(aubio_sink_apple_audio_do); 63 s->s_do_multi = (aubio_sink_do_multi_t)(aubio_sink_apple_audio_do_multi); 64 s->s_preset_samplerate = (aubio_sink_preset_samplerate_t)(aubio_sink_apple_audio_preset_samplerate); 65 s->s_preset_channels = (aubio_sink_preset_channels_t)(aubio_sink_apple_audio_preset_channels); 66 s->s_get_samplerate = (aubio_sink_get_samplerate_t)(aubio_sink_apple_audio_get_samplerate); 67 s->s_get_channels = (aubio_sink_get_channels_t)(aubio_sink_apple_audio_get_channels); 62 68 s->s_close = (aubio_sink_close_t)(aubio_sink_apple_audio_close); 63 69 s->s_del = (del_aubio_sink_t)(del_aubio_sink_apple_audio); … … 69 75 if (s->sink) { 70 76 s->s_do = (aubio_sink_do_t)(aubio_sink_sndfile_do); 77 s->s_do_multi = (aubio_sink_do_multi_t)(aubio_sink_sndfile_do_multi); 78 s->s_preset_samplerate = (aubio_sink_preset_samplerate_t)(aubio_sink_sndfile_preset_samplerate); 79 s->s_preset_channels = (aubio_sink_preset_channels_t)(aubio_sink_sndfile_preset_channels); 80 s->s_get_samplerate = (aubio_sink_get_samplerate_t)(aubio_sink_sndfile_get_samplerate); 81 s->s_get_channels = (aubio_sink_get_channels_t)(aubio_sink_sndfile_get_channels); 71 82 s->s_close = (aubio_sink_close_t)(aubio_sink_sndfile_close); 72 83 s->s_del = (del_aubio_sink_t)(del_aubio_sink_sndfile); … … 78 89 if (s->sink) { 79 90 s->s_do = (aubio_sink_do_t)(aubio_sink_wavwrite_do); 91 s->s_do_multi = (aubio_sink_do_multi_t)(aubio_sink_wavwrite_do_multi); 92 s->s_preset_samplerate = (aubio_sink_preset_samplerate_t)(aubio_sink_wavwrite_preset_samplerate); 93 s->s_preset_channels = (aubio_sink_preset_channels_t)(aubio_sink_wavwrite_preset_channels); 94 s->s_get_samplerate = (aubio_sink_get_samplerate_t)(aubio_sink_wavwrite_get_samplerate); 95 s->s_get_channels = (aubio_sink_get_channels_t)(aubio_sink_wavwrite_get_channels); 80 96 s->s_close = (aubio_sink_close_t)(aubio_sink_wavwrite_close); 81 97 s->s_del = (del_aubio_sink_t)(del_aubio_sink_wavwrite); … … 93 109 } 94 110 111 void aubio_sink_do_multi(aubio_sink_t * s, fmat_t * write_data, uint_t write) { 112 s->s_do_multi((void *)s->sink, write_data, write); 113 } 114 115 uint_t aubio_sink_preset_samplerate(aubio_sink_t * s, uint_t samplerate) { 116 return s->s_preset_samplerate((void *)s->sink, samplerate); 117 } 118 119 uint_t aubio_sink_preset_channels(aubio_sink_t * s, uint_t channels) { 120 return s->s_preset_channels((void *)s->sink, channels); 121 } 122 123 uint_t aubio_sink_get_samplerate(aubio_sink_t * s) { 124 return s->s_get_samplerate((void *)s->sink); 125 } 126 127 uint_t aubio_sink_get_channels(aubio_sink_t * s) { 128 return s->s_get_channels((void *)s->sink); 129 } 130 95 131 uint_t aubio_sink_close(aubio_sink_t *s) { 96 132 return s->s_close((void *)s->sink); -
src/io/sink.h
rc21553d r4ed4b1f 1 1 /* 2 Copyright (C) 2012-201 3Paul Brossier <piem@aubio.org>2 Copyright (C) 2012-2014 Paul Brossier <piem@aubio.org> 3 3 4 4 This file is part of aubio. … … 26 26 Media sink to write blocks of consecutive audio samples to file. 27 27 28 To read from file, use ::aubio_source_t. 29 28 30 \example io/test-sink.c 29 31 … … 48 50 Creates a new sink object. 49 51 52 If samplerate is set to 0, the creation of the file will be delayed until 53 both ::aubio_sink_preset_samplerate and ::aubio_sink_preset_channels have 54 been called. 55 50 56 */ 51 57 aubio_sink_t * new_aubio_sink(char_t * uri, uint_t samplerate); 58 59 /** 60 61 preset sink samplerate 62 63 \param s sink, created with ::new_aubio_sink 64 \param samplerate samplerate to preset the sink to, in Hz 65 66 \return 0 on success, 1 on error 67 68 Preset the samplerate of the sink. The file should have been created using a 69 samplerate of 0. 70 71 The file will be opened only when both samplerate and channels have been set. 72 73 */ 74 uint_t aubio_sink_preset_samplerate(aubio_sink_t *s, uint_t samplerate); 75 76 /** 77 78 preset sink channels 79 80 \param s sink, created with ::new_aubio_sink 81 \param channels number of channels to preset the sink to 82 83 \return 0 on success, 1 on error 84 85 Preset the samplerate of the sink. The file should have been created using a 86 samplerate of 0. 87 88 The file will be opened only when both samplerate and channels have been set. 89 90 */ 91 uint_t aubio_sink_preset_channels(aubio_sink_t *s, uint_t channels); 92 93 /** 94 95 get samplerate of sink object 96 97 \param s sink object, created with ::new_aubio_sink 98 \return samplerate, in Hz 99 100 */ 101 uint_t aubio_sink_get_samplerate(aubio_sink_t *s); 102 103 /** 104 105 get channels of sink object 106 107 \param s sink object, created with ::new_aubio_sink 108 \return number of channels 109 110 */ 111 uint_t aubio_sink_get_channels(aubio_sink_t *s); 52 112 53 113 /** … … 61 121 */ 62 122 void aubio_sink_do(aubio_sink_t * s, fvec_t * write_data, uint_t write); 123 124 /** 125 126 write polyphonic vector of length hop_size to sink 127 128 \param s sink, created with ::new_aubio_sink 129 \param write_data ::fmat_t samples to write to sink 130 \param write number of frames to write 131 132 */ 133 void aubio_sink_do_multi(aubio_sink_t * s, fmat_t * write_data, uint_t write); 63 134 64 135 /**
Note: See TracChangeset
for help on using the changeset viewer.