+ written = write (audio_fd, &snd_renderbuffer->ring[startoffset * factor], limit * factor);
+ if (written < 0)
+ {
+ Con_Printf("SndSys_Submit: audio write returned %d!\n", written);
+ return;
+ }
+
+ if (written % factor != 0)
+ Sys_Error("SndSys_Submit: nb of bytes written (%d) isn't aligned to a frame sample!\n", written);
+
+ snd_renderbuffer->startframe += written / factor;
+
+ if ((unsigned int)written < limit * factor)
+ {
+ Con_Printf("SndSys_Submit: audio can't keep up! (%u < %u)\n", written, limit * factor);
+ return;
+ }
+
+ nbframes -= limit;
+ startoffset = 0;
+ }
+
+ written = write (audio_fd, &snd_renderbuffer->ring[startoffset * factor], nbframes * factor);
+ if (written < 0)
+ {
+ Con_Printf("SndSys_Submit: audio write returned %d!\n", written);
+ return;