view alaw.c @ 331:0f1737e626fa

- Changed keypress-detection from keydown to keyup, seems to fix keyrepeat bug (key had to be pressed twice to be detected) - Changed key-handling: 'f' cycles fullscreen/windowed, ESC/RETURN/'q' quits - Bugfix which avoids exit, because return is passed to sdl-output on startup, which caused the player to exit (keyboard-buffer problem? better solution recommed)
author atmosfear
date Tue, 10 Apr 2001 21:41:31 +0000
parents 3b5f5d1c5041
children b562c8bcf704
line wrap: on
line source

// code from xanim sources...
// (I hope that not hurt copyright :o)

#define xaLONG long
#define xaULONG unsigned long
#define xaBYTE char
#define xaUBYTE unsigned char

xaULONG long xa_alaw_2_sign[256];

void Gen_aLaw_2_Signed()
{ xaULONG i;
  for(i=0;i<256;i++)
  { xaUBYTE data = (xaUBYTE)(i);
    xaLONG d, t, seg;

    data ^= 0x55;

    t = (data & 0xf) << 4;
    seg = (data & 0x70) >> 4;
    if (seg == 0)	t += 8;
    else if (seg == 1)	t += 0x108;
    else	{ t += 108; t <<= seg - 1; }

    d =  (data & 0x80)?(t):(-t);
    xa_alaw_2_sign[i] = (xaULONG)((xaULONG)(d) & 0xffff);
  }
}