summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/sound/aica.cpp
diff options
context:
space:
mode:
author MetalliC <0vetal0@gmail.com>2016-08-19 18:49:11 +0300
committer MetalliC <0vetal0@gmail.com>2016-08-19 18:55:58 +0300
commit3a6e75ca7d5728a8f88b987d77dabd511e135211 (patch)
tree481ec1d0476c450f033b38e990670e7c4c71ffcb /src/devices/sound/aica.cpp
parent53962aff613cd5668c852e2648fd9ae2eedca195 (diff)
aica: add ADPCM diff value clamp based on encoder research [kode54, MetalliC]
if there is known issues with YMZ280B it might be worth try to same decoder there
Diffstat (limited to 'src/devices/sound/aica.cpp')
-rw-r--r--src/devices/sound/aica.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/devices/sound/aica.cpp b/src/devices/sound/aica.cpp
index 4e1b4d5fd40..99fa33a4ea4 100644
--- a/src/devices/sound/aica.cpp
+++ b/src/devices/sound/aica.cpp
@@ -351,8 +351,14 @@ void aica_device::InitADPCM(int *PrevSignal, int *PrevQuant)
signed short aica_device::DecodeADPCM(int *PrevSignal, unsigned char Delta, int *PrevQuant)
{
+ int x = (*PrevQuant * quant_mul[Delta & 7]) / 8;
+ if (x > 0x7FFF) x = 0x7FFF;
+ if (Delta & 8) x = -x;
+ x += *PrevSignal;
+#if 0 // older implementation
int x = *PrevQuant * quant_mul [Delta & 15];
x = *PrevSignal + ((int)(x + ((UINT32)x >> 29)) >> 3);
+#endif
*PrevSignal=ICLIP16(x);
*PrevQuant=(*PrevQuant*TableQuant[Delta&7])>>ADPCMSHIFT;
*PrevQuant=(*PrevQuant<0x7f)?0x7f:((*PrevQuant>0x6000)?0x6000:*PrevQuant);