- if (ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &info)==-1)
- {
- perror("GETOSPACE");
- Con_Printf("Um, can't do GETOSPACE?\n");
- close(audio_fd);
- return 0;
- }
-
- shm = &sn;
- shm->splitbuffer = 0;
-
-// set sample bits & speed
-
- s = getenv("QUAKE_SOUND_SAMPLEBITS");
- if (s) shm->samplebits = atoi(s);
- else if ((i = COM_CheckParm("-sndbits")) != 0)
- shm->samplebits = atoi(com_argv[i+1]);
- if (shm->samplebits != 16 && shm->samplebits != 8)
- {
- ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &fmt);
- if (fmt & AFMT_S16_LE) shm->samplebits = 16;
- else if (fmt & AFMT_U8) shm->samplebits = 8;
- }
+ // Set the sound speed
+ ioctl_param = requested->speed;
+ if (ioctl(audio_fd, SNDCTL_DSP_SPEED, &ioctl_param) == -1 ||
+ (unsigned int)ioctl_param != requested->speed)
+ {
+ if ((unsigned int)ioctl_param != requested->speed && suggested != NULL)
+ {
+ memcpy(suggested, requested, sizeof(*suggested));
+ suggested->speed = ioctl_param;
+ }