diff options
author | Takamichi Horikawa <takamichiho@gmail.com> | 2017-09-27 23:16:40 +0900 |
---|---|---|
committer | Takamichi Horikawa <takamichiho@gmail.com> | 2017-09-27 23:16:40 +0900 |
commit | abba98ed83f59263c4b952d61ce9892f9270ee67 (patch) | |
tree | e524fcc992e571e6e1d5cbc382173f28d26a7f77 | |
parent | 321ee784f75abbbec2fc6cce52ed56fb578da24c (diff) |
pmd: fixed adpcm/ppz8 ssg new envelope overflow
-rw-r--r-- | fmdriver/fmdriver_pmd.c | 22 |
1 files changed, 12 insertions, 10 deletions
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 |