}
else
Con_Print("SndSys_Init: fcntl(F_GETFL) failed!\n");
+
+ ioctl(audio_fd, SNDCTL_DSP_RESET, NULL);
// Set the fragment size (up to "NB_FRAGMENTS" fragments of "fragmentsize" bytes)
fragmentsize = requested->speed * requested->channels * requested->width / 5;
return false;
}
+#ifdef __linux__
+ alsaspeakerlayout = true;
+#else
+ alsaspeakerlayout = false;
+#endif
+
old_osstime = 0;
osssoundtime = 0;
snd_renderbuffer = Snd_CreateRingBuffer(requested, 0, NULL);
// Stop the sound and close the device
if (audio_fd >= 0)
{
- ioctl(audio_fd, SNDCTL_DSP_RESET, 0);
+ ioctl(audio_fd, SNDCTL_DSP_RESET, NULL);
close(audio_fd);
audio_fd = -1;
}
snd_renderbuffer->startframe += written / factor;
- if ((unsigned int)written < nbframes * factor)
+ if ((unsigned int)written < limit * factor)
{
- Con_Printf("SndSys_Submit: audio can't keep up! (%d < %u)\n", written, nbframes * factor);
+ Con_Printf("SndSys_Submit: audio can't keep up! (%u < %u)\n", written, limit * factor);
return;
}
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 < nbframes * factor)
+ Con_Printf("SndSys_Submit: audio can't keep up! (%u < %u)\n", written, nbframes * factor);
}