Changeset 2722dc7
- Timestamp:
- Aug 26, 2014, 5:24:09 AM (10 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:
- 79b54ea
- Parents:
- 28c066e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/io/source_sndfile.c
r28c066e r2722dc7 152 152 void aubio_source_sndfile_do(aubio_source_sndfile_t * s, fvec_t * read_data, uint_t * read){ 153 153 uint_t i,j, input_channels = s->input_channels; 154 /* do actual reading*/154 /* read from file into scratch_data */ 155 155 sf_count_t read_samples = sf_read_float (s->handle, s->scratch_data, s->scratch_size); 156 156 157 smpl_t *data;158 159 #ifdef HAVE_SAMPLERATE 160 if (s->ratio != 1) { 161 data = s->input_data->data;157 /* where to store de-interleaved data */ 158 smpl_t *ptr_data; 159 #ifdef HAVE_SAMPLERATE 160 if (s->ratio != 1) { 161 ptr_data = s->input_data->data; 162 162 } else 163 163 #endif /* HAVE_SAMPLERATE */ 164 164 { 165 data = read_data->data;165 ptr_data = read_data->data; 166 166 } 167 167 168 168 /* de-interleaving and down-mixing data */ 169 169 for (j = 0; j < read_samples / input_channels; j++) { 170 data[j] = 0;170 ptr_data[j] = 0; 171 171 for (i = 0; i < input_channels; i++) { 172 data[j] += s->scratch_data[input_channels*j+i];173 } 174 data[j] /= (smpl_t)input_channels;172 ptr_data[j] += s->scratch_data[input_channels*j+i]; 173 } 174 ptr_data[j] /= (smpl_t)input_channels; 175 175 } 176 176 … … 196 196 sf_count_t read_samples = sf_read_float (s->handle, s->scratch_data, s->scratch_size); 197 197 198 smpl_t **data;199 198 /* where to store de-interleaved data */ 199 smpl_t **ptr_data; 200 200 #ifdef HAVE_SAMPLERATE 201 201 if (s->ratio != 1) { 202 202 AUBIO_ERR("source_sndfile: no multi channel resampling yet"); 203 203 return; 204 // data = s->input_data->data;204 //ptr_data = s->input_data->data; 205 205 } else 206 206 #endif /* HAVE_SAMPLERATE */ 207 207 { 208 data = read_data->data;208 ptr_data = read_data->data; 209 209 } 210 210 … … 214 214 for (j = 0; j < read_samples / input_channels; j++) { 215 215 for (i = 0; i < read_data->height; i++) { 216 data[i][j] = (smpl_t)s->scratch_data[j * input_channels + i];216 ptr_data[i][j] = (smpl_t)s->scratch_data[j * input_channels + i]; 217 217 } 218 218 } … … 222 222 for (j = 0; j < read_samples / input_channels; j++) { 223 223 for (i = 0; i < input_channels; i++) { 224 data[i][j] = (smpl_t)s->scratch_data[j * input_channels + i];224 ptr_data[i][j] = (smpl_t)s->scratch_data[j * input_channels + i]; 225 225 } 226 226 } … … 232 232 for (j = 0; j < read_samples / input_channels; j++) { 233 233 for (i = input_channels; i < read_data->height; i++) { 234 data[i][j] = (smpl_t)s->scratch_data[j * input_channels + (input_channels - 1)];234 ptr_data[i][j] = (smpl_t)s->scratch_data[j * input_channels + (input_channels - 1)]; 235 235 } 236 236 }
Note: See TracChangeset
for help on using the changeset viewer.