From abba98ed83f59263c4b952d61ce9892f9270ee67 Mon Sep 17 00:00:00 2001 From: Takamichi Horikawa Date: Wed, 27 Sep 2017 23:16:40 +0900 Subject: pmd: fixed adpcm/ppz8 ssg new envelope overflow --- fmdriver/fmdriver_pmd.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'fmdriver/fmdriver_pmd.c') diff --git a/fmdriver/fmdriver_pmd.c b/fmdriver/fmdriver_pmd.c index a3a50c3..f4eaab7 100644 --- a/fmdriver/fmdriver_pmd.c +++ b/fmdriver/fmdriver_pmd.c @@ -1650,13 +1650,14 @@ static void pmd_adpcm_vol_out( vol = 0; // -> 053f } else { - vol = (vol * (envvol+1)) >> 3; - if (vol & 1) { - vol >>= 1; - vol++; + int ivol = (vol * (envvol+1)) >> 3; + if (ivol & 1) { + ivol >>= 1; + ivol++; } else { - vol >>= 1; + ivol >>= 1; } + vol = ivol; } } else { // 04e8 @@ -1711,13 +1712,14 @@ static void pmd_ppz8_vol_out( vol = 0; // -> 0bd4 } else { - vol = (vol * (envvol+1)) >> 3; - if (vol & 1) { - vol >>= 1; - vol++; + int ivol = (vol * (envvol+1)) >> 3; + if (ivol & 1) { + ivol >>= 1; + ivol++; } else { - vol >>= 1; + ivol >>= 1; } + vol = ivol; } } else { // 0b7d -- cgit v1.2.3