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
// needs fine tuning.. educated guesses
#define DSPK_RATE 128
#define DSPK_FREQ 31
#define DSPK_RATE 140
#define DSPK_BASE 170.0
#define DSPK_EXP 0.0433
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
unsigned short *dataus;
int samples, len, timeraccum, inrate, inaccum;
int samples, len, inrate, inaccum;
qbyte *outdata;
qbyte towrite;
double timeraccum, timerfreq;
if (datalen < 4)
return NULL;
@ -629,20 +631,24 @@ sfxcache_t *S_LoadDoomSpeakerSound (sfx_t *s, qbyte *data, int datalen, int snds
towrite = 0x40;
inrate = (int)((double)snd_speed / DSPK_RATE);
inaccum = inrate;
if (*data)
timerfreq = DSPK_BASE * pow((double)2.0, DSPK_EXP * (*data));
while (len > 0)
{
timeraccum += *data * DSPK_FREQ;
if (timeraccum > snd_speed)
timeraccum += timerfreq;
if (timeraccum > (float)snd_speed)
{
towrite ^= 0xFF; // swap speaker component
timeraccum -= snd_speed;
timeraccum -= (float)snd_speed;
}
inaccum--;
if (!inaccum)
{
data++;
if (*data)
timerfreq = DSPK_BASE * pow((double)2.0, DSPK_EXP * (*data));
inaccum = inrate;
}
*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);
if (type == REG_SZ && pathlen < sizeof(path))
RegQueryValueEx(hk, "servicepath", 0, NULL, path, &pathlen);
@ -1184,8 +1184,8 @@ void CreateSampleService(qboolean create)
else
{
HKEY hk;
RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\"DISTRIBUTION, &hk);
if (!hk)RegCreateKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\"DISTRIBUTION, &hk);
RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\"DISTRIBUTIONLONG"\\"FULLENGINENAME, &hk);
if (!hk)RegCreateKey(HKEY_LOCAL_MACHINE, "Software\\"DISTRIBUTIONLONG"\\"FULLENGINENAME, &hk);
RegSetValueEx(hk, "servicepath", 0, REG_SZ, path, strlen(path));
RegCloseKey(hk);