- Con_Printf("S_PaintAndSubmit: WARNING: newsoundtime < soundtime (%u < %u)\n",
- newsoundtime, soundtime);
+ {
+ if ((cls.capturevideo_soundfile != NULL) != recording_sound)
+ {
+ unsigned int additionaltime;
+
+ // add some time to extrasoundtime make newsoundtime higher
+
+ // The extra time must be a multiple of the render buffer size
+ // to avoid modifying the current position in the buffer,
+ // some modules write directly to a shared (DMA) buffer
+ additionaltime = (soundtime - newsoundtime) + snd_renderbuffer->maxframes - 1;
+ additionaltime -= additionaltime % snd_renderbuffer->maxframes;
+
+ extrasoundtime += additionaltime;
+ newsoundtime += additionaltime;
+ Con_DPrintf("S_PaintAndSubmit: new extra sound time = %u\n",
+ extrasoundtime);
+ }
+ else
+ Con_Printf("S_PaintAndSubmit: WARNING: newsoundtime < soundtime (%u < %u)\n",
+ newsoundtime, soundtime);
+ }