attempt to fix waveout > 22Khz submit issues, support 8khz sound

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2262 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2006-05-09 20:43:39 +00:00
parent d18c74e47c
commit 968ddb9759
2 changed files with 21 additions and 4 deletions

View file

@ -181,14 +181,25 @@ static int SNDDMA_Init(soundcardinfo_t *sc, int *cardnum, int *drivernum)
int st = 0;
memset(sc, 0, sizeof(*sc));
if (snd_khz.value >= 45)
//set by a slider
if (!snd_khz.value)
sc->sn.speed = 22050;
/* else if (snd_khz.value >= 195)
sc->sn.speed = 200000;
else if (snd_khz.value >= 180)
sc->sn.speed = 192000;
else if (snd_khz.value >= 90)
sc->sn.speed = 96000; */
else if (snd_khz.value >= 45)
sc->sn.speed = 48000;
else if (snd_khz.value >= 30) //set by a slider
else if (snd_khz.value >= 30)
sc->sn.speed = 44100;
else if (snd_khz.value >= 20)
sc->sn.speed = 22050;
else
else if (snd_khz.value >= 10)
sc->sn.speed = 11025;
else
sc->sn.speed = 8000;
sd = &drivers[*drivernum];
if (!sd->ptr)

View file

@ -171,6 +171,7 @@ static void WAV_Submit(soundcardinfo_t *sc)
LPWAVEHDR h;
int wResult;
wavhandle_t *wh = sc->handle;
int chunkstosubmit;
//
// find which sound blocks have completed
@ -194,7 +195,12 @@ static void WAV_Submit(soundcardinfo_t *sc)
//
// submit two new sound blocks
//
while (((sc->snd_sent - sc->snd_completed) >> ((sc->sn.samplebits/8) - 1)) < 4)
if (sc->sn.speed <= 22050)
chunkstosubmit = 4;
else
chunkstosubmit = 4 + (sc->sn.speed/6000);
while (((sc->snd_sent - sc->snd_completed) >> ((sc->sn.samplebits/8) - 1)) < chunkstosubmit)
{
h = wh->lpWaveHdr + ( sc->snd_sent&WAV_MASK );