+ else
+ Con_Print("SndSys_Init: fcntl(F_GETFL) failed!\n");
+
+ // Set the fragment size (up to "NB_FRAGMENTS" fragments of "fragmentsize" bytes)
+ fragmentsize = requested->speed * requested->channels * requested->width / 10;
+ fragmentsize = (unsigned int)ceilf((float)fragmentsize / (float)NB_FRAGMENTS);
+ fragmentsize = CeilPowerOf2(fragmentsize);
+ ioctl_param = (NB_FRAGMENTS << 16) | log2i(fragmentsize);
+ if (ioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &ioctl_param) == -1)
+ {
+ Con_Print ("SndSys_Init: could not set the fragment size\n");
+ SndSys_Shutdown ();
+ return false;
+ }
+ Con_Printf ("SndSys_Init: using %u fragments of %u bytes\n",
+ ioctl_param >> 16, 1 << (ioctl_param & 0xFFFF));