mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-22 20:11:44 +00:00
Let's fix the sound code so it doesn't loop infinatly, shall we?
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1096 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
59fdc17d94
commit
973d26da3e
1 changed files with 5 additions and 22 deletions
|
@ -71,11 +71,10 @@ static int OSS_InitCard(soundcardinfo_t *sc, int cardnum)
|
||||||
|
|
||||||
soundcardinfo_t *ec;
|
soundcardinfo_t *ec;
|
||||||
|
|
||||||
devname = Cvar_Get("snd_devicename", "/dev/dsp", 0, "Sound controls");
|
devname = Cvar_Get(va("snd_devicename%i", cardnum+1), cardnum?"":"/dev/dsp", 0, "Sound controls");
|
||||||
snddev = devname->string;
|
snddev = devname->string;
|
||||||
|
|
||||||
for (ec = sndcardinfo; ec; ec = ec->next)
|
if (!*snddev)
|
||||||
if (!strcmp(ec->name, snddev))
|
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
sc->inactive_sound = true; //linux sound devices always play sound, even when we're not the active app...
|
sc->inactive_sound = true; //linux sound devices always play sound, even when we're not the active app...
|
||||||
|
@ -89,25 +88,9 @@ static int OSS_InitCard(soundcardinfo_t *sc, int cardnum)
|
||||||
{
|
{
|
||||||
perror(snddev);
|
perror(snddev);
|
||||||
Con_Printf("Could not open %s\n", snddev);
|
Con_Printf("Could not open %s\n", snddev);
|
||||||
|
|
||||||
devname = Cvar_Get("snd_devicename2", "", 0, "Sound controls");
|
|
||||||
snddev = devname->string;
|
|
||||||
if (*snddev) //try a secondary if they named one
|
|
||||||
{
|
|
||||||
printf("Initing sound device %s\n", snddev);
|
|
||||||
sc->audio_fd = open(snddev, O_RDWR | O_NONBLOCK);
|
|
||||||
|
|
||||||
if (sc->audio_fd < 0)
|
|
||||||
Con_Printf("Could not open %s\n", snddev);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sc->audio_fd < 0)
|
|
||||||
{
|
|
||||||
Con_Printf("Running without sound\n");
|
|
||||||
OSS_Shutdown(sc);
|
OSS_Shutdown(sc);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Q_strncpyz(sc->name, snddev, sizeof(sc->name));
|
Q_strncpyz(sc->name, snddev, sizeof(sc->name));
|
||||||
|
|
||||||
rc = ioctl(sc->audio_fd, SNDCTL_DSP_RESET, 0);
|
rc = ioctl(sc->audio_fd, SNDCTL_DSP_RESET, 0);
|
||||||
|
|
Loading…
Reference in a new issue