1
0
Fork 0
forked from fte/fteqw

change registry entry for win32 dedicated for future use

misc sound fix

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3032 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2008-09-11 03:39:34 +00:00
parent 704fb438c9
commit fcbfb0e22c
2 changed files with 16 additions and 10 deletions

View file

@ -580,9 +580,10 @@ void ResampleSfx (sfx_t *sfx, int inrate, int inwidth, qbyte *data)
//============================================================================= //=============================================================================
#ifdef DOOMWADS #ifdef DOOMWADS
// needs fine tuning.. educated guesses #define DSPK_RATE 140
#define DSPK_RATE 128 #define DSPK_BASE 170.0
#define DSPK_FREQ 31 #define DSPK_EXP 0.0433
sfxcache_t *S_LoadDoomSpeakerSound (sfx_t *s, qbyte *data, int datalen, int sndspeed) sfxcache_t *S_LoadDoomSpeakerSound (sfx_t *s, qbyte *data, int datalen, int sndspeed)
{ {
@ -590,9 +591,10 @@ sfxcache_t *S_LoadDoomSpeakerSound (sfx_t *s, qbyte *data, int datalen, int snds
// format data from Unofficial Doom Specs v1.6 // format data from Unofficial Doom Specs v1.6
unsigned short *dataus; unsigned short *dataus;
int samples, len, timeraccum, inrate, inaccum; int samples, len, inrate, inaccum;
qbyte *outdata; qbyte *outdata;
qbyte towrite; qbyte towrite;
double timeraccum, timerfreq;
if (datalen < 4) if (datalen < 4)
return NULL; return NULL;
@ -629,20 +631,24 @@ sfxcache_t *S_LoadDoomSpeakerSound (sfx_t *s, qbyte *data, int datalen, int snds
towrite = 0x40; towrite = 0x40;
inrate = (int)((double)snd_speed / DSPK_RATE); inrate = (int)((double)snd_speed / DSPK_RATE);
inaccum = inrate; inaccum = inrate;
if (*data)
timerfreq = DSPK_BASE * pow((double)2.0, DSPK_EXP * (*data));
while (len > 0) while (len > 0)
{ {
timeraccum += *data * DSPK_FREQ; timeraccum += timerfreq;
if (timeraccum > snd_speed) if (timeraccum > (float)snd_speed)
{ {
towrite ^= 0xFF; // swap speaker component towrite ^= 0xFF; // swap speaker component
timeraccum -= snd_speed; timeraccum -= (float)snd_speed;
} }
inaccum--; inaccum--;
if (!inaccum) if (!inaccum)
{ {
data++; data++;
if (*data)
timerfreq = DSPK_BASE * pow((double)2.0, DSPK_EXP * (*data));
inaccum = inrate; inaccum = inrate;
} }
*outdata = towrite; *outdata = towrite;

View file

@ -1046,7 +1046,7 @@ void WINAPI StartQuakeServerService (DWORD argc, LPTSTR *argv)
} }
RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\FTE", &hk); RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\"DISTRIBUTIONLONG"\\"FULLENGINENAME, &hk);
RegQueryValueEx(hk, "servicepath", 0, &type, NULL, &pathlen); RegQueryValueEx(hk, "servicepath", 0, &type, NULL, &pathlen);
if (type == REG_SZ && pathlen < sizeof(path)) if (type == REG_SZ && pathlen < sizeof(path))
RegQueryValueEx(hk, "servicepath", 0, NULL, path, &pathlen); RegQueryValueEx(hk, "servicepath", 0, NULL, path, &pathlen);
@ -1184,8 +1184,8 @@ void CreateSampleService(qboolean create)
else else
{ {
HKEY hk; HKEY hk;
RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\"DISTRIBUTION, &hk); RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\"DISTRIBUTIONLONG"\\"FULLENGINENAME, &hk);
if (!hk)RegCreateKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\"DISTRIBUTION, &hk); if (!hk)RegCreateKey(HKEY_LOCAL_MACHINE, "Software\\"DISTRIBUTIONLONG"\\"FULLENGINENAME, &hk);
RegSetValueEx(hk, "servicepath", 0, REG_SZ, path, strlen(path)); RegSetValueEx(hk, "servicepath", 0, REG_SZ, path, strlen(path));
RegCloseKey(hk); RegCloseKey(hk);