Changeset 4865e4b for src/io/source_sndfile.c
- Timestamp:
- Mar 22, 2013, 2:29:19 AM (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:
- ae9fd90
- Parents:
- 7982203
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/io/source_sndfile.c
r7982203 r4865e4b 159 159 data[j] = 0; 160 160 for (i = 0; i < input_channels; i++) { 161 data[j] += (smpl_t)s->scratch_data[input_channels*j+i];161 data[j] += s->scratch_data[input_channels*j+i]; 162 162 } 163 163 data[j] /= (smpl_t)input_channels; … … 173 173 } 174 174 175 void aubio_source_sndfile_do_multi(aubio_source_sndfile_t * s, fmat_t * read_data, uint_t * read){ 176 uint_t i,j, input_channels = s->input_channels; 177 /* do actual reading */ 178 sf_count_t read_samples = sf_read_float (s->handle, s->scratch_data, s->scratch_size); 179 180 smpl_t **data; 181 182 #ifdef HAVE_SAMPLERATE 183 if (s->ratio != 1) { 184 AUBIO_ERR("source_sndfile: no multi channel resampling yet"); 185 return; 186 data = s->input_data->data; 187 } else 188 #endif /* HAVE_SAMPLERATE */ 189 { 190 data = read_data->data; 191 } 192 193 /* de-interleaving data */ 194 for (j = 0; j < read_samples / input_channels; j++) { 195 for (i = 0; i < input_channels; i++) { 196 data[i][j] = (smpl_t)s->scratch_data[input_channels*j+i]; 197 } 198 } 199 200 #ifdef HAVE_SAMPLERATE 201 if (s->resampler) { 202 aubio_resampler_do(s->resampler, s->input_data, read_data); 203 } 204 #endif /* HAVE_SAMPLERATE */ 205 206 *read = (int)FLOOR(s->ratio * read_samples / input_channels + .5); 207 } 208 175 209 uint_t aubio_source_sndfile_get_samplerate(aubio_source_sndfile_t * s) { 176 210 return s->samplerate; 211 } 212 213 uint_t aubio_source_sndfile_get_channels(aubio_source_sndfile_t * s) { 214 return s->input_channels; 177 215 } 178 216
Note: See TracChangeset
for help on using the changeset viewer.