Changeset f5a97ed for src/io/sink_wavwrite.c
- Timestamp:
- Dec 20, 2018, 5:31:05 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:
- ec3f25f9
- Parents:
- a2b7187
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/io/sink_wavwrite.c
ra2b7187 rf5a97ed 289 289 uint_t data_size = s->total_frames_written * s->bitspersample * s->channels / 8; 290 290 unsigned char buf[5]; 291 size_t written = 0, err = 0; 291 292 if (!s->fid) return AUBIO_FAIL; 292 293 // ChunkSize 293 fseek(s->fid, 4, SEEK_SET);294 fwrite(write_little_endian(data_size + 36, buf, 4), 4, 1, s->fid);294 err += fseek(s->fid, 4, SEEK_SET); 295 written += fwrite(write_little_endian(data_size + 36, buf, 4), 4, 1, s->fid); 295 296 // Subchunk2Size 296 fseek(s->fid, 40, SEEK_SET); 297 fwrite(write_little_endian(data_size, buf, 4), 4, 1, s->fid); 297 err += fseek(s->fid, 40, SEEK_SET); 298 written += fwrite(write_little_endian(data_size, buf, 4), 4, 1, s->fid); 299 if (written != 2 || err != 0) { 300 char errorstr[256]; 301 AUBIO_STRERROR(errno, errorstr, sizeof(errorstr)); 302 AUBIO_WRN("sink_wavwrite: updating header of %s failed, expected %d" 303 " write but got only %d (%s)\n", s->path, 2, written, errorstr); 304 } 298 305 // close file 299 306 if (fclose(s->fid)) { 300 AUBIO_ERR("sink_wavwrite: Error closing file %s (%s)\n", s->path, strerror(errno)); 307 char errorstr[256]; 308 AUBIO_STRERROR(errno, errorstr, sizeof(errorstr)); 309 AUBIO_ERR("sink_wavwrite: Error closing file %s (%s)\n", s->path, errorstr); 301 310 } 302 311 s->fid = NULL;
Note: See TracChangeset
for help on using the changeset viewer.