mirror of
https://git.code.sf.net/p/quake/newtree
synced 2024-11-10 23:02:16 +00:00
compiles with latest alsa cvs, but doesn't work yet :/
This commit is contained in:
parent
5c82660a2c
commit
2ba8191ff2
1 changed files with 23 additions and 26 deletions
|
@ -53,38 +53,39 @@ int
|
||||||
check_card (int card)
|
check_card (int card)
|
||||||
{
|
{
|
||||||
snd_ctl_t *handle;
|
snd_ctl_t *handle;
|
||||||
snd_ctl_hw_info_t info;
|
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if ((rc = snd_ctl_open (&handle, va ("hw:%d", card))) < 0) {
|
if ((rc = snd_ctl_open (&handle, va ("hw:%d", card))) < 0) {
|
||||||
Con_Printf ("Error: control open (%i): %s\n", card, snd_strerror (rc));
|
Con_Printf ("Error: control open (%i): %s\n", card, snd_strerror (rc));
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
if ((rc = snd_ctl_hw_info (handle, &info)) < 0) {
|
|
||||||
Con_Printf ("Error: control hardware info (%i): %s\n", card,
|
|
||||||
snd_strerror (rc));
|
|
||||||
snd_ctl_close (handle);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
snd_ctl_close (handle);
|
|
||||||
if (dev == -1) {
|
if (dev == -1) {
|
||||||
for (dev = 0; dev < info.pcmdevs; dev++) {
|
while (1) {
|
||||||
|
if ((rc = snd_ctl_pcm_next_device (handle, &dev)) < 0) {
|
||||||
|
Con_Printf ("Error: next device: %s\n", snd_strerror (rc));
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
if (dev < 0)
|
||||||
|
break;
|
||||||
if ((rc = snd_pcm_open (&pcm_handle, va ("hw:%d,%d", card, dev),
|
if ((rc = snd_pcm_open (&pcm_handle, va ("hw:%d,%d", card, dev),
|
||||||
SND_PCM_STREAM_PLAYBACK,
|
SND_PCM_STREAM_PLAYBACK,
|
||||||
SND_PCM_NONBLOCK)) == 0) {
|
SND_PCM_NONBLOCK)) == 0) {
|
||||||
return 0;
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (dev >= 0 && dev < info.pcmdevs) {
|
if ((rc = snd_pcm_open (&pcm_handle, va ("hw:%d,%d", card, dev),
|
||||||
if ((rc = snd_pcm_open (&pcm_handle, va ("hw:%d,%d", card, dev),
|
SND_PCM_STREAM_PLAYBACK,
|
||||||
SND_PCM_STREAM_PLAYBACK,
|
SND_PCM_NONBLOCK)) == 0) {
|
||||||
SND_PCM_NONBLOCK)) == 0) {
|
goto exit;
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Con_Printf ("Error: snd_pcm_open %d: %s\n", dev, snd_strerror (rc));
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
return 1;
|
rc = 1;
|
||||||
|
exit:
|
||||||
|
snd_ctl_close(handle);
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean
|
qboolean
|
||||||
|
@ -93,13 +94,7 @@ SNDDMA_Init (void)
|
||||||
int rc = 0, i;
|
int rc = 0, i;
|
||||||
char *err_msg = "";
|
char *err_msg = "";
|
||||||
int rate = -1, format = -1, stereo = -1, frag_size;
|
int rate = -1, format = -1, stereo = -1, frag_size;
|
||||||
unsigned int mask;
|
|
||||||
|
|
||||||
mask = snd_cards_mask ();
|
|
||||||
if (!mask) {
|
|
||||||
Con_Printf ("No sound cards detected\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if ((i = COM_CheckParm ("-sndcard")) != 0) {
|
if ((i = COM_CheckParm ("-sndcard")) != 0) {
|
||||||
card = atoi (com_argv[i + 1]);
|
card = atoi (com_argv[i + 1]);
|
||||||
}
|
}
|
||||||
|
@ -128,9 +123,11 @@ SNDDMA_Init (void)
|
||||||
stereo = 0;
|
stereo = 0;
|
||||||
}
|
}
|
||||||
if (card == -1) {
|
if (card == -1) {
|
||||||
for (card = 0; card < SND_CARDS; card++) {
|
if (snd_card_next(&card) < 0 || card < 0) {
|
||||||
if (!(mask & (1 << card)))
|
Con_Printf ("No sound cards detected\n");
|
||||||
continue;
|
return 0;
|
||||||
|
}
|
||||||
|
while (card >= 0) {
|
||||||
rc = check_card (card);
|
rc = check_card (card);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue