Changeset 4f75d8a for src/io/sink_sndfile.c
- Timestamp:
- Dec 16, 2018, 7:09:50 PM (6 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/timestretch, fix/ffmpeg5, master
- Children:
- e4c6c76
- Parents:
- 4eb48e6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/io/sink_sndfile.c
r4eb48e6 r4f75d8a 159 159 160 160 void aubio_sink_sndfile_do(aubio_sink_sndfile_t *s, fvec_t * write_data, uint_t write){ 161 uint_t i, j, channels = s->channels; 162 int nsamples = 0; 163 smpl_t *pwrite; 161 uint_t i, j; 164 162 sf_count_t written_frames; 165 166 if (write > s->max_size) { 167 AUBIO_WRN("sink_sndfile: trying to write %d frames, but only %d can be written at a time\n", 168 write, s->max_size); 169 write = s->max_size; 170 } 171 172 nsamples = channels * write; 163 uint_t channels = s->channels; 164 uint_t length = aubio_sink_validate_input_length("sink_sndfile", s->path, 165 s->max_size, write_data->length, write); 166 int nsamples = channels * length; 173 167 174 168 /* interleaving data */ 175 169 for ( i = 0; i < channels; i++) { 176 pwrite = (smpl_t *)write_data->data; 177 for (j = 0; j < write; j++) { 178 s->scratch_data[channels*j+i] = pwrite[j]; 170 for (j = 0; j < length; j++) { 171 s->scratch_data[channels*j+i] = write_data->data[j]; 179 172 } 180 173 } … … 189 182 190 183 void aubio_sink_sndfile_do_multi(aubio_sink_sndfile_t *s, fmat_t * write_data, uint_t write){ 191 uint_t i, j, channels = s->channels; 192 int nsamples = 0; 193 smpl_t *pwrite; 184 uint_t i, j; 194 185 sf_count_t written_frames; 195 196 if (write > s->max_size) { 197 AUBIO_WRN("sink_sndfile: trying to write %d frames, but only %d can be written at a time\n", 198 write, s->max_size); 199 write = s->max_size; 200 } 201 202 nsamples = channels * write; 186 uint_t channels = aubio_sink_validate_input_channels("sink_sndfile", s->path, 187 s->channels, write_data->height); 188 uint_t length = aubio_sink_validate_input_length("sink_sndfile", s->path, 189 s->max_size, write_data->length, write); 190 int nsamples = channels * length; 203 191 204 192 /* interleaving data */ 205 for ( i = 0; i < write_data->height; i++) { 206 pwrite = (smpl_t *)write_data->data[i]; 207 for (j = 0; j < write; j++) { 208 s->scratch_data[channels*j+i] = pwrite[j]; 193 for ( i = 0; i < channels; i++) { 194 for (j = 0; j < length; j++) { 195 s->scratch_data[channels*j+i] = write_data->data[i][j]; 209 196 } 210 197 }
Note: See TracChangeset
for help on using the changeset viewer.