From 771e2d4ab4f6712fd87c4cbfa04fb0884aff89df Mon Sep 17 00:00:00 2001 From: Mirko Buffoni Date: Wed, 21 Jan 2009 13:45:21 +0000 Subject: [PATCH] Fixed clamping to 12 bit range to Okim6376, and adjusted volume attenuation accordingly (Mirko Buffoni) --- src/emu/sound/okim6376.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/emu/sound/okim6376.c b/src/emu/sound/okim6376.c index 129ad957d7e..4947e912ba0 100644 --- a/src/emu/sound/okim6376.c +++ b/src/emu/sound/okim6376.c @@ -54,10 +54,10 @@ static int diff_lookup[49*16]; attenuation to apply to the sound signal. */ static int volume_table[4] = { - 0x10, // 0 dB - 0x08, // -6.0 dB - 0x04, // -12.0 dB - 0x02, // -24.0 dB + 0x20, // 0 dB + 0x10, // -6.0 dB + 0x08, // -12.0 dB + 0x04, // -24.0 dB }; /* tables computed? */ @@ -136,10 +136,10 @@ static INT16 clock_adpcm(struct ADPCMVoice *voice, UINT8 nibble) voice->signal += diff_lookup[voice->step * 16 + (nibble & 15)]; /* clamp to the maximum 12bit */ - if (voice->signal > 4095) - voice->signal = 4095; - else if (voice->signal < -4096) - voice->signal = -4096; + if (voice->signal > 2047) + voice->signal = 2047; + else if (voice->signal < -2048) + voice->signal = -2048; /* adjust the step size and clamp */ voice->step += index_shift[nibble & 7];