mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 22:31:05 +00:00
Clean up default rate setting and add explicit support for 48kHz.
This commit is contained in:
parent
5feb0454ca
commit
c1a60551ae
1 changed files with 24 additions and 20 deletions
|
@ -237,32 +237,36 @@ SNDDMA_Init (void)
|
|||
|
||||
switch (rate) {
|
||||
case 0:
|
||||
rate = 44100;
|
||||
err = qfsnd_pcm_hw_params_set_rate_near (pcm, hw, &rate, 0);
|
||||
if (0 <= err) {
|
||||
frag_size = 32 * bps;
|
||||
} else {
|
||||
rate = 22050;
|
||||
err = qfsnd_pcm_hw_params_set_rate_near (pcm, hw, &rate, 0);
|
||||
if (0 <= err) {
|
||||
frag_size = 16 * bps;
|
||||
} else {
|
||||
rate = 11025;
|
||||
err = qfsnd_pcm_hw_params_set_rate_near (pcm, hw, &rate,
|
||||
0);
|
||||
{
|
||||
int rates[] = {
|
||||
48000,
|
||||
44100,
|
||||
22050,
|
||||
11025,
|
||||
0
|
||||
};
|
||||
int i;
|
||||
|
||||
for (i = 0; rates[i]; i++) {
|
||||
rate = rates[i];
|
||||
Sys_MaskPrintf (SYS_SND, "ALSA: trying %dHz\n", rate);
|
||||
err = qfsnd_pcm_hw_params_set_rate_near (pcm, hw,
|
||||
&rate, 0);
|
||||
if (0 <= err) {
|
||||
frag_size = 8 * bps;
|
||||
} else {
|
||||
Sys_Printf ("ALSA: no usable rates. %s\n",
|
||||
qfsnd_strerror (err));
|
||||
goto error;
|
||||
frag_size = 8 * bps * (rate / 11025);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
if (!rates[i]) {
|
||||
Sys_Printf ("ALSA: no usable rates. %s\n",
|
||||
qfsnd_strerror (err));
|
||||
goto error;
|
||||
}
|
||||
} break;
|
||||
case 11025:
|
||||
case 22050:
|
||||
case 44100:
|
||||
case 48000:
|
||||
default:
|
||||
err = qfsnd_pcm_hw_params_set_rate_near (pcm, hw, &rate, 0);
|
||||
if (0 > err) {
|
||||
|
|
Loading…
Reference in a new issue