+static
+void aubio_sink_wavwrite_write_frames(aubio_sink_wavwrite_t *s, uint_t write)
+{
+ uint_t written_frames = 0;
+
+ written_frames = fwrite(s->scratch_data, 2 * s->channels, write, s->fid);
+
+ if (written_frames != write) {
+ char errorstr[256];
+ AUBIO_STRERROR(errno, errorstr, sizeof(errorstr));
+ AUBIO_WRN("sink_wavwrite: trying to write %d frames to %s, but only %d"
+ " could be written (%s)\n", write, s->path, written_frames, errorstr);
+ }
+ s->total_frames_written += written_frames;
+}