diff options
Diffstat (limited to 'audio/softsynth/mt32/LA32Ramp.cpp')
-rw-r--r-- | audio/softsynth/mt32/LA32Ramp.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/audio/softsynth/mt32/LA32Ramp.cpp b/audio/softsynth/mt32/LA32Ramp.cpp index a4da4f57a8..9dcf143fbf 100644 --- a/audio/softsynth/mt32/LA32Ramp.cpp +++ b/audio/softsynth/mt32/LA32Ramp.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher - * Copyright (C) 2011-2016 Dean Beeler, Jerome Fisher, Sergey V. Mikayev + * Copyright (C) 2011-2017 Dean Beeler, Jerome Fisher, Sergey V. Mikayev * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -56,8 +56,8 @@ We haven't fully explored: namespace MT32Emu { // SEMI-CONFIRMED from sample analysis. -const int TARGET_MULT = 0x40000; -const unsigned int MAX_CURRENT = 0xFF * TARGET_MULT; +const unsigned int TARGET_SHIFTS = 18; +const unsigned int MAX_CURRENT = 0xFF << TARGET_SHIFTS; // We simulate the delay in handling "target was reached" interrupts by waiting // this many samples before setting interruptRaised. @@ -96,7 +96,7 @@ void LA32Ramp::startRamp(Bit8u target, Bit8u increment) { largeIncrement++; } - largeTarget = target * TARGET_MULT; + largeTarget = target << TARGET_SHIFTS; interruptCountdown = 0; interruptRaised = false; } @@ -152,4 +152,13 @@ void LA32Ramp::reset() { interruptRaised = false; } +// This is actually beyond the LA32 ramp interface. +// Instead of polling the current value, MCU receives an interrupt when a ramp completes. +// However, this is a simple way to work around the specific behaviour of TVA +// when in sustain phase which one normally wants to avoid. +// See TVA::recalcSustain() for details. +bool LA32Ramp::isBelowCurrent(Bit8u target) const { + return Bit32u(target << TARGET_SHIFTS) < current; +} + } // namespace MT32Emu |