Changeset 50e10a9 for src/io/source_sndfile.c
- Timestamp:
- Sep 30, 2013, 5:18:49 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:
- a06ab19
- Parents:
- 8e7d66f
- git-author:
- Paul Brossier <piem@piem.org> (09/26/13 21:56:55)
- git-committer:
- Paul Brossier <piem@piem.org> (09/30/13 17:18:49)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/io/source_sndfile.c
r8e7d66f r50e10a9 59 59 // some temporary memory for sndfile to write at 60 60 uint_t scratch_size; 61 smpl_t *scratch_data;61 float *scratch_data; 62 62 }; 63 63 … … 199 199 } 200 200 201 /* de-interleaving data */ 202 for (j = 0; j < read_samples / input_channels; j++) { 203 for (i = 0; i < input_channels; i++) { 204 data[i][j] = (smpl_t)s->scratch_data[input_channels*j+i]; 205 } 206 } 207 // if read_data has more channels than the file 201 if (read_data->height < input_channels) { 202 // destination matrix has less channels than the file; copy only first 203 // channels of the file, de-interleaving data 204 for (j = 0; j < read_samples / input_channels; j++) { 205 for (i = 0; i < read_data->height; i++) { 206 data[i][j] = (smpl_t)s->scratch_data[j * input_channels + i]; 207 } 208 } 209 } else { 210 // destination matrix has as many or more channels than the file; copy each 211 // channel from the file to the destination matrix, de-interleaving data 212 for (j = 0; j < read_samples / input_channels; j++) { 213 for (i = 0; i < input_channels; i++) { 214 data[i][j] = (smpl_t)s->scratch_data[j * input_channels + i]; 215 } 216 } 217 } 218 208 219 if (read_data->height > input_channels) { 209 // copy last channel to all additional channels 220 // destination matrix has more channels than the file; copy last channel 221 // of the file to each additional channels, de-interleaving data 210 222 for (j = 0; j < read_samples / input_channels; j++) { 211 223 for (i = input_channels; i < read_data->height; i++) { 212 data[i][j] = s->scratch_data[j * input_channels + (input_channels - 1)];224 data[i][j] = (smpl_t)s->scratch_data[j * input_channels + (input_channels - 1)]; 213 225 } 214 226 }
Note: See TracChangeset
for help on using the changeset viewer.