mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-10 22:51:57 +00:00
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:
parent
11b188b761
commit
4c566992e4
3 changed files with 10 additions and 8 deletions
|
@ -56,7 +56,7 @@ void S_TransferPaintBuffer(soundcardinfo_t *sc, int endtime)
|
||||||
{
|
{
|
||||||
int startidx, out_idx;
|
int startidx, out_idx;
|
||||||
int count;
|
int count;
|
||||||
int out_mask;
|
int outlimit;
|
||||||
int *p;
|
int *p;
|
||||||
int *skip;
|
int *skip;
|
||||||
int *cskip;
|
int *cskip;
|
||||||
|
@ -68,8 +68,8 @@ void S_TransferPaintBuffer(soundcardinfo_t *sc, int endtime)
|
||||||
skip = paintskip[sc->sn.numchannels-1];
|
skip = paintskip[sc->sn.numchannels-1];
|
||||||
cskip = chnskip[sc->sn.numchannels-1];
|
cskip = chnskip[sc->sn.numchannels-1];
|
||||||
count = (endtime - sc->paintedtime) * sc->sn.numchannels;
|
count = (endtime - sc->paintedtime) * sc->sn.numchannels;
|
||||||
out_mask = sc->sn.samples - 1;
|
outlimit = sc->sn.samples;
|
||||||
startidx = out_idx = (sc->paintedtime * sc->sn.numchannels) & out_mask;
|
startidx = out_idx = (sc->paintedtime * sc->sn.numchannels) % outlimit;
|
||||||
snd_vol = volume.value*256;
|
snd_vol = volume.value*256;
|
||||||
|
|
||||||
pbuf = sc->Lock(sc);
|
pbuf = sc->Lock(sc);
|
||||||
|
@ -88,7 +88,7 @@ void S_TransferPaintBuffer(soundcardinfo_t *sc, int endtime)
|
||||||
else if (val < (short)0x8000)
|
else if (val < (short)0x8000)
|
||||||
val = (short)0x8000;
|
val = (short)0x8000;
|
||||||
out[out_idx] = val;
|
out[out_idx] = val;
|
||||||
out_idx = (out_idx + 1) & out_mask;
|
out_idx = (out_idx + 1) % outlimit;
|
||||||
skip += *cskip;
|
skip += *cskip;
|
||||||
cskip += *cskip;
|
cskip += *cskip;
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ void S_TransferPaintBuffer(soundcardinfo_t *sc, int endtime)
|
||||||
if (out_idx <= startidx) // buffer looped
|
if (out_idx <= startidx) // buffer looped
|
||||||
{
|
{
|
||||||
Media_RecordAudioFrame(out + startidx, (sc->sn.samples - startidx) / 2);
|
Media_RecordAudioFrame(out + startidx, (sc->sn.samples - startidx) / 2);
|
||||||
Media_RecordAudioFrame(out, out_idx / (2*2));
|
Media_RecordAudioFrame(out, out_idx / 2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Media_RecordAudioFrame(out + startidx, (out_idx - startidx) / 2);
|
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)
|
else if (val < (short)0x8000)
|
||||||
val = (short)0x8000;
|
val = (short)0x8000;
|
||||||
out[out_idx] = (val>>8) + 128;
|
out[out_idx] = (val>>8) + 128;
|
||||||
out_idx = (out_idx + 1) & out_mask;
|
out_idx = (out_idx + 1) & outlimit;
|
||||||
skip += *cskip;
|
skip += *cskip;
|
||||||
cskip += *cskip;
|
cskip += *cskip;
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,7 +172,6 @@ void SV_SetMaster_f (void)
|
||||||
svs.last_heartbeat = -99999;
|
svs.last_heartbeat = -99999;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==================
|
==================
|
||||||
SV_Quit_f
|
SV_Quit_f
|
||||||
|
|
|
@ -289,6 +289,8 @@ void Sys_Error (const char *error, ...)
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
char text[1024];
|
char text[1024];
|
||||||
double end;
|
double end;
|
||||||
|
LPWSTR *szArglist;
|
||||||
|
int nArgs;
|
||||||
|
|
||||||
va_start (argptr,error);
|
va_start (argptr,error);
|
||||||
vsnprintf (text,sizeof(text)-1, error,argptr);
|
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.
|
// 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.
|
// 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));
|
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 ();
|
Sys_Quit ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue