--- np2/sound/adpcmg.c 2004/02/04 10:30:55 1.4 +++ np2/sound/adpcmg.c 2005/02/07 14:46:12 1.6 @@ -23,7 +23,7 @@ REG8 SOUNDCALL adpcm_readsample(ADPCM ad pos += 8; } else { - const BYTE *ptr; + const UINT8 *ptr; REG8 bit; UINT tmp; ptr = ad->buf + ((pos >> 3) & 0x7fff); @@ -68,7 +68,7 @@ void SOUNDCALL adpcm_datawrite(ADPCM ad, pos += 8; } else { - BYTE *ptr; + UINT8 *ptr; UINT8 bit; UINT8 mask; ptr = ad->buf + ((pos >> 3) & 0x7fff); @@ -108,7 +108,7 @@ void SOUNDCALL adpcm_datawrite(ADPCM ad, } pos++; } - if (pos != ad->stop) { + if (pos == ad->stop) { pos &= 0x1fffff; ad->status |= 4; } @@ -135,7 +135,7 @@ static void SOUNDCALL getadpcmdata(ADPCM pos += ADPCM_NBR + 4; } else { - const BYTE *ptr; + const UINT8 *ptr; REG8 bit; UINT tmp; ptr = ad->buf + ((pos >> 3) & 0x7fff); @@ -160,10 +160,9 @@ static void SOUNDCALL getadpcmdata(ADPCM dir = data & 8; data &= 7; dlt = adpcmdeltatable[data] * ad->delta; -// dlt -= 12; dlt >>= 8; - if (dlt < 126) { - dlt = 126; + if (dlt < 127) { + dlt = 127; } else if (dlt > 24000) { dlt = 24000; @@ -191,7 +190,7 @@ static void SOUNDCALL getadpcmdata(ADPCM if (ad->reg.ctrl1 & 0x10) { pos = ad->start; ad->samp = 0; - ad->delta = 128; + ad->delta = 127; } else { pos &= 0x1fffff; @@ -208,7 +207,7 @@ static void SOUNDCALL getadpcmdata(ADPCM samp >>= (10 + 1); ad->out0 = ad->out1; ad->out1 = samp + ad->fb; - ad->fb = samp; // >> 1; + ad->fb = samp >> 1; } void SOUNDCALL adpcm_getpcm(ADPCM ad, SINT32 *pcm, UINT count) {