Changeset e4c6c76 for src/io/sink_wavwrite.c
- Timestamp:
- Dec 16, 2018, 7:10:35 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:
- 6f601bd
- Parents:
- 4f75d8a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/io/sink_wavwrite.c
r4f75d8a re4c6c76 235 235 void aubio_sink_wavwrite_do(aubio_sink_wavwrite_t *s, fvec_t * write_data, uint_t write){ 236 236 uint_t c = 0, i = 0, written_frames = 0; 237 238 if (write > s->max_size) { 239 AUBIO_WRN("sink_wavwrite: trying to write %d frames to %s, " 240 "but only %d can be written at a time\n", write, s->path, s->max_size); 241 write = s->max_size; 242 } 237 uint_t length = aubio_sink_validate_input_length("sink_wavwrite", s->path, 238 s->max_size, write_data->length, write); 243 239 244 240 for (c = 0; c < s->channels; c++) { 245 for (i = 0; i < write; i++) {241 for (i = 0; i < length; i++) { 246 242 s->scratch_data[i * s->channels + c] = HTOLES(FLOAT_TO_SHORT(write_data->data[i])); 247 243 } 248 244 } 249 written_frames = fwrite(s->scratch_data, 2, write* s->channels, s->fid);245 written_frames = fwrite(s->scratch_data, 2, length * s->channels, s->fid); 250 246 251 247 if (written_frames != write) { … … 260 256 uint_t c = 0, i = 0, written_frames = 0; 261 257 262 if (write > s->max_size) { 263 AUBIO_WRN("sink_wavwrite: trying to write %d frames to %s, " 264 "but only %d can be written at a time\n", write, s->path, s->max_size); 265 write = s->max_size; 266 } 267 268 for (c = 0; c < s->channels; c++) { 269 for (i = 0; i < write; i++) { 258 uint_t channels = aubio_sink_validate_input_channels("sink_wavwrite", s->path, 259 s->channels, write_data->height); 260 uint_t length = aubio_sink_validate_input_length("sink_wavwrite", s->path, 261 s->max_size, write_data->length, write); 262 263 for (c = 0; c < channels; c++) { 264 for (i = 0; i < length; i++) { 270 265 s->scratch_data[i * s->channels + c] = HTOLES(FLOAT_TO_SHORT(write_data->data[c][i])); 271 266 } 272 267 } 273 written_frames = fwrite(s->scratch_data, 2, write* s->channels, s->fid);268 written_frames = fwrite(s->scratch_data, 2, length * s->channels, s->fid); 274 269 275 270 if (written_frames != write * s->channels) {
Note: See TracChangeset
for help on using the changeset viewer.