diff options
author | Filippos Karapetis | 2013-03-02 14:09:39 +0200 |
---|---|---|
committer | Filippos Karapetis | 2013-03-02 14:09:39 +0200 |
commit | f4cc45d367442f850baecd814003ec09790a43b0 (patch) | |
tree | bfc904c0e8ced825749fa910696fae1d24fe10ca /audio/softsynth/mt32/LA32Ramp.cpp | |
parent | 8884c240fc4683975cd76802b600c019ebcb260c (diff) | |
download | scummvm-rg350-f4cc45d367442f850baecd814003ec09790a43b0.tar.gz scummvm-rg350-f4cc45d367442f850baecd814003ec09790a43b0.tar.bz2 scummvm-rg350-f4cc45d367442f850baecd814003ec09790a43b0.zip |
MT32: Sync with the latest changes in munt
The major change is the addition of a refined wave generator based on
logarithmic fixed-point computations and LUTs
Diffstat (limited to 'audio/softsynth/mt32/LA32Ramp.cpp')
-rw-r--r-- | audio/softsynth/mt32/LA32Ramp.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/audio/softsynth/mt32/LA32Ramp.cpp b/audio/softsynth/mt32/LA32Ramp.cpp index c2b4596e07..b4ac6f1d46 100644 --- a/audio/softsynth/mt32/LA32Ramp.cpp +++ b/audio/softsynth/mt32/LA32Ramp.cpp @@ -82,9 +82,13 @@ void LA32Ramp::startRamp(Bit8u target, Bit8u increment) { if (increment == 0) { largeIncrement = 0; } else { - // Using integer argument here, no precision loss: + // Three bits in the fractional part, no need to interpolate // (unsigned int)(EXP2F(((increment & 0x7F) + 24) / 8.0f) + 0.125f) - largeIncrement = (unsigned int)(EXP2I(((increment & 0x7F) + 24) << 9) + 0.125f); + Bit32u expArg = increment & 0x7F; + largeIncrement = 8191 - Tables::getInstance().exp9[~(expArg << 6) & 511]; + largeIncrement <<= expArg >> 3; + largeIncrement += 64; + largeIncrement >>= 9; } descending = (increment & 0x80) != 0; if (descending) { |