support non-power of 2 sound buffer sizes, attempted fix for command line not being parsed correctly with dedicated server crash restart

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2260 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2006-05-09 19:29:14 +00:00
parent 11b188b761
commit 4c566992e4
3 changed files with 10 additions and 8 deletions

View File

@ -56,7 +56,7 @@ void S_TransferPaintBuffer(soundcardinfo_t *sc, int endtime)
{
int startidx, out_idx;
int count;
int out_mask;
int outlimit;
int *p;
int *skip;
int *cskip;
@ -68,8 +68,8 @@ void S_TransferPaintBuffer(soundcardinfo_t *sc, int endtime)
skip = paintskip[sc->sn.numchannels-1];
cskip = chnskip[sc->sn.numchannels-1];
count = (endtime - sc->paintedtime) * sc->sn.numchannels;
out_mask = sc->sn.samples - 1;
startidx = out_idx = (sc->paintedtime * sc->sn.numchannels) & out_mask;
outlimit = sc->sn.samples;
startidx = out_idx = (sc->paintedtime * sc->sn.numchannels) % outlimit;
snd_vol = volume.value*256;
pbuf = sc->Lock(sc);
@ -88,7 +88,7 @@ void S_TransferPaintBuffer(soundcardinfo_t *sc, int endtime)
else if (val < (short)0x8000)
val = (short)0x8000;
out[out_idx] = val;
out_idx = (out_idx + 1) & out_mask;
out_idx = (out_idx + 1) % outlimit;
skip += *cskip;
cskip += *cskip;
}
@ -99,7 +99,7 @@ void S_TransferPaintBuffer(soundcardinfo_t *sc, int endtime)
if (out_idx <= startidx) // buffer looped
{
Media_RecordAudioFrame(out + startidx, (sc->sn.samples - startidx) / 2);
Media_RecordAudioFrame(out, out_idx / (2*2));
Media_RecordAudioFrame(out, out_idx / 2);
}
else
Media_RecordAudioFrame(out + startidx, (out_idx - startidx) / 2);
@ -117,7 +117,7 @@ void S_TransferPaintBuffer(soundcardinfo_t *sc, int endtime)
else if (val < (short)0x8000)
val = (short)0x8000;
out[out_idx] = (val>>8) + 128;
out_idx = (out_idx + 1) & out_mask;
out_idx = (out_idx + 1) & outlimit;
skip += *cskip;
cskip += *cskip;
}

View File

@ -172,7 +172,6 @@ void SV_SetMaster_f (void)
svs.last_heartbeat = -99999;
}
/*
==================
SV_Quit_f

View File

@ -289,6 +289,8 @@ void Sys_Error (const char *error, ...)
va_list argptr;
char text[1024];
double end;
LPWSTR *szArglist;
int nArgs;
va_start (argptr,error);
vsnprintf (text,sizeof(text)-1, error,argptr);
@ -329,7 +331,8 @@ void Sys_Error (const char *error, ...)
// free(host_parms.membase); //get rid of the mem. We don't need it now.
// system("dqwsv.exe"); //spawn a new server to take over. This way, if debugging, then any key will quit, otherwise the server will just spawn a new one.
GetModuleFileName(NULL, text, sizeof(text));
spawnl(P_NOWAIT|P_OVERLAY, text, text, GetCommandLine(), NULL);
szArglist = CommandLineToArgV(GetCommandLine(), &nArgs);
spawnv(P_NOWAIT|P_OVERLAY, text, text, szArglist);
Sys_Quit ();
}