[Scummvm-git-logs] scummvm master -> d7fe09f63e569d16c444d627bbbda0610d6bbd9a

bluegr noreply at scummvm.org
Wed Dec 2 18:32:29 UTC 2026


This automated email contains information about 7 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
3e0ae4d1d7 AUDIO: MT32: Update MT32 emulation munt 2.8.4, mt32emu 2.8.6
f64f0b72dc AUDIO: MT32: Configure MT32 emulator for ScummVM use
f425b1b692 AUDIO: MT32: Restore override keywords
19980dc7c0 AUDIO: MT32: Restore disabling of MSVC STL exceptions
e2c992812c AUDIO: MT32: Remove unneeded STL
b97d63c11d AUDIO: MT32: Restore typo fix
d7fe09f63e AUDIO: MT32: Remove MT32EMU_WITH_TESTING code


Commit: 3e0ae4d1d768529d095f643d724f1a9d1d2db707
    https://github.com/scummvm/scummvm/commit/3e0ae4d1d768529d095f643d724f1a9d1d2db707
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2026-12-02T20:29:04+02:00

Commit Message:
AUDIO: MT32: Update MT32 emulation munt 2.8.4, mt32emu 2.8.6

Minus the test suite, which was added in 2.8.0 but which we don't need.

Changed paths:
  A audio/softsynth/mt32/LA32FloatMath.h
  A audio/softsynth/mt32/SysexBuilder.h
    audio/softsynth/mt32/Analog.cpp
    audio/softsynth/mt32/BReverbModel.cpp
    audio/softsynth/mt32/File.h
    audio/softsynth/mt32/FileStream.cpp
    audio/softsynth/mt32/FileStream.h
    audio/softsynth/mt32/LA32FloatWaveGenerator.cpp
    audio/softsynth/mt32/LA32FloatWaveGenerator.h
    audio/softsynth/mt32/LA32Ramp.cpp
    audio/softsynth/mt32/LA32Ramp.h
    audio/softsynth/mt32/LA32WaveGenerator.cpp
    audio/softsynth/mt32/LA32WaveGenerator.h
    audio/softsynth/mt32/MemoryRegion.h
    audio/softsynth/mt32/MidiStreamParser.cpp
    audio/softsynth/mt32/MidiStreamParser.h
    audio/softsynth/mt32/Part.cpp
    audio/softsynth/mt32/Part.h
    audio/softsynth/mt32/Partial.cpp
    audio/softsynth/mt32/Partial.h
    audio/softsynth/mt32/PartialManager.cpp
    audio/softsynth/mt32/PartialManager.h
    audio/softsynth/mt32/ROMInfo.cpp
    audio/softsynth/mt32/ROMInfo.h
    audio/softsynth/mt32/SampleRateConverter.cpp
    audio/softsynth/mt32/Structures.h
    audio/softsynth/mt32/Synth.cpp
    audio/softsynth/mt32/Synth.h
    audio/softsynth/mt32/TVA.cpp
    audio/softsynth/mt32/TVA.h
    audio/softsynth/mt32/TVF.cpp
    audio/softsynth/mt32/TVF.h
    audio/softsynth/mt32/TVP.cpp
    audio/softsynth/mt32/Tables.cpp
    audio/softsynth/mt32/Tables.h
    audio/softsynth/mt32/VersionTagging.cpp
    audio/softsynth/mt32/VersionTagging.h
    audio/softsynth/mt32/c_interface/c_interface.cpp
    audio/softsynth/mt32/c_interface/c_interface.h
    audio/softsynth/mt32/c_interface/c_types.h
    audio/softsynth/mt32/c_interface/cpp_interface.h
    audio/softsynth/mt32/config.h
    audio/softsynth/mt32/mmath.h
    audio/softsynth/mt32/srchelper/InternalResampler.cpp
    audio/softsynth/mt32/srchelper/srctools/include/FIRResampler.h
    audio/softsynth/mt32/srchelper/srctools/include/IIR2xResampler.h
    audio/softsynth/mt32/srchelper/srctools/include/LinearResampler.h
    audio/softsynth/mt32/srchelper/srctools/src/ResamplerModel.cpp


diff --git a/audio/softsynth/mt32/Analog.cpp b/audio/softsynth/mt32/Analog.cpp
index 0c9a8f82a89..41fb19b44b9 100644
--- a/audio/softsynth/mt32/Analog.cpp
+++ b/audio/softsynth/mt32/Analog.cpp
@@ -127,7 +127,7 @@ public:
 template <class SampleEx>
 class NullLowPassFilter : public AbstractLowPassFilter<SampleEx> {
 public:
-	SampleEx process(const SampleEx sample) override {
+	SampleEx process(const SampleEx sample) {
 		return sample;
 	}
 };
@@ -150,7 +150,7 @@ public:
 		Synth::muteSampleBuffer(ringBuffer, COARSE_LPF_DELAY_LINE_LENGTH);
 	}
 
-	SampleEx process(const SampleEx inSample) override {
+	SampleEx process(const SampleEx inSample) {
 		static const unsigned int DELAY_LINE_MASK = COARSE_LPF_DELAY_LINE_LENGTH - 1;
 
 		SampleEx sample = lpfTaps[COARSE_LPF_DELAY_LINE_LENGTH] * ringBuffer[ringBufferPosition];
@@ -179,12 +179,12 @@ private:
 
 public:
 	AccurateLowPassFilter(const bool oldMT32AnalogLPF, const bool oversample);
-	FloatSample process(const FloatSample sample) override;
-	IntSampleEx process(const IntSampleEx sample) override;
-	bool hasNextSample() const override;
-	unsigned int getOutputSampleRate() const override;
-	unsigned int estimateInSampleCount(const unsigned int outSamples) const override;
-	void addPositionIncrement(const unsigned int positionIncrement) override;
+	FloatSample process(const FloatSample sample);
+	IntSampleEx process(const IntSampleEx sample);
+	bool hasNextSample() const;
+	unsigned int getOutputSampleRate() const;
+	unsigned int estimateInSampleCount(const unsigned int outSamples) const;
+	void addPositionIncrement(const unsigned int positionIncrement);
 };
 
 static inline IntSampleEx normaliseSample(const IntSampleEx sample) {
@@ -223,19 +223,19 @@ public:
 		delete &rightChannelLPF;
 	}
 
-	unsigned int getOutputSampleRate() const override {
+	unsigned int getOutputSampleRate() const {
 		return leftChannelLPF.getOutputSampleRate();
 	}
 
-	Bit32u getDACStreamsLength(const Bit32u outputLength) const override {
+	Bit32u getDACStreamsLength(const Bit32u outputLength) const {
 		return leftChannelLPF.estimateInSampleCount(outputLength);
 	}
 
-	void setSynthOutputGain(const float synthGain) override;
-	void setReverbOutputGain(const float reverbGain, const bool mt32ReverbCompatibilityMode) override;
+	void setSynthOutputGain(const float synthGain);
+	void setReverbOutputGain(const float reverbGain, const bool mt32ReverbCompatibilityMode);
 
-	bool process(IntSample *outStream, const IntSample *nonReverbLeft, const IntSample *nonReverbRight, const IntSample *reverbDryLeft, const IntSample *reverbDryRight, const IntSample *reverbWetLeft, const IntSample *reverbWetRight, Bit32u outLength) override;
-	bool process(FloatSample *outStream, const FloatSample *nonReverbLeft, const FloatSample *nonReverbRight, const FloatSample *reverbDryLeft, const FloatSample *reverbDryRight, const FloatSample *reverbWetLeft, const FloatSample *reverbWetRight, Bit32u outLength) override;
+	bool process(IntSample *outStream, const IntSample *nonReverbLeft, const IntSample *nonReverbRight, const IntSample *reverbDryLeft, const IntSample *reverbDryRight, const IntSample *reverbWetLeft, const IntSample *reverbWetRight, Bit32u outLength);
+	bool process(FloatSample *outStream, const FloatSample *nonReverbLeft, const FloatSample *nonReverbRight, const FloatSample *reverbDryLeft, const FloatSample *reverbDryRight, const FloatSample *reverbWetLeft, const FloatSample *reverbWetRight, Bit32u outLength);
 
 	template <class Sample>
 	void produceOutput(Sample *outStream, const Sample *nonReverbLeft, const Sample *nonReverbRight, const Sample *reverbDryLeft, const Sample *reverbDryRight, const Sample *reverbWetLeft, const Sample *reverbWetRight, Bit32u outLength) {
diff --git a/audio/softsynth/mt32/BReverbModel.cpp b/audio/softsynth/mt32/BReverbModel.cpp
index 20e7dcffca0..05a2e4240c9 100644
--- a/audio/softsynth/mt32/BReverbModel.cpp
+++ b/audio/softsynth/mt32/BReverbModel.cpp
@@ -455,11 +455,11 @@ public:
 		close();
 	}
 
-	bool isOpen() const override {
+	bool isOpen() const {
 		return combs != NULL;
 	}
 
-	void open() override {
+	void open() {
 		if (isOpen()) return;
 		if (currentSettings.numberOfAllpasses > 0) {
 			allpasses = new AllpassFilter<Sample>*[currentSettings.numberOfAllpasses];
@@ -479,7 +479,7 @@ public:
 		mute();
 	}
 
-	void close() override {
+	void close() {
 		if (allpasses != NULL) {
 			for (Bit32u i = 0; i < currentSettings.numberOfAllpasses; i++) {
 				if (allpasses[i] != NULL) {
@@ -502,7 +502,7 @@ public:
 		}
 	}
 
-	void mute() override {
+	void mute() {
 		if (allpasses != NULL) {
 			for (Bit32u i = 0; i < currentSettings.numberOfAllpasses; i++) {
 				allpasses[i]->mute();
@@ -515,7 +515,7 @@ public:
 		}
 	}
 
-	void setParameters(Bit8u time, Bit8u level) override {
+	void setParameters(Bit8u time, Bit8u level) {
 		if (!isOpen()) return;
 		level &= 7;
 		time &= 7;
@@ -542,7 +542,7 @@ public:
 		}
 	}
 
-	bool isActive() const override {
+	bool isActive() const {
 		if (!isOpen()) return false;
 		for (Bit32u i = 0; i < currentSettings.numberOfAllpasses; i++) {
 			if (!allpasses[i]->isEmpty()) return true;
@@ -553,7 +553,7 @@ public:
 		return false;
 	}
 
-	bool isMT32Compatible(const ReverbMode mode) const override {
+	bool isMT32Compatible(const ReverbMode mode) const {
 		return &currentSettings == &getMT32Settings(mode);
 	}
 
@@ -588,7 +588,7 @@ public:
 				}
 			} else {
 				DelayWithLowPassFilter<Sample> * const entranceDelay = static_cast<DelayWithLowPassFilter<Sample> *>(combs[0]);
-				// If the output position is equal to the comb size, get it now in order not to lose it
+				// If the output position is equal to the comb size, get it now in order not to loose it
 				Sample link = entranceDelay->getOutputAt(currentSettings.combSizes[0] - 1);
 
 				// Entrance LPF. Note, comb.process() differs a bit here.
@@ -598,7 +598,7 @@ public:
 				link = allpasses[1]->process(link);
 				link = allpasses[2]->process(link);
 
-				// If the output position is equal to the comb size, get it now in order not to lose it
+				// If the output position is equal to the comb size, get it now in order not to loose it
 				Sample outL1 = combs[1]->getOutputAt(currentSettings.outLPositions[0] - 1);
 
 				combs[1]->process(link);
@@ -622,8 +622,8 @@ public:
 		} // while ((numSamples--) > 0)
 	} // produceOutput
 
-	bool process(const IntSample *inLeft, const IntSample *inRight, IntSample *outLeft, IntSample *outRight, Bit32u numSamples) override;
-	bool process(const FloatSample *inLeft, const FloatSample *inRight, FloatSample *outLeft, FloatSample *outRight, Bit32u numSamples) override;
+	bool process(const IntSample *inLeft, const IntSample *inRight, IntSample *outLeft, IntSample *outRight, Bit32u numSamples);
+	bool process(const FloatSample *inLeft, const FloatSample *inRight, FloatSample *outLeft, FloatSample *outRight, Bit32u numSamples);
 };
 
 BReverbModel *BReverbModel::createBReverbModel(const ReverbMode mode, const bool mt32CompatibleModel, const RendererType rendererType) {
diff --git a/audio/softsynth/mt32/File.h b/audio/softsynth/mt32/File.h
index 6d00d9962dc..2aa34b4c774 100644
--- a/audio/softsynth/mt32/File.h
+++ b/audio/softsynth/mt32/File.h
@@ -40,7 +40,7 @@ public:
 
 class MT32EMU_EXPORT AbstractFile : public File {
 public:
-	const SHA1Digest &getSHA1() override;
+	const SHA1Digest &getSHA1();
 
 protected:
 	AbstractFile();
@@ -59,9 +59,9 @@ public:
 	ArrayFile(const Bit8u *data, size_t size);
 	ArrayFile(const Bit8u *data, size_t size, const SHA1Digest &sha1Digest);
 
-	size_t getSize() override;
-	const Bit8u *getData() override;
-	void close() override {}
+	size_t getSize();
+	const Bit8u *getData();
+	void close() {}
 
 private:
 	const Bit8u *data;
diff --git a/audio/softsynth/mt32/FileStream.cpp b/audio/softsynth/mt32/FileStream.cpp
index 4424c282ff0..5e32c10d641 100644
--- a/audio/softsynth/mt32/FileStream.cpp
+++ b/audio/softsynth/mt32/FileStream.cpp
@@ -21,11 +21,6 @@
 
 #include "internals.h"
 
-// Disable MSVC STL exceptions
-#ifdef _MSC_VER
-#define _HAS_EXCEPTIONS 0
-#endif
-
 #include "FileStream.h"
 
 namespace MT32Emu {
diff --git a/audio/softsynth/mt32/FileStream.h b/audio/softsynth/mt32/FileStream.h
index 1d3b509e6cc..3b397686962 100644
--- a/audio/softsynth/mt32/FileStream.h
+++ b/audio/softsynth/mt32/FileStream.h
@@ -30,10 +30,10 @@ class FileStream : public AbstractFile {
 public:
 	MT32EMU_EXPORT FileStream();
 	MT32EMU_EXPORT ~FileStream();
-	MT32EMU_EXPORT size_t getSize() override;
-	MT32EMU_EXPORT const Bit8u *getData() override;
+	MT32EMU_EXPORT size_t getSize();
+	MT32EMU_EXPORT const Bit8u *getData();
 	MT32EMU_EXPORT bool open(const char *filename);
-	MT32EMU_EXPORT void close() override;
+	MT32EMU_EXPORT void close();
 
 private:
 	std::ifstream &ifsp;
diff --git a/audio/softsynth/mt32/LA32FloatMath.h b/audio/softsynth/mt32/LA32FloatMath.h
new file mode 100644
index 00000000000..ec5de0cf83c
--- /dev/null
+++ b/audio/softsynth/mt32/LA32FloatMath.h
@@ -0,0 +1,291 @@
+/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
+ * Copyright (C) 2011-2026 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
+ *  the Free Software Foundation, either version 2.1 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MT32EMU_LA32_FLOAT_MATH_H
+#define MT32EMU_LA32_FLOAT_MATH_H
+
+#include "globals.h"
+#include "mmath.h"
+#include "Types.h"
+
+namespace MT32Emu {
+
+static const float MIDDLE_CUTOFF_VALUE = 128.0f;
+
+/*
+ * The LA32FloatWaveGenerator heavily uses some math functions, e.g. exp, sin and cos. The time it takes to compute these functions
+ * affects the performance rather considerably. Unfortunately, not every implementation of the standard math library provides for
+ * the best performance even in 2026. In particular, there is no difference in speed between the single and double precision in
+ * certain environments. Additionally, we cut a few corners specific to our use case.
+ */
+namespace LA32FloatMath {
+
+struct VanillaMath {
+	static void init() {
+		// No-op
+	}
+
+	static float fsin(float x) {
+		return sin(FLOAT_PI * x);
+	}
+
+	static float fcos(float x) {
+		return cos(FLOAT_PI * x);
+	}
+
+	static float cosineLengthFactor(float cutoff) {
+		// found from sample analysis
+		return EXP2F((cutoff - MIDDLE_CUTOFF_VALUE) / -16.0f);
+	}
+
+	static float unlogPCMSample(Bit32u pcmSample) {
+		return EXP2F((pcmSample - 32787.0f) / 2048.0f);
+	}
+
+	static float resonanceAmpBase(Bit8u resonance) {
+		return EXP2F(1.0f - (32 - resonance) / 4.0f);
+	}
+
+	static float pulseLengthFactor(Bit8u pulseWidth) {
+		return EXP2F((64 - pulseWidth) / 64.0f);
+	}
+
+	static float linearAmpFactor(Bit32u amp) {
+		// See Partial::getAmpValue for more details
+		return EXP2F(amp / -1024.0f / 4096.0f);
+	}
+
+	static float frequency(Bit16u pitch) {
+		return EXP2F(pitch / 4096.0f - 16.0f) * SAMPLE_RATE;
+	}
+
+	static float attenuationFactorBelowMiddleCutoff(float cutoff) {
+		return EXP2F(-0.125f * (MIDDLE_CUTOFF_VALUE - cutoff));
+	}
+
+	static float unlogResonanceAmpFade(float resAmpFadeLog2) {
+		return EXP2F(resAmpFadeLog2);
+	}
+}; // struct VanillaMath
+
+struct LinearInterpolator {
+	static float exp2Taylor(float approxExp2, float delta) {
+		return approxExp2 + approxExp2 * delta;
+	}
+
+	static float sinTaylor(float approxSin, float approxCos, float delta) {
+		return approxSin + approxCos * delta;
+	}
+};
+
+struct QuadraticInterpolator {
+	static float exp2Taylor(float approxExp2, float delta) {
+		return approxExp2 + (approxExp2 + 0.5f * approxExp2 * delta) * delta;
+	}
+
+	static float sinTaylor(float approxSin, float approxCos, float delta) {
+		return approxSin + (approxCos - 0.5f * approxSin * delta) * delta;
+	}
+};
+
+template<class Interpolator, int INDEX_BITS>
+class Exp2Table {
+	// The table includes one more entry for 2 ^ 1 = 2 to simplify the rounding logic.
+	static const Bit32u SIZE_M1 = 1 << INDEX_BITS;
+	static const Bit32u SIZE = SIZE_M1 + 1;
+
+	// These support an additional optimisation for the LA32 native logarithmic format which has a 12-bit fractional part.
+	// See fexp2i(Bit32u).
+	static const int FRAC_BITS = 12;
+	static const Bit32u FRAC_MASK = (1 << FRAC_BITS) - 1;
+
+	static float scaleFactor;
+	static float table[SIZE];
+
+	// The ANSI C++ does not support inline member specialisation. The workaround is to use a helper type and overloading.
+	template<bool> class InterpolationNeededFlag {};
+
+	static float interpolate(float scaledFracX) {
+		Bit32u tableIx = Bit32u(scaledFracX + 0.5f);
+		float delta = (scaledFracX - tableIx) * scaleFactor;
+		return Interpolator::exp2Taylor(table[tableIx], delta);
+	}
+
+	// For the table resolutions lesser than the LA32 fraction, we have to interpolate.
+	static float mantissa(Bit32u fracX, InterpolationNeededFlag<true>) {
+		static const float FRAC_SCALE_FACTOR = SIZE_M1 / float(1 << FRAC_BITS);
+
+		return interpolate(fracX * FRAC_SCALE_FACTOR);
+	}
+
+	// For the table resolutions that match or exceed the LA32 fraction, the interpolation is unnecessary, and we can perform a direct
+	// table lookup (just maybe scale the argument).
+	static float mantissa(Bit32u fracX, InterpolationNeededFlag<false>) {
+		static const Bit32u FRAC_SHIFT_BITS = INDEX_BITS - FRAC_BITS;
+
+		return table[fracX << FRAC_SHIFT_BITS];
+	}
+
+public:
+	static void init() {
+		scaleFactor = FLOAT_LN_2 / SIZE_M1;
+
+		float tableSizeRcp = 1.0f / SIZE_M1;
+		for (Bit32u i = 0; i < SIZE_M1; i++) {
+			table[i] = EXP2F(tableSizeRcp * i);
+		}
+		table[SIZE_M1] = 2.0f;
+	}
+
+	// This function takes the parameter in the LA32 native fixed-point logarithmic format with 12-bit fractional part.
+	// Splitting the integer argument is more efficient, yet the 12-bit fractions map 1:1 to the "big" LUT, so we can look up directly.
+	// The maximum value of the argument must never exceed 16 * 4096, so the integer overflow when scaling the result doesn't happen.
+	static float fexp2i(Bit32u x) {
+		Bit32u upScale = x >> FRAC_BITS;
+		Bit32u fracX = x & FRAC_MASK;
+
+		return mantissa(fracX, InterpolationNeededFlag<INDEX_BITS < FRAC_BITS>()) * (1 << upScale);
+	}
+
+	// Here we cut some corners to avoid standard math library calls each of which significantly degrades the performance in most cases.
+	// First limitation: the parameter must never be negative. To ensure this, we shake the related formulae.
+	// Next thing: the maximum value of the argument is also limited by 30.0 to avoid the integer overflow when scaling the result.
+	static float fexp2(float x) {
+		Bit32u upScale = Bit32u(x);
+		float fracX = x - upScale;
+		return interpolate(fracX * SIZE_M1) * (1 << upScale);
+	}
+}; // class Exp2Table
+
+// The table covers the entire sine period to simplify the computational logic.
+// Even an attempt to halve the table by taking advantage of the sine's antisymmetry well degrades the performance (either using
+// simple conditions or various dirty tricks for setting the sign bit directly). The tests showed numbers close to those achieved
+// with the quadratic interpolation, but the table is already 8 times shorter in the latter case.
+template<class Interpolator, int INDEX_BITS>
+class SineTable {
+	static const Bit32u SIZE = 1 << INDEX_BITS;
+	static const Bit32u INDEX_MASK = SIZE - 1;
+	static const Bit32u PI_IX = SIZE >> 1;
+	static const Bit32u HALF_PI_IX = SIZE >> 2;
+
+	static float scaleFactor;
+	static float table[SIZE];
+
+public:
+	static void init() {
+		scaleFactor = FLOAT_2PI / SIZE;
+		for (Bit32u i = 0; i < SIZE; i++) {
+			table[i] = sin(scaleFactor * i);
+		}
+	}
+
+	// The first cut corner: the argument is scaled by PI, meaning a frequency relative to the Nyquist frequency.
+	// In 100% of our call sites we had to multiply the argument by PI just to revert that here. Additionally, this also _reduces_
+	// the computation error for bigger arguments since the irrational factor PI isn't involved.
+	//
+	// The second cut corner: the argument must never be negative nor exceed 2^20. That's always the case with our usages. This makes
+	// the argument reduction unnecessary as a separate step.
+	static float fsin(float x) {
+		float scaledX = x * PI_IX;
+		Bit32u sinIx = Bit32u(scaledX + 0.5f);
+		float approxSin = table[sinIx & INDEX_MASK];
+		Bit32u cosIx = sinIx + HALF_PI_IX;
+		float approxCos = table[cosIx & INDEX_MASK];
+		float delta = (scaledX - sinIx) * scaleFactor;
+		float res = Interpolator::sinTaylor(approxSin, approxCos, delta);
+		return res;
+	}
+}; // class SineTable
+
+template<class Interpolator, int EXP2_INDEX_BITS, int SINE_INDEX_BITS>
+struct FasterMath {
+	typedef LA32FloatMath::Exp2Table<Interpolator, EXP2_INDEX_BITS> Exp2Table;
+	typedef LA32FloatMath::SineTable<Interpolator, SINE_INDEX_BITS> SineTable;
+
+	static void init() {
+		Exp2Table::init();
+		SineTable::init();
+	}
+
+	static float cosineLengthFactor(float cutoff) {
+		static const float mult = 1.0f / 256.0f; // EXP2F(-MIDDLE_CUTOFF_VALUE / 16.0f)
+		return Exp2Table::fexp2((2.0f * MIDDLE_CUTOFF_VALUE - cutoff) / 16.0f) * mult;
+	}
+
+	static float unlogPCMSample(Bit32u pcmSample) {
+		static const float mult = 1.51609812e-5f; // EXP2F(-32787.0f / 2048.0f)
+		return Exp2Table::fexp2i(pcmSample << 1) * mult;
+	}
+
+	static float resonanceAmpBase(Bit8u resonance) {
+		static const float mult = 1.0f / 128.0f; // EXP2F(1.0f - 32.0f / 4.0f)
+		return Exp2Table::fexp2i(resonance << 10) * mult;
+	}
+
+	static float pulseLengthFactor(Bit8u pulseWidth) {
+		static const float mult = 0.125f; // EXP2F(-192.0f / 64.0f)
+		return Exp2Table::fexp2i((256 - pulseWidth) << 6) * mult;
+	}
+
+	static float linearAmpFactor(Bit32u amp) {
+		static const float logAmpScaleFactor = 1.0f / 1024.0f / 4096.0f;
+		static const float mult = 1.5238139e-5f; // EXP2F(-67117056.0f * logAmpScaleFactor)
+		// TODO: The amp value subtraction actually reverts what we did in Partial::getAmpValue, this should be simplified.
+		return Exp2Table::fexp2((67117056 - amp) * logAmpScaleFactor) * mult;
+	}
+
+	static float frequency(Bit16u pitch) {
+		static const float mult = SAMPLE_RATE / 65536.0f; // SAMPLE_RATE * EXP2F(-16.0f)
+		return Exp2Table::fexp2i(pitch) * mult;
+	}
+
+	static float attenuationFactorBelowMiddleCutoff(float cutoff) {
+		static const float mult = 1.0f / 65536.0f; // EXP2F(-0.125f * MIDDLE_CUTOFF_VALUE)
+		return Exp2Table::fexp2(0.125f * cutoff) * mult;
+	}
+
+	static float unlogResonanceAmpFade(float resAmpFadeLog2) {
+		static const float mult = 1.0f / (1 << 30);
+		// Basically, the resonance wave barely affects the resulting wave as soon as the log2 factor falls below -23 while working with
+		// the IEEE floats. Picking -30 as the minimum log2 gives a bit smoother transition of the addition to a no-op in most cases yet
+		// ensures that the argument fits the fexp2 requirements.
+		return (resAmpFadeLog2 < -30.0f) ? 0.0f : Exp2Table::fexp2(30.0f + resAmpFadeLog2) * mult;
+	}
+
+	static float fsin(float x) {
+		return SineTable::fsin(x);
+	}
+
+	static float fcos(float x) {
+		return fsin(x + 0.5f);
+	}
+}; // struct FasterMath
+
+template<class Interpolator, int INDEX_BITS>
+float Exp2Table<Interpolator, INDEX_BITS>::scaleFactor = 0;
+template<class Interpolator, int INDEX_BITS>
+float Exp2Table<Interpolator, INDEX_BITS>::table[] = {};
+template<class Interpolator, int INDEX_BITS>
+float SineTable<Interpolator, INDEX_BITS>::scaleFactor = 0;
+template<class Interpolator, int INDEX_BITS>
+float SineTable<Interpolator, INDEX_BITS>::table[] = {};
+
+} // namespace LA32FloatMath
+
+} // namespace MT32Emu
+
+#endif // #ifndef MT32EMU_LA32_FLOAT_MATH_H
diff --git a/audio/softsynth/mt32/LA32FloatWaveGenerator.cpp b/audio/softsynth/mt32/LA32FloatWaveGenerator.cpp
index 7aea6c240af..a89e1a3fd5c 100644
--- a/audio/softsynth/mt32/LA32FloatWaveGenerator.cpp
+++ b/audio/softsynth/mt32/LA32FloatWaveGenerator.cpp
@@ -1,5 +1,5 @@
 /* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
- * Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ * Copyright (C) 2011-2026 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
@@ -20,14 +20,51 @@
 #include "internals.h"
 
 #include "LA32FloatWaveGenerator.h"
+
+#include "LA32FloatMath.h"
 #include "mmath.h"
 #include "Tables.h"
 
 namespace MT32Emu {
 
-static const float MIDDLE_CUTOFF_VALUE = 128.0f;
 static const float RESONANCE_DECAY_THRESHOLD_CUTOFF_VALUE = 144.0f;
-static const float MAX_CUTOFF_VALUE = 240.0f;
+
+static const Bit8u *resAmpDecayFactors;
+
+#ifndef MT32EMU_FASTER_MATH
+#define MT32EMU_FASTER_MATH 1
+#endif
+
+#if MT32EMU_FASTER_MATH == 0
+
+typedef LA32FloatMath::VanillaMath LA32FloatMathImpl;
+
+#elif MT32EMU_FASTER_MATH == 1
+
+// In this mode we strive to minimise the number of operations on the critical path at the expense of increased memory usage,
+// hence it may well not be the fastest option under memory pressure. The LUT sizes are picked so to achieve a good accuracy with
+// the SNR about 126dB. Albeit, we don't need the exponent table that big with the linear interpolation: 10 bits would be enough.
+// We pick the table size this big to simplify fexp2i a lot, leading to a considerable speedup.
+typedef LA32FloatMath::FasterMath<LA32FloatMath::LinearInterpolator, 12, 12> LA32FloatMathImpl;
+
+#elif MT32EMU_FASTER_MATH == 2
+
+// The quadratic interpolation allows to reduce the memory needed for the LUTs significantly, but also slightly increases the code
+// complexity. The same level of accuracy is expected as with the option above.
+typedef LA32FloatMath::FasterMath<LA32FloatMath::QuadraticInterpolator, 6, 9> LA32FloatMathImpl;
+
+#else
+
+#error "Wrong MT32EMU_FASTER_MATH"
+
+#endif
+
+void LA32FloatWaveGenerator::updateWaveFormParameters() {
+	cosineLen = 0.5f * waveLen;
+	if (cutoff > MIDDLE_CUTOFF_VALUE) {
+		cosineLen *= LA32FloatMathImpl::cosineLengthFactor(cutoff);
+	}
+}
 
 float LA32FloatWaveGenerator::getPCMSample(unsigned int position) {
 	if (position >= pcmWaveLength) {
@@ -37,7 +74,7 @@ float LA32FloatWaveGenerator::getPCMSample(unsigned int position) {
 		position = position % pcmWaveLength;
 	}
 	Bit16s pcmSample = pcmWaveAddress[position];
-	float sampleValue = EXP2F(((pcmSample & 32767) - 32787.0f) / 2048.0f);
+	float sampleValue = LA32FloatMathImpl::unlogPCMSample(pcmSample & 32767);
 	return ((pcmSample & 32768) == 0) ? sampleValue : -sampleValue;
 }
 
@@ -46,8 +83,15 @@ void LA32FloatWaveGenerator::initSynth(const bool useSawtoothWaveform, const Bit
 	pulseWidth = usePulseWidth;
 	resonance = useResonance;
 
+	resAmpBase = LA32FloatMathImpl::resonanceAmpBase(resonance);
+	resAmp = resAmpBase;
+
+	pulseLenFactor = (pulseWidth > 128) ? LA32FloatMathImpl::pulseLengthFactor(pulseWidth) : 0.5f;
+
+	cutoff = 0.0f;
+	freq = 0.0f;
+	waveLen = 0.0f;
 	wavePos = 0.0f;
-	lastFreq = 0.0f;
 
 	pcmWaveAddress = NULL;
 	active = true;
@@ -63,29 +107,43 @@ void LA32FloatWaveGenerator::initPCM(const Bit16s * const usePCMWaveAddress, con
 	active = true;
 }
 
-// ampVal - Logarithmic amp of the wave generator
-// pitch - Logarithmic frequency of the resulting wave
-// cutoffRampVal - Composed of the base cutoff in range [78..178] left-shifted by 18 bits and the TVF modifier
-float LA32FloatWaveGenerator::generateNextSample(const Bit32u ampVal, const Bit16u pitch, const Bit32u cutoffRampVal) {
+void LA32FloatWaveGenerator::setAmp(const Bit32u amp) {
+	ampFactor = LA32FloatMathImpl::linearAmpFactor(amp);
+}
+
+void LA32FloatWaveGenerator::setPitch(const Bit16u pitch) {
+	float lastFreq = freq;
+	freq = LA32FloatMathImpl::frequency(pitch);
+
+	if (isPCMWave()) {
+		pcmPositionDelta = freq * 2048.0f / SAMPLE_RATE;
+	} else {
+		waveLen = SAMPLE_RATE / freq;
+		wavePos *= lastFreq / freq;
+		updateWaveFormParameters();
+	}
+}
+
+void LA32FloatWaveGenerator::setCutoff(const Bit32u cutoffVal) {
+	cutoff = cutoffVal / 262144.0f;
+
+	// Correct resAmp for cutoff in range 50..66
+	if ((cutoff >= MIDDLE_CUTOFF_VALUE) && (cutoff < RESONANCE_DECAY_THRESHOLD_CUTOFF_VALUE)) {
+		resAmp = resAmpBase * LA32FloatMathImpl::fsin((cutoff - MIDDLE_CUTOFF_VALUE) / 32.0f);
+	} else {
+		resAmp = resAmpBase;
+	}
+	lowCutoffAttenuationFactor = cutoff < MIDDLE_CUTOFF_VALUE ? LA32FloatMathImpl::attenuationFactorBelowMiddleCutoff(cutoff) : 1;
+	updateWaveFormParameters();
+}
+
+float LA32FloatWaveGenerator::generateNextSample() {
 	if (!active) {
 		return 0.0f;
 	}
 
 	float sample = 0.0f;
 
-	// SEMI-CONFIRMED: From sample analysis:
-	// (1) Tested with a single partial playing PCM wave 77 with pitchCoarse 36 and no keyfollow, velocity follow, etc.
-	// This gives results within +/- 2 at the output (before any DAC bitshifting)
-	// when sustaining at levels 156 - 255 with no modifiers.
-	// (2) Tested with a special square wave partial (internal capture ID tva5) at TVA envelope levels 155-255.
-	// This gives deltas between -1 and 0 compared to the real output. Note that this special partial only produces
-	// positive amps, so negative still needs to be explored, as well as lower levels.
-	//
-	// Also still partially unconfirmed is the behaviour when ramping between levels, as well as the timing.
-
-	float amp = EXP2F(ampVal / -1024.0f / 4096.0f);
-	float freq = EXP2F(pitch / 4096.0f - 16.0f) * SAMPLE_RATE;
-
 	if (isPCMWave()) {
 		// Render PCM waveform
 		int len = pcmWaveLength;
@@ -95,7 +153,6 @@ float LA32FloatWaveGenerator::generateNextSample(const Bit32u ampVal, const Bit1
 			deactivate();
 			return 0.0f;
 		}
-		float positionDelta = freq * 2048.0f / SAMPLE_RATE;
 
 		// Linear interpolation
 		float firstSample = getPCMSample(intPCMPosition);
@@ -108,39 +165,13 @@ float LA32FloatWaveGenerator::generateNextSample(const Bit32u ampVal, const Bit1
 			sample = firstSample;
 		}
 
-		float newPCMPosition = pcmPosition + positionDelta;
+		float newPCMPosition = pcmPosition + pcmPositionDelta;
 		if (pcmWaveLooped) {
 			newPCMPosition = fmod(newPCMPosition, float(pcmWaveLength));
 		}
 		pcmPosition = newPCMPosition;
 	} else {
 		// Render synthesised waveform
-		wavePos *= lastFreq / freq;
-		lastFreq = freq;
-
-		float resAmp = EXP2F(1.0f - (32 - resonance) / 4.0f);
-		{
-			//static const float resAmpFactor = EXP2F(-7);
-			//resAmp = EXP2I(resonance << 10) * resAmpFactor;
-		}
-
-		// The cutoffModifier may not be supposed to be directly added to the cutoff -
-		// it may for example need to be multiplied in some way.
-		// The 240 cutoffVal limit was determined via sample analysis (internal Munt capture IDs: glop3, glop4).
-		// More research is needed to be sure that this is correct, however.
-		float cutoffVal = cutoffRampVal / 262144.0f;
-		if (cutoffVal > MAX_CUTOFF_VALUE) {
-			cutoffVal = MAX_CUTOFF_VALUE;
-		}
-
-		// Wave length in samples
-		float waveLen = SAMPLE_RATE / freq;
-
-		// Init cosineLen
-		float cosineLen = 0.5f * waveLen;
-		if (cutoffVal > MIDDLE_CUTOFF_VALUE) {
-			cosineLen *= EXP2F((cutoffVal - MIDDLE_CUTOFF_VALUE) / -16.0f); // found from sample analysis
-		}
 
 		// Start playing in center of first cosine segment
 		// relWavePos is shifted by a half of cosineLen
@@ -149,15 +180,7 @@ float LA32FloatWaveGenerator::generateNextSample(const Bit32u ampVal, const Bit1
 			relWavePos -= waveLen;
 		}
 
-		// Ratio of positive segment to wave length
-		float pulseLen = 0.5f;
-		if (pulseWidth > 128) {
-			pulseLen = EXP2F((64 - pulseWidth) / 64.0f);
-			//static const float pulseLenFactor = EXP2F(-192 / 64);
-			//pulseLen = EXP2I((256 - pulseWidthVal) << 6) * pulseLenFactor;
-		}
-		pulseLen *= waveLen;
-
+		float pulseLen = pulseLenFactor * waveLen;
 		float hLen = pulseLen - cosineLen;
 
 		// Ignore pulsewidths too high for given freq
@@ -165,44 +188,39 @@ float LA32FloatWaveGenerator::generateNextSample(const Bit32u ampVal, const Bit1
 			hLen = 0.0f;
 		}
 
-		// Correct resAmp for cutoff in range 50..66
-		if ((cutoffVal >= MIDDLE_CUTOFF_VALUE) && (cutoffVal < RESONANCE_DECAY_THRESHOLD_CUTOFF_VALUE)) {
-			resAmp *= sin(FLOAT_PI * (cutoffVal - MIDDLE_CUTOFF_VALUE) / 32.0f);
-		}
-
 		// Produce filtered square wave with 2 cosine waves on slopes
+		float squareWaveSample;
 
 		// 1st cosine segment
 		if (relWavePos < cosineLen) {
-			sample = -cos(FLOAT_PI * relWavePos / cosineLen);
+			squareWaveSample = -LA32FloatMathImpl::fcos(relWavePos / cosineLen);
 		} else
 
 		// high linear segment
 		if (relWavePos < (cosineLen + hLen)) {
-			sample = 1.f;
+			squareWaveSample = 1.f;
 		} else
 
 		// 2nd cosine segment
 		if (relWavePos < (2 * cosineLen + hLen)) {
-			sample = cos(FLOAT_PI * (relWavePos - (cosineLen + hLen)) / cosineLen);
+			squareWaveSample = LA32FloatMathImpl::fcos((relWavePos - (cosineLen + hLen)) / cosineLen);
 		} else {
 
 		// low linear segment
-			sample = -1.f;
+			squareWaveSample = -1.f;
 		}
 
-		if (cutoffVal < MIDDLE_CUTOFF_VALUE) {
+		sample = squareWaveSample;
 
-			// Attenuate samples below cutoff 50
-			// Found by sample analysis
-			sample *= EXP2F(-0.125f * (MIDDLE_CUTOFF_VALUE - cutoffVal));
+		if (cutoff < MIDDLE_CUTOFF_VALUE) {
+			sample *= lowCutoffAttenuationFactor;
 		} else {
 
 			// Add resonance sine. Effective for cutoff > 50 only
 			float resSample = 1.0f;
 
 			// Resonance decay speed factor
-			float resAmpDecayFactor = Tables::getInstance().resAmpDecayFactor[resonance >> 2];
+			float resAmpDecayFactor = resAmpDecayFactors[resonance >> 2];
 
 			// Now relWavePos counts from the middle of first cosine
 			relWavePos = wavePos;
@@ -217,11 +235,11 @@ float LA32FloatWaveGenerator::generateNextSample(const Bit32u ampVal, const Bit1
 			}
 
 			// Resonance sine WG
-			resSample *= sin(FLOAT_PI * relWavePos / cosineLen);
+			resSample *= LA32FloatMathImpl::fsin(relWavePos / cosineLen);
 
 			// Resonance sine amp
 			float resAmpFadeLog2 = -0.125f * resAmpDecayFactor * (relWavePos / cosineLen); // seems to be exact
-			float resAmpFade = EXP2F(resAmpFadeLog2);
+			float resAmpFade = LA32FloatMathImpl::unlogResonanceAmpFade(resAmpFadeLog2);
 
 			// Now relWavePos set negative to the left from center of any cosine
 			relWavePos = wavePos;
@@ -238,13 +256,12 @@ float LA32FloatWaveGenerator::generateNextSample(const Bit32u ampVal, const Bit1
 
 			// To ensure the output wave has no breaks, two different windows are applied to the beginning and the ending of the resonance sine segment
 			if (relWavePos < 0.5f * cosineLen) {
-				float syncSine = sin(FLOAT_PI * relWavePos / cosineLen);
 				if (relWavePos < 0.0f) {
 					// The window is synchronous square sine here
-					resAmpFade *= syncSine * syncSine;
+					resAmpFade *= squareWaveSample * squareWaveSample;
 				} else {
 					// The window is synchronous sine here
-					resAmpFade *= syncSine;
+					resAmpFade *= squareWaveSample < 0 ? -squareWaveSample : squareWaveSample;
 				}
 			}
 
@@ -253,7 +270,7 @@ float LA32FloatWaveGenerator::generateNextSample(const Bit32u ampVal, const Bit1
 
 		// sawtooth waves
 		if (sawtoothWaveform) {
-			sample *= cos(FLOAT_2PI * wavePos / waveLen);
+			sample *= LA32FloatMathImpl::fcos(2 * wavePos / waveLen);
 		}
 
 		wavePos++;
@@ -265,7 +282,7 @@ float LA32FloatWaveGenerator::generateNextSample(const Bit32u ampVal, const Bit1
 	}
 
 	// Multiply sample with current TVA value
-	sample *= amp;
+	sample *= ampFactor;
 	return sample;
 }
 
@@ -281,6 +298,11 @@ bool LA32FloatWaveGenerator::isPCMWave() const {
 	return pcmWaveAddress != NULL;
 }
 
+void LA32FloatPartialPair::initTables(const Tables &tables) {
+	resAmpDecayFactors = tables.resAmpDecayFactors;
+	LA32FloatMathImpl::init();
+}
+
 void LA32FloatPartialPair::init(const bool useRingModulated, const bool useMixed) {
 	ringModulated = useRingModulated;
 	mixed = useMixed;
@@ -304,11 +326,35 @@ void LA32FloatPartialPair::initPCM(const PairType useMaster, const Bit16s *pcmWa
 	}
 }
 
-void LA32FloatPartialPair::generateNextSample(const PairType useMaster, const Bit32u amp, const Bit16u pitch, const Bit32u cutoff) {
+void LA32FloatPartialPair::setAmp(const PairType useMaster, const Bit32u amp) {
+	if (useMaster == MASTER) {
+		master.setAmp(amp);
+	} else {
+		slave.setAmp(amp);
+	}
+}
+
+void LA32FloatPartialPair::setPitch(const PairType useMaster, const Bit16u pitch) {
+	if (useMaster == MASTER) {
+		master.setPitch(pitch);
+	} else {
+		slave.setPitch(pitch);
+	}
+}
+
+void LA32FloatPartialPair::setCutoff(const PairType useMaster, const Bit32u cutoff) {
+	if (useMaster == MASTER) {
+		master.setCutoff(cutoff);
+	} else {
+		slave.setCutoff(cutoff);
+	}
+}
+
+void LA32FloatPartialPair::generateNextSample(const PairType useMaster) {
 	if (useMaster == MASTER) {
-		masterOutputSample = master.generateNextSample(amp, pitch, cutoff);
+		masterOutputSample = master.generateNextSample();
 	} else {
-		slaveOutputSample = slave.generateNextSample(amp, pitch, cutoff);
+		slaveOutputSample = slave.generateNextSample();
 	}
 }
 
diff --git a/audio/softsynth/mt32/LA32FloatWaveGenerator.h b/audio/softsynth/mt32/LA32FloatWaveGenerator.h
index 8b0673f97de..0a81568b5ac 100644
--- a/audio/softsynth/mt32/LA32FloatWaveGenerator.h
+++ b/audio/softsynth/mt32/LA32FloatWaveGenerator.h
@@ -1,5 +1,5 @@
 /* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
- * Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ * Copyright (C) 2011-2026 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
@@ -44,7 +44,7 @@ class LA32FloatWaveGenerator {
 	bool sawtoothWaveform;
 
 	// Values in range [1..31]
-	// Value 1 correspong to the minimum resonance
+	// Value 1 corresponds to the minimum resonance
 	Bit8u resonance;
 
 	// Processed value in range [0..255]
@@ -69,9 +69,29 @@ class LA32FloatWaveGenerator {
 	//***************************************************************************
 
 	float wavePos;
-	float lastFreq;
 	float pcmPosition;
+	float pcmPositionDelta;
 
+	float resAmpBase;
+	float resAmp;
+
+	float ampFactor;
+	float freq;
+
+	// Scaled cutoff value to simplify calculations
+	float cutoff;
+
+	// Wave length in samples
+	float waveLen;
+	// Cosine segment length in samples
+	float cosineLen;
+	// Ratio of positive segment to wave length
+	float pulseLenFactor;
+
+	// For cutoff below 50, samples get attenuated exponentially, found by sample analysis
+	float lowCutoffAttenuationFactor;
+
+	void updateWaveFormParameters();
 	float getPCMSample(unsigned int position);
 
 public:
@@ -81,8 +101,16 @@ public:
 	// Initialise the WG engine for generation of PCM partial samples and set up the invariant parameters
 	void initPCM(const Bit16s * const pcmWaveAddress, const Bit32u pcmWaveLength, const bool pcmWaveLooped, const bool pcmWaveInterpolated);
 
-	// Update parameters with respect to TVP, TVA and TVF, and generate next sample
-	float generateNextSample(const Bit32u amp, const Bit16u pitch, const Bit32u cutoff);
+	// Update parameters with respect to TVP, TVA and TVF; should only be called when the values change
+	// Logarithmic amp of the wave generator
+	void setAmp(const Bit32u amp);
+	// Logarithmic frequency of the resulting wave
+	void setPitch(const Bit16u pitch);
+	// Composed of the base cutoff in range [78..178] left-shifted by 18 bits and the TVF modifier
+	void setCutoff(const Bit32u cutoff);
+
+	// Generate the next sample using the current WG parameters
+	float generateNextSample();
 
 	// Deactivate the WG engine
 	void deactivate();
@@ -103,25 +131,32 @@ class LA32FloatPartialPair : public LA32PartialPair {
 	float slaveOutputSample;
 
 public:
+	static void initTables(const Tables &tables);
+
 	// ringModulated should be set to false for the structures with mixing or stereo output
 	// ringModulated should be set to true for the structures with ring modulation
 	// mixed is used for the structures with ring modulation and indicates whether the master partial output is mixed to the ring modulator output
-	void init(const bool ringModulated, const bool mixed) override;
+	void init(const bool ringModulated, const bool mixed);
 
 	// Initialise the WG engine for generation of synth partial samples and set up the invariant parameters
-	void initSynth(const PairType master, const bool sawtoothWaveform, const Bit8u pulseWidth, const Bit8u resonance) override;
+	void initSynth(const PairType master, const bool sawtoothWaveform, const Bit8u pulseWidth, const Bit8u resonance);
 
 	// Initialise the WG engine for generation of PCM partial samples and set up the invariant parameters
-	void initPCM(const PairType master, const Bit16s * const pcmWaveAddress, const Bit32u pcmWaveLength, const bool pcmWaveLooped) override;
+	void initPCM(const PairType master, const Bit16s * const pcmWaveAddress, const Bit32u pcmWaveLength, const bool pcmWaveLooped);
+
+	// Update parameters with respect to TVP, TVA and TVF; should only be called when the values change
+	void setAmp(const PairType master, const Bit32u amp);
+	void setPitch(const PairType master, const Bit16u pitch);
+	void setCutoff(const PairType master, const Bit32u cutoff);
 
-	// Update parameters with respect to TVP, TVA and TVF, and generate next sample
-	void generateNextSample(const PairType master, const Bit32u amp, const Bit16u pitch, const Bit32u cutoff);
+	// Generate the next sample using the current WG parameters
+	void generateNextSample(const PairType master);
 
 	// Perform mixing / ring modulation and return the result
 	float nextOutSample();
 
 	// Deactivate the WG engine
-	void deactivate(const PairType master) override;
+	void deactivate(const PairType master);
 
 	// Return active state of the WG engine
 	bool isActive(const PairType master) const;
diff --git a/audio/softsynth/mt32/LA32Ramp.cpp b/audio/softsynth/mt32/LA32Ramp.cpp
index cc61d8357d7..43b8c32322d 100644
--- a/audio/softsynth/mt32/LA32Ramp.cpp
+++ b/audio/softsynth/mt32/LA32Ramp.cpp
@@ -69,6 +69,12 @@ const unsigned int MAX_CURRENT = 0xFF << TARGET_SHIFTS;
 // scheme eventually.
 const int INTERRUPT_TIME = 7;
 
+static const Bit16u *exp9;
+
+void LA32Ramp::initTables(const Tables &tables) {
+	exp9 = tables.exp9;
+}
+
 LA32Ramp::LA32Ramp() :
 	current(0),
 	largeTarget(0),
@@ -85,7 +91,7 @@ void LA32Ramp::startRamp(Bit8u target, Bit8u increment) {
 		// Three bits in the fractional part, no need to interpolate
 		// (unsigned int)(EXP2F(((increment & 0x7F) + 24) / 8.0f) + 0.125f)
 		Bit32u expArg = increment & 0x7F;
-		largeIncrement = 8191 - Tables::getInstance().exp9[~(expArg << 6) & 511];
+		largeIncrement = 8191 - exp9[~(expArg << 6) & 511];
 		largeIncrement <<= expArg >> 3;
 		largeIncrement += 64;
 		largeIncrement >>= 9;
diff --git a/audio/softsynth/mt32/LA32Ramp.h b/audio/softsynth/mt32/LA32Ramp.h
index 178e16b604e..84b9dc74f1e 100644
--- a/audio/softsynth/mt32/LA32Ramp.h
+++ b/audio/softsynth/mt32/LA32Ramp.h
@@ -23,6 +23,8 @@
 
 namespace MT32Emu {
 
+struct Tables;
+
 class LA32Ramp {
 private:
 	Bit32u current;
@@ -34,6 +36,8 @@ private:
 	bool interruptRaised;
 
 public:
+	static void initTables(const Tables &tables);
+
 	LA32Ramp();
 	void startRamp(Bit8u target, Bit8u increment);
 	Bit32u nextValue();
diff --git a/audio/softsynth/mt32/LA32WaveGenerator.cpp b/audio/softsynth/mt32/LA32WaveGenerator.cpp
index cf1a34c9c2b..3daaf25e976 100644
--- a/audio/softsynth/mt32/LA32WaveGenerator.cpp
+++ b/audio/softsynth/mt32/LA32WaveGenerator.cpp
@@ -1,5 +1,5 @@
 /* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
- * Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ * Copyright (C) 2011-2026 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
@@ -27,45 +27,45 @@ namespace MT32Emu {
 static const Bit32u SINE_SEGMENT_RELATIVE_LENGTH = 1 << 18;
 static const Bit32u MIDDLE_CUTOFF_VALUE = 128 << 18;
 static const Bit32u RESONANCE_DECAY_THRESHOLD_CUTOFF_VALUE = 144 << 18;
-static const Bit32u MAX_CUTOFF_VALUE = 240 << 18;
 static const LogSample SILENCE = {65535, LogSample::POSITIVE};
 
-Bit16u LA32Utilites::interpolateExp(const Bit16u fract) {
+// These two tables are accessed extremely often. Keeping the direct pointers here significantly improves performance in most cases.
+static const Bit16u *exp9;
+static const Bit16u *logsin9;
+// This is accessed less often, but it's still on the critical path.
+static const Bit8u *resAmpDecayFactors;
+
+namespace LA32Utilites {
+
+static inline Bit16u interpolateExp(const Bit16u fract) {
 	Bit16u expTabIndex = fract >> 3;
 	Bit16u extraBits = ~fract & 7;
-	Bit16u expTabEntry2 = 8191 - Tables::getInstance().exp9[expTabIndex];
-	Bit16u expTabEntry1 = expTabIndex == 0 ? 8191 : (8191 - Tables::getInstance().exp9[expTabIndex - 1]);
+	Bit16u expTabEntry2 = 8191 - exp9[expTabIndex];
+	Bit16u expTabEntry1 = expTabIndex == 0 ? 8191 : (8191 - exp9[expTabIndex - 1]);
 	return expTabEntry2 + (((expTabEntry1 - expTabEntry2) * extraBits) >> 3);
 }
 
-Bit16s LA32Utilites::unlog(const LogSample &logSample) {
-	//Bit16s sample = (Bit16s)EXP2F(13.0f - logSample.logValue / 1024.0f);
+static inline Bit16s unlog(const LogSample &logSample) {
+	//Bit16s sample = (Bit16s)EXP2F(13.0f - logSample.logValue / 4096.0f);
 	Bit32u intLogValue = logSample.logValue >> 12;
 	Bit16u fracLogValue = logSample.logValue & 4095;
 	Bit16s sample = interpolateExp(fracLogValue) >> intLogValue;
 	return logSample.sign == LogSample::POSITIVE ? sample : -sample;
 }
 
-void LA32Utilites::addLogSamples(LogSample &logSample1, const LogSample &logSample2) {
+static inline void addLogSamples(LogSample &logSample1, const LogSample &logSample2) {
 	Bit32u logSampleValue = logSample1.logValue + logSample2.logValue;
 	logSample1.logValue = logSampleValue < 65536 ? Bit16u(logSampleValue) : 65535;
 	logSample1.sign = logSample1.sign == logSample2.sign ? LogSample::POSITIVE : LogSample::NEGATIVE;
 }
 
-Bit32u LA32WaveGenerator::getSampleStep() {
-	// sampleStep = EXP2F(pitch / 4096.0f + 4.0f)
-	Bit32u sampleStep = LA32Utilites::interpolateExp(~pitch & 4095);
-	sampleStep <<= pitch >> 12;
-	sampleStep >>= 8;
-	sampleStep &= ~1;
-	return sampleStep;
-}
+} // namespace LA32Utilites
 
 Bit32u LA32WaveGenerator::getResonanceWaveLengthFactor(Bit32u effectiveCutoffValue) {
 	// resonanceWaveLengthFactor = (Bit32u)EXP2F(12.0f + effectiveCutoffValue / 4096.0f);
-	Bit32u resonanceWaveLengthFactor = LA32Utilites::interpolateExp(~effectiveCutoffValue & 4095);
-	resonanceWaveLengthFactor <<= effectiveCutoffValue >> 12;
-	return resonanceWaveLengthFactor;
+	Bit32u factor = LA32Utilites::interpolateExp(~effectiveCutoffValue & 4095);
+	factor <<= effectiveCutoffValue >> 12;
+	return factor;
 }
 
 Bit32u LA32WaveGenerator::getHighLinearLength(Bit32u effectiveCutoffValue) {
@@ -75,18 +75,18 @@ Bit32u LA32WaveGenerator::getHighLinearLength(Bit32u effectiveCutoffValue) {
 		effectivePulseWidthValue = (pulseWidth - 128) << 6;
 	}
 
-	Bit32u highLinearLength = 0;
 	// highLinearLength = EXP2F(19.0f - effectivePulseWidthValue / 4096.0f + effectiveCutoffValue / 4096.0f) - 2 * SINE_SEGMENT_RELATIVE_LENGTH;
 	if (effectivePulseWidthValue < effectiveCutoffValue) {
 		Bit32u expArg = effectiveCutoffValue - effectivePulseWidthValue;
-		highLinearLength = LA32Utilites::interpolateExp(~expArg & 4095);
-		highLinearLength <<= 7 + (expArg >> 12);
-		highLinearLength -= 2 * SINE_SEGMENT_RELATIVE_LENGTH;
+		Bit32u length = LA32Utilites::interpolateExp(~expArg & 4095);
+		length <<= 7 + (expArg >> 12);
+		length -= 2 * SINE_SEGMENT_RELATIVE_LENGTH;
+		return length;
 	}
-	return highLinearLength;
+	return 0;
 }
 
-void LA32WaveGenerator::computePositions(Bit32u highLinearLength, Bit32u lowLinearLength, Bit32u resonanceWaveLengthFactor) {
+void LA32WaveGenerator::computePositions() {
 	// Assuming 12-bit multiplication used here
 	squareWavePosition = resonanceSinePosition = (wavePosition >> 8) * (resonanceWaveLengthFactor >> 4);
 	if (squareWavePosition < SINE_SEGMENT_RELATIVE_LENGTH) {
@@ -119,15 +119,9 @@ void LA32WaveGenerator::computePositions(Bit32u highLinearLength, Bit32u lowLine
 }
 
 void LA32WaveGenerator::advancePosition() {
-	wavePosition += getSampleStep();
+	wavePosition += sampleStep;
 	wavePosition %= 4 * SINE_SEGMENT_RELATIVE_LENGTH;
-
-	Bit32u effectiveCutoffValue = (cutoffVal > MIDDLE_CUTOFF_VALUE) ? (cutoffVal - MIDDLE_CUTOFF_VALUE) >> 10 : 0;
-	Bit32u resonanceWaveLengthFactor = getResonanceWaveLengthFactor(effectiveCutoffValue);
-	Bit32u highLinearLength = getHighLinearLength(effectiveCutoffValue);
-	Bit32u lowLinearLength = (resonanceWaveLengthFactor << 8) - 4 * SINE_SEGMENT_RELATIVE_LENGTH - highLinearLength;
-	computePositions(highLinearLength, lowLinearLength, resonanceWaveLengthFactor);
-
+	computePositions();
 	resonancePhase = ResonancePhase(((resonanceSinePosition >> 18) + (phase > POSITIVE_FALLING_SINE_SEGMENT ? 2 : 0)) & 3);
 }
 
@@ -136,11 +130,11 @@ void LA32WaveGenerator::generateNextSquareWaveLogSample() {
 	switch (phase) {
 		case POSITIVE_RISING_SINE_SEGMENT:
 		case NEGATIVE_FALLING_SINE_SEGMENT:
-			logSampleValue = Tables::getInstance().logsin9[(squareWavePosition >> 9) & 511];
+			logSampleValue = logsin9[(squareWavePosition >> 9) & 511];
 			break;
 		case POSITIVE_FALLING_SINE_SEGMENT:
 		case NEGATIVE_RISING_SINE_SEGMENT:
-			logSampleValue = Tables::getInstance().logsin9[~(squareWavePosition >> 9) & 511];
+			logSampleValue = logsin9[~(squareWavePosition >> 9) & 511];
 			break;
 		case POSITIVE_LINEAR_SEGMENT:
 		case NEGATIVE_LINEAR_SEGMENT:
@@ -149,10 +143,7 @@ void LA32WaveGenerator::generateNextSquareWaveLogSample() {
 			break;
 	}
 	logSampleValue <<= 2;
-	logSampleValue += amp >> 10;
-	if (cutoffVal < MIDDLE_CUTOFF_VALUE) {
-		logSampleValue += (MIDDLE_CUTOFF_VALUE - cutoffVal) >> 9;
-	}
+	logSampleValue += amp + squareWaveAmpSubtraction;
 
 	squareLogSample.logValue = logSampleValue < 65536 ? Bit16u(logSampleValue) : 65535;
 	squareLogSample.sign = phase < NEGATIVE_FALLING_SINE_SEGMENT ? LogSample::POSITIVE : LogSample::NEGATIVE;
@@ -161,12 +152,12 @@ void LA32WaveGenerator::generateNextSquareWaveLogSample() {
 void LA32WaveGenerator::generateNextResonanceWaveLogSample() {
 	Bit32u logSampleValue;
 	if (resonancePhase == POSITIVE_FALLING_RESONANCE_SINE_SEGMENT || resonancePhase == NEGATIVE_RISING_RESONANCE_SINE_SEGMENT) {
-		logSampleValue = Tables::getInstance().logsin9[~(resonanceSinePosition >> 9) & 511];
+		logSampleValue = logsin9[~(resonanceSinePosition >> 9) & 511];
 	} else {
-		logSampleValue = Tables::getInstance().logsin9[(resonanceSinePosition >> 9) & 511];
+		logSampleValue = logsin9[(resonanceSinePosition >> 9) & 511];
 	}
 	logSampleValue <<= 2;
-	logSampleValue += amp >> 10;
+	logSampleValue += amp;
 
 	// From the digital captures, the decaying speed of the resonance sine is found a bit different for the positive and the negative segments
 	Bit32u decayFactor = phase < NEGATIVE_FALLING_SINE_SEGMENT ? resAmpDecayFactor : resAmpDecayFactor + 1;
@@ -176,20 +167,13 @@ void LA32WaveGenerator::generateNextResonanceWaveLogSample() {
 	// To ensure the output wave has no breaks, two different windows are applied to the beginning and the ending of the resonance sine segment
 	if (phase == POSITIVE_RISING_SINE_SEGMENT || phase == NEGATIVE_FALLING_SINE_SEGMENT) {
 		// The window is synchronous sine here
-		logSampleValue += Tables::getInstance().logsin9[(squareWavePosition >> 9) & 511] << 2;
+		logSampleValue += logsin9[(squareWavePosition >> 9) & 511] << 2;
 	} else if (phase == POSITIVE_FALLING_SINE_SEGMENT || phase == NEGATIVE_RISING_SINE_SEGMENT) {
 		// The window is synchronous square sine here
-		logSampleValue += Tables::getInstance().logsin9[~(squareWavePosition >> 9) & 511] << 3;
+		logSampleValue += logsin9[~(squareWavePosition >> 9) & 511] << 3;
 	}
 
-	if (cutoffVal < MIDDLE_CUTOFF_VALUE) {
-		// For the cutoff values below the cutoff middle point, it seems the amp of the resonance wave is exponentially decayed
-		logSampleValue += 31743 + ((MIDDLE_CUTOFF_VALUE - cutoffVal) >> 9);
-	} else if (cutoffVal < RESONANCE_DECAY_THRESHOLD_CUTOFF_VALUE) {
-		// For the cutoff values below this point, the amp of the resonance wave is sinusoidally decayed
-		Bit32u sineIx = (cutoffVal - MIDDLE_CUTOFF_VALUE) >> 13;
-		logSampleValue += Tables::getInstance().logsin9[sineIx] << 2;
-	}
+	logSampleValue += resonanceWaveAmpSubtraction;
 
 	// After all the amp decrements are added, it should be safe now to adjust the amp of the resonance wave to what we see on captures
 	logSampleValue -= 1 << 12;
@@ -201,9 +185,9 @@ void LA32WaveGenerator::generateNextResonanceWaveLogSample() {
 void LA32WaveGenerator::generateNextSawtoothCosineLogSample(LogSample &logSample) const {
 	Bit32u sawtoothCosinePosition = wavePosition + (1 << 18);
 	if ((sawtoothCosinePosition & (1 << 18)) > 0) {
-		logSample.logValue = Tables::getInstance().logsin9[~(sawtoothCosinePosition >> 9) & 511];
+		logSample.logValue = logsin9[~(sawtoothCosinePosition >> 9) & 511];
 	} else {
-		logSample.logValue = Tables::getInstance().logsin9[(sawtoothCosinePosition >> 9) & 511];
+		logSample.logValue = logsin9[(sawtoothCosinePosition >> 9) & 511];
 	}
 	logSample.logValue <<= 2;
 	logSample.sign = ((sawtoothCosinePosition & (1 << 19)) == 0) ? LogSample::POSITIVE : LogSample::NEGATIVE;
@@ -211,7 +195,7 @@ void LA32WaveGenerator::generateNextSawtoothCosineLogSample(LogSample &logSample
 
 void LA32WaveGenerator::pcmSampleToLogSample(LogSample &logSample, const Bit16s pcmSample) const {
 	Bit32u logSampleValue = (32787 - (pcmSample & 32767)) << 1;
-	logSampleValue += amp >> 10;
+	logSampleValue += amp;
 	logSample.logValue = logSampleValue < 65536 ? Bit16u(logSampleValue) : 65535;
 	logSample.sign = pcmSample < 0 ? LogSample::NEGATIVE : LogSample::POSITIVE;
 }
@@ -238,12 +222,6 @@ void LA32WaveGenerator::generateNextPCMWaveLogSamples() {
 	} else {
 		secondPCMLogSample = SILENCE;
 	}
-	// pcmSampleStep = (Bit32u)EXP2F(pitch / 4096.0f + 3.0f);
-	Bit32u pcmSampleStep = LA32Utilites::interpolateExp(~pitch & 4095);
-	pcmSampleStep <<= pitch >> 12;
-	// Seeing the actual lengths of the PCM wave for pitches 00..12,
-	// the pcmPosition counter can be assumed to have 8-bit fractions
-	pcmSampleStep >>= 9;
 	wavePosition += pcmSampleStep;
 	if (wavePosition >= (pcmWaveLength << 8)) {
 		if (pcmWaveLooped) {
@@ -267,7 +245,11 @@ void LA32WaveGenerator::initSynth(const bool useSawtoothWaveform, const Bit8u us
 	resonanceSinePosition = 0;
 	resonancePhase = POSITIVE_RISING_RESONANCE_SINE_SEGMENT;
 	resonanceAmpSubtraction = (32 - resonance) << 10;
-	resAmpDecayFactor = Tables::getInstance().resAmpDecayFactor[resonance >> 2] << 2;
+	resAmpDecayFactor = resAmpDecayFactors[resonance >> 2] << 2;
+
+	setAmp(0);
+	setPitch(0);
+	setCutoff(0);
 
 	pcmWaveAddress = NULL;
 	active = true;
@@ -279,27 +261,62 @@ void LA32WaveGenerator::initPCM(const Bit16s * const usePCMWaveAddress, const Bi
 	pcmWaveLooped = usePCMWaveLooped;
 	pcmWaveInterpolated = usePCMWaveInterpolated;
 
+	setAmp(0);
+	setPitch(0);
+
 	wavePosition = 0;
 	active = true;
 }
 
-void LA32WaveGenerator::generateNextSample(const Bit32u useAmp, const Bit16u usePitch, const Bit32u useCutoffVal) {
+void LA32WaveGenerator::setAmp(const Bit32u useAmp) {
+	amp = useAmp >> 10;
+}
+
+void LA32WaveGenerator::setPitch(const Bit16u pitch) {
+	// sampleStep = EXP2F(pitch / 4096.0f + 4.0f)
+	// pcmSampleStep = EXP2F(pitch / 4096.0f + 3.0f);
+	Bit32u newStep = LA32Utilites::interpolateExp(~pitch & 4095);
+	newStep <<= pitch >> 12;
+	if (isPCMWave()) {
+		// Seeing the actual lengths of the PCM wave for pitches 00..12,
+		// the wavePosition counter can be assumed to have 8-bit fractions
+		pcmSampleStep = newStep >> 9;
+	} else {
+		sampleStep = (newStep >> 8) & ~1;
+	}
+}
+
+void LA32WaveGenerator::setCutoff(const Bit32u cutoffVal) {
+	Bit32u effectiveCutoffValue = (cutoffVal > MIDDLE_CUTOFF_VALUE) ? (cutoffVal - MIDDLE_CUTOFF_VALUE) >> 10 : 0;
+	resonanceWaveLengthFactor = getResonanceWaveLengthFactor(effectiveCutoffValue);
+	highLinearLength = getHighLinearLength(effectiveCutoffValue);
+	lowLinearLength = (resonanceWaveLengthFactor << 8) - 4 * SINE_SEGMENT_RELATIVE_LENGTH - highLinearLength;
+
+	if (cutoffVal < MIDDLE_CUTOFF_VALUE) {
+		squareWaveAmpSubtraction = (MIDDLE_CUTOFF_VALUE - cutoffVal) >> 9;
+		// For the cutoff values below the cutoff middle point, it seems the amp of the resonance wave is exponentially decayed
+		resonanceWaveAmpSubtraction = 31743 + ((MIDDLE_CUTOFF_VALUE - cutoffVal) >> 9);
+	} else if (cutoffVal < RESONANCE_DECAY_THRESHOLD_CUTOFF_VALUE) {
+		squareWaveAmpSubtraction = 0;
+		// For the cutoff values below this point, the amp of the resonance wave is sinusoidally decayed
+		Bit32u sineIx = (cutoffVal - MIDDLE_CUTOFF_VALUE) >> 13;
+		resonanceWaveAmpSubtraction = logsin9[sineIx] << 2;
+	} else {
+		squareWaveAmpSubtraction = 0;
+		resonanceWaveAmpSubtraction = 0;
+	}
+}
+
+void LA32WaveGenerator::generateNextSample() {
 	if (!active) {
 		return;
 	}
 
-	amp = useAmp;
-	pitch = usePitch;
-
 	if (isPCMWave()) {
 		generateNextPCMWaveLogSamples();
 		return;
 	}
 
-	// The 240 cutoffVal limit was determined via sample analysis (internal Munt capture IDs: glop3, glop4).
-	// More research is needed to be sure that this is correct, however.
-	cutoffVal = (useCutoffVal > MAX_CUTOFF_VALUE) ? MAX_CUTOFF_VALUE : useCutoffVal;
-
 	generateNextSquareWaveLogSample();
 	generateNextResonanceWaveLogSample();
 	if (sawtoothWaveform) {
@@ -337,6 +354,12 @@ Bit32u LA32WaveGenerator::getPCMInterpolationFactor() const {
 	return pcmInterpolationFactor;
 }
 
+void LA32IntPartialPair::initTables(const Tables &tables) {
+	exp9 = tables.exp9;
+	logsin9 = tables.logsin9;
+	resAmpDecayFactors = tables.resAmpDecayFactors;
+}
+
 void LA32IntPartialPair::init(const bool useRingModulated, const bool useMixed) {
 	ringModulated = useRingModulated;
 	mixed = useMixed;
@@ -358,11 +381,35 @@ void LA32IntPartialPair::initPCM(const PairType useMaster, const Bit16s *pcmWave
 	}
 }
 
-void LA32IntPartialPair::generateNextSample(const PairType useMaster, const Bit32u amp, const Bit16u pitch, const Bit32u cutoff) {
+void LA32IntPartialPair::setAmp(const PairType useMaster, const Bit32u amp) {
+	if (useMaster == MASTER) {
+		master.setAmp(amp);
+	} else {
+		slave.setAmp(amp);
+	}
+}
+
+void LA32IntPartialPair::setPitch(const PairType useMaster, const Bit16u pitch) {
+	if (useMaster == MASTER) {
+		master.setPitch(pitch);
+	} else {
+		slave.setPitch(pitch);
+	}
+}
+
+void LA32IntPartialPair::setCutoff(const PairType useMaster, const Bit32u cutoff) {
+	if (useMaster == MASTER) {
+		master.setCutoff(cutoff);
+	} else {
+		slave.setCutoff(cutoff);
+	}
+}
+
+void LA32IntPartialPair::generateNextSample(const PairType useMaster) {
 	if (useMaster == MASTER) {
-		master.generateNextSample(amp, pitch, cutoff);
+		master.generateNextSample();
 	} else {
-		slave.generateNextSample(amp, pitch, cutoff);
+		slave.generateNextSample();
 	}
 }
 
diff --git a/audio/softsynth/mt32/LA32WaveGenerator.h b/audio/softsynth/mt32/LA32WaveGenerator.h
index d2e128e1e75..de946c7ccef 100644
--- a/audio/softsynth/mt32/LA32WaveGenerator.h
+++ b/audio/softsynth/mt32/LA32WaveGenerator.h
@@ -1,5 +1,5 @@
 /* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
- * Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ * Copyright (C) 2011-2026 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
@@ -24,6 +24,8 @@
 
 namespace MT32Emu {
 
+struct Tables;
+
 /**
  * LA32 performs wave generation in the log-space that allows replacing multiplications by cheap additions
  * It's assumed that only low-bit multiplications occur in a few places which are unavoidable like these:
@@ -45,13 +47,6 @@ struct LogSample {
 	} sign;
 };
 
-class LA32Utilites {
-public:
-	static Bit16u interpolateExp(const Bit16u fract);
-	static Bit16s unlog(const LogSample &logSample);
-	static void addLogSamples(LogSample &logSample1, const LogSample &logSample2);
-};
-
 /**
  * LA32WaveGenerator is aimed to represent the exact model of LA32 wave generator.
  * The output square wave is created by adding high / low linear segments in-between
@@ -70,14 +65,8 @@ class LA32WaveGenerator {
 	// True means the resulting square wave is to be multiplied by the synchronous cosine
 	bool sawtoothWaveform;
 
-	// Logarithmic amp of the wave generator
-	Bit32u amp;
-
-	// Logarithmic frequency of the resulting wave
-	Bit16u pitch;
-
 	// Values in range [1..31]
-	// Value 1 correspong to the minimum resonance
+	// Value 1 corresponds to the minimum resonance
 	Bit8u resonance;
 
 	// Processed value in range [0..255]
@@ -85,9 +74,6 @@ class LA32WaveGenerator {
 	// Value 255 corresponds to the maximum possible asymmetric of the resulting wave
 	Bit8u pulseWidth;
 
-	// Composed of the base cutoff in range [78..178] left-shifted by 18 bits and the TVF modifier
-	Bit32u cutoffVal;
-
 	// Logarithmic PCM sample start address
 	const Bit16s *pcmWaveAddress;
 
@@ -104,6 +90,13 @@ class LA32WaveGenerator {
 	// Internal variables below
 	//***************************************************************************
 
+	// Logarithmic amp of the wave generator, scaled down by factor 2^-10
+	Bit32u amp;
+
+	// The increments applied to wavePosition per sample, depend on pitch
+	Bit32u sampleStep;
+	Bit32u pcmSampleStep;
+
 	// Relative position within either the synth wave or the PCM sampled wave
 	// 0 - start of the positive rising sine segment of the square wave or start of the PCM sample
 	// 1048576 (2^20) - end of the negative rising sine segment of the square wave
@@ -129,6 +122,16 @@ class LA32WaveGenerator {
 	// The decay speed of resonance sine wave, depends on the resonance value
 	Bit32u resAmpDecayFactor;
 
+	// The relative lengths of the sine, high and low linear segments in terms of SINE_SEGMENT_RELATIVE_LENGTH, depend on cutoff
+	Bit32u highLinearLength;
+	Bit32u lowLinearLength;
+	Bit32u resonanceWaveLengthFactor;
+
+	// The square wave decay level, applied when cutoff is below MIDDLE_CUTOFF_VALUE, depends on cutoff
+	Bit32u squareWaveAmpSubtraction;
+	// The resonance wave decay level, applied when cutoff is below RESONANCE_DECAY_THRESHOLD_CUTOFF_VALUE, depends on cutoff
+	Bit32u resonanceWaveAmpSubtraction;
+
 	// Fractional part of the pcmPosition
 	Bit32u pcmInterpolationFactor;
 
@@ -162,11 +165,10 @@ class LA32WaveGenerator {
 	// Internal methods below
 	//***************************************************************************
 
-	Bit32u getSampleStep();
-	Bit32u getResonanceWaveLengthFactor(Bit32u effectiveCutoffValue);
+	static Bit32u getResonanceWaveLengthFactor(Bit32u effectiveCutoffValue);
 	Bit32u getHighLinearLength(Bit32u effectiveCutoffValue);
 
-	void computePositions(Bit32u highLinearLength, Bit32u lowLinearLength, Bit32u resonanceWaveLengthFactor);
+	void computePositions();
 	void advancePosition();
 
 	void generateNextSquareWaveLogSample();
@@ -183,8 +185,16 @@ public:
 	// Initialise the WG engine for generation of PCM partial samples and set up the invariant parameters
 	void initPCM(const Bit16s * const pcmWaveAddress, const Bit32u pcmWaveLength, const bool pcmWaveLooped, const bool pcmWaveInterpolated);
 
-	// Update parameters with respect to TVP, TVA and TVF, and generate next sample
-	void generateNextSample(const Bit32u amp, const Bit16u pitch, const Bit32u cutoff);
+	// Setters below update WG parameters with respect to TVP, TVA and TVF; should only be called when the values change
+	// Logarithmic amp of the wave generator
+	void setAmp(const Bit32u amp);
+	// Logarithmic frequency of the resulting wave
+	void setPitch(const Bit16u pitch);
+	// Composed of the base cutoff in range [78..178] left-shifted by 18 bits and the TVF modifier
+	void setCutoff(const Bit32u cutoff);
+
+	// Generate the next sample using the current WG parameters
+	void generateNextSample();
 
 	// WG output in the log-space consists of two components which are to be added (or ring modulated) in the linear-space afterwards
 	LogSample getOutputLogSample(const bool first) const;
@@ -236,26 +246,33 @@ class LA32IntPartialPair : public LA32PartialPair {
 	static Bit16s unlogAndMixWGOutput(const LA32WaveGenerator &wg);
 
 public:
+	static void initTables(const Tables &tables);
+
 	// ringModulated should be set to false for the structures with mixing or stereo output
 	// ringModulated should be set to true for the structures with ring modulation
 	// mixed is used for the structures with ring modulation and indicates whether the master partial output is mixed to the ring modulator output
-	void init(const bool ringModulated, const bool mixed) override;
+	void init(const bool ringModulated, const bool mixed);
 
 	// Initialise the WG engine for generation of synth partial samples and set up the invariant parameters
-	void initSynth(const PairType master, const bool sawtoothWaveform, const Bit8u pulseWidth, const Bit8u resonance) override;
+	void initSynth(const PairType master, const bool sawtoothWaveform, const Bit8u pulseWidth, const Bit8u resonance);
 
 	// Initialise the WG engine for generation of PCM partial samples and set up the invariant parameters
-	void initPCM(const PairType master, const Bit16s * const pcmWaveAddress, const Bit32u pcmWaveLength, const bool pcmWaveLooped) override;
+	void initPCM(const PairType master, const Bit16s * const pcmWaveAddress, const Bit32u pcmWaveLength, const bool pcmWaveLooped);
+
+	// Update parameters with respect to TVP, TVA and TVF; should only be called when the values change
+	void setAmp(const PairType master, const Bit32u amp);
+	void setPitch(const PairType master, const Bit16u pitch);
+	void setCutoff(const PairType master, const Bit32u cutoff);
 
-	// Update parameters with respect to TVP, TVA and TVF, and generate next sample
-	void generateNextSample(const PairType master, const Bit32u amp, const Bit16u pitch, const Bit32u cutoff);
+	// Generate the next sample using the current WG parameters
+	void generateNextSample(const PairType master);
 
 	// Perform mixing / ring modulation of WG output and return the result
 	// Although, LA32 applies panning itself, we assume it is applied in the mixer, not within a pair
 	Bit16s nextOutSample();
 
 	// Deactivate the WG engine
-	void deactivate(const PairType master) override;
+	void deactivate(const PairType master);
 
 	// Return active state of the WG engine
 	bool isActive(const PairType master) const;
diff --git a/audio/softsynth/mt32/MemoryRegion.h b/audio/softsynth/mt32/MemoryRegion.h
index 1f224768ce9..568d096a63c 100644
--- a/audio/softsynth/mt32/MemoryRegion.h
+++ b/audio/softsynth/mt32/MemoryRegion.h
@@ -1,5 +1,5 @@
 /* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
- * Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ * Copyright (C) 2011-2026 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
@@ -34,15 +34,13 @@ class Synth;
 
 class MemoryRegion {
 private:
-	Synth *synth;
 	Bit8u *realMemory;
 	Bit8u *maxTable;
 public:
 	MemoryRegionType type;
 	Bit32u startAddr, entrySize, entries;
 
-	MemoryRegion(Synth *useSynth, Bit8u *useRealMemory, Bit8u *useMaxTable, MemoryRegionType useType, Bit32u useStartAddr, Bit32u useEntrySize, Bit32u useEntries) {
-		synth = useSynth;
+	MemoryRegion(Bit8u *useRealMemory, Bit8u *useMaxTable, MemoryRegionType useType, Bit32u useStartAddr, Bit32u useEntrySize, Bit32u useEntries) {
 		realMemory = useRealMemory;
 		maxTable = useMaxTable;
 		type = useType;
@@ -96,37 +94,37 @@ public:
 
 class PatchTempMemoryRegion : public MemoryRegion {
 public:
-	PatchTempMemoryRegion(Synth *useSynth, Bit8u *useRealMemory, Bit8u *useMaxTable) : MemoryRegion(useSynth, useRealMemory, useMaxTable, MR_PatchTemp, MT32EMU_MEMADDR(0x030000), sizeof(MemParams::PatchTemp), 9) {}
+	PatchTempMemoryRegion(Bit8u *useRealMemory, Bit8u *useMaxTable) : MemoryRegion(useRealMemory, useMaxTable, MR_PatchTemp, MT32EMU_MEMADDR(0x030000), sizeof(MemParams::PatchTemp), 9) {}
 };
 class RhythmTempMemoryRegion : public MemoryRegion {
 public:
-	RhythmTempMemoryRegion(Synth *useSynth, Bit8u *useRealMemory, Bit8u *useMaxTable) : MemoryRegion(useSynth, useRealMemory, useMaxTable, MR_RhythmTemp, MT32EMU_MEMADDR(0x030110), sizeof(MemParams::RhythmTemp), 85) {}
+	RhythmTempMemoryRegion(Bit8u *useRealMemory, Bit8u *useMaxTable) : MemoryRegion(useRealMemory, useMaxTable, MR_RhythmTemp, MT32EMU_MEMADDR(0x030110), sizeof(MemParams::RhythmTemp), 85) {}
 };
 class TimbreTempMemoryRegion : public MemoryRegion {
 public:
-	TimbreTempMemoryRegion(Synth *useSynth, Bit8u *useRealMemory, Bit8u *useMaxTable) : MemoryRegion(useSynth, useRealMemory, useMaxTable, MR_TimbreTemp, MT32EMU_MEMADDR(0x040000), sizeof(TimbreParam), 8) {}
+	TimbreTempMemoryRegion(Bit8u *useRealMemory, Bit8u *useMaxTable) : MemoryRegion(useRealMemory, useMaxTable, MR_TimbreTemp, MT32EMU_MEMADDR(0x040000), sizeof(TimbreParam), 8) {}
 };
 class PatchesMemoryRegion : public MemoryRegion {
 public:
-	PatchesMemoryRegion(Synth *useSynth, Bit8u *useRealMemory, Bit8u *useMaxTable) : MemoryRegion(useSynth, useRealMemory, useMaxTable, MR_Patches, MT32EMU_MEMADDR(0x050000), sizeof(PatchParam), 128) {}
+	PatchesMemoryRegion(Bit8u *useRealMemory, Bit8u *useMaxTable) : MemoryRegion(useRealMemory, useMaxTable, MR_Patches, MT32EMU_MEMADDR(0x050000), sizeof(PatchParam), 128) {}
 };
 class TimbresMemoryRegion : public MemoryRegion {
 public:
-	TimbresMemoryRegion(Synth *useSynth, Bit8u *useRealMemory, Bit8u *useMaxTable) : MemoryRegion(useSynth, useRealMemory, useMaxTable, MR_Timbres, MT32EMU_MEMADDR(0x080000), sizeof(MemParams::PaddedTimbre), 64 + 64 + 64 + 64) {}
+	TimbresMemoryRegion(Bit8u *useRealMemory, Bit8u *useMaxTable) : MemoryRegion(useRealMemory, useMaxTable, MR_Timbres, MT32EMU_MEMADDR(0x080000), sizeof(MemParams::PaddedTimbre), 64) {}
 };
 class SystemMemoryRegion : public MemoryRegion {
 public:
-	SystemMemoryRegion(Synth *useSynth, Bit8u *useRealMemory, Bit8u *useMaxTable) : MemoryRegion(useSynth, useRealMemory, useMaxTable, MR_System, MT32EMU_MEMADDR(0x100000), sizeof(MemParams::System), 1) {}
+	SystemMemoryRegion(Bit8u *useRealMemory, Bit8u *useMaxTable) : MemoryRegion(useRealMemory, useMaxTable, MR_System, MT32EMU_MEMADDR(0x100000), sizeof(MemParams::System), 1) {}
 };
 class DisplayMemoryRegion : public MemoryRegion {
 public:
 	// Note, we set realMemory to NULL despite the real devices buffer inbound strings. However, it is impossible to retrieve them.
 	// This entrySize permits emulation of handling a 20-byte display message sent to an old-gen device at address 0x207F7F.
-	DisplayMemoryRegion(Synth *useSynth) : MemoryRegion(useSynth, NULL, NULL, MR_Display, MT32EMU_MEMADDR(0x200000), 0x4013, 1) {}
+	DisplayMemoryRegion() : MemoryRegion(NULL, NULL, MR_Display, MT32EMU_MEMADDR(0x200000), 0x4013, 1) {}
 };
 class ResetMemoryRegion : public MemoryRegion {
 public:
-	ResetMemoryRegion(Synth *useSynth) : MemoryRegion(useSynth, NULL, NULL, MR_Reset, MT32EMU_MEMADDR(0x7F0000), 0x3FFF, 1) {}
+	ResetMemoryRegion() : MemoryRegion(NULL, NULL, MR_Reset, MT32EMU_MEMADDR(0x7F0000), 0x3FFF, 1) {}
 };
 
 } // namespace MT32Emu
diff --git a/audio/softsynth/mt32/MidiStreamParser.cpp b/audio/softsynth/mt32/MidiStreamParser.cpp
index 0191c208190..5b8ba612796 100644
--- a/audio/softsynth/mt32/MidiStreamParser.cpp
+++ b/audio/softsynth/mt32/MidiStreamParser.cpp
@@ -1,5 +1,5 @@
 /* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
- * Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ * Copyright (C) 2011-2024 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
@@ -41,8 +41,7 @@ void DefaultMidiStreamParser::handleShortMessage(const Bit32u message) {
 	do {
 		if (timestampSet) {
 			if (synth.playMsg(message, timestamp)) return;
-		}
-		else {
+		} else {
 			if (synth.playMsg(message)) return;
 		}
 	} while (synth.reportHandler->onMIDIQueueOverflow());
@@ -52,8 +51,7 @@ void DefaultMidiStreamParser::handleSysex(const Bit8u *stream, const Bit32u leng
 	do {
 		if (timestampSet) {
 			if (synth.playSysex(stream, length, timestamp)) return;
-		}
-		else {
+		} else {
 			if (synth.playSysex(stream, length)) return;
 		}
 	} while (synth.reportHandler->onMIDIQueueOverflow());
@@ -131,9 +129,11 @@ void MidiStreamParserImpl::processShortMessage(const Bit32u message) {
 
 // We deal with SysEx messages below 512 bytes long in most cases. Nevertheless, it seems reasonable to support a possibility
 // to load bulk dumps using a single message. However, this is known to fail with a real device due to limited input buffer size.
+// Checks whether there is available space in the buffer, potentially reallocating it to the maximum capacity.
+// Returns true iff it's possible to add a new byte to the buffer.
 bool MidiStreamParserImpl::checkStreamBufferCapacity(const bool preserveContent) {
 	if (streamBufferSize < streamBufferCapacity) return true;
-	if (streamBufferCapacity < MAX_STREAM_BUFFER_SIZE) {
+	if (streamBufferSize < MAX_STREAM_BUFFER_SIZE && streamBufferCapacity < MAX_STREAM_BUFFER_SIZE) {
 		Bit8u *oldStreamBuffer = streamBuffer;
 		streamBufferCapacity = MAX_STREAM_BUFFER_SIZE;
 		streamBuffer = new Bit8u[streamBufferCapacity];
@@ -191,7 +191,15 @@ Bit32u MidiStreamParserImpl::parseShortMessageDataBytes(const Bit8u stream[], Bi
 		} else if (dataByte < 0xF8) {
 			// Discard invalid bytes and start over
 			char s[128];
-			snprintf(s, 128, "parseShortMessageDataBytes: Invalid short message: status %02x, expected length %i, actual %i -> ignored", *streamBuffer, shortMessageLength, streamBufferSize);
+#ifdef MT32EMU_WITH_SNPRINTF
+			snprintf(
+				s, sizeof s,
+#else
+			sprintf(
+				s,
+#endif
+				"parseShortMessageDataBytes: Invalid short message: status %02x, expected length %i, actual %i -> ignored", *streamBuffer, shortMessageLength, streamBufferSize
+			);
 			midiReporter.printDebug(s);
 			streamBufferSize = 0; // Clear streamBuffer
 			return parsedLength;
@@ -238,14 +246,16 @@ Bit32u MidiStreamParserImpl::parseSysex(const Bit8u stream[], const Bit32u lengt
 		}
 	}
 
-	// Store incomplete SysEx message for further processing
+	// Store incomplete SysEx message for further processing if it fits into the allowed buffer size.
 	streamBufferSize = sysexLength;
 	if (checkStreamBufferCapacity(false)) {
-		memcpy(streamBuffer, stream, sysexLength);
+		// Better be paranoid about buffer overflows.
+		Bit32u bytesToCopy = sysexLength < streamBufferCapacity ? sysexLength : streamBufferCapacity;
+		memcpy(streamBuffer, stream, bytesToCopy);
 	} else {
-		// Not enough buffer capacity, don't care about the real buffer content, just mark the first byte
+		// Not enough buffer capacity. We don't have to care about the real buffer content as the message is going to be discarded.
+		// We just mark the buffer as containing a SysEx, and streamBufferSize already indicates a buffer overrun.
 		*streamBuffer = *stream;
-		streamBufferSize = streamBufferCapacity;
 	}
 	return sysexLength;
 }
diff --git a/audio/softsynth/mt32/MidiStreamParser.h b/audio/softsynth/mt32/MidiStreamParser.h
index 5437ddc392a..d3a76c8a037 100644
--- a/audio/softsynth/mt32/MidiStreamParser.h
+++ b/audio/softsynth/mt32/MidiStreamParser.h
@@ -108,10 +108,10 @@ public:
 	void resetTimestamp();
 
 protected:
-	void handleShortMessage(const Bit32u message) override;
-	void handleSysex(const Bit8u *stream, const Bit32u length) override;
-	void handleSystemRealtimeMessage(const Bit8u realtime) override;
-	void printDebug(const char *debugMessage) override;
+	void handleShortMessage(const Bit32u message);
+	void handleSysex(const Bit8u *stream, const Bit32u length);
+	void handleSystemRealtimeMessage(const Bit8u realtime);
+	void printDebug(const char *debugMessage);
 
 private:
 	Synth &synth;
diff --git a/audio/softsynth/mt32/Part.cpp b/audio/softsynth/mt32/Part.cpp
index 558a15fdda5..56c8f769845 100644
--- a/audio/softsynth/mt32/Part.cpp
+++ b/audio/softsynth/mt32/Part.cpp
@@ -1,5 +1,5 @@
 /* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
- * Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ * Copyright (C) 2011-2025 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
@@ -38,6 +38,10 @@ static const Bit8u PartialMixStruct[13] = {
 	1, 3, 3, 2, 2, 2, 2
 };
 
+const Part *Part::getPart(Synth &synth, Bit8u partNum) {
+	return synth.getPart(partNum);
+}
+
 RhythmPart::RhythmPart(Synth *useSynth, unsigned int usePartNum): Part(useSynth, usePartNum) {
 	strcpy(name, "Rhythm");
 	rhythmTemp = &synth->mt32ram.rhythmTemp[0];
@@ -51,10 +55,18 @@ Part::Part(Synth *useSynth, unsigned int usePartNum) {
 	holdpedal = false;
 	patchTemp = &synth->mt32ram.patchTemp[partNum];
 	if (usePartNum == 8) {
-		// Nasty hack for rhythm
+		// The Rhythm part doesn't have just a single timbre associated.
 		timbreTemp = NULL;
 	} else {
-		snprintf(name, 8, "Part %d", partNum + 1);
+#ifdef MT32EMU_WITH_SNPRINTF
+		snprintf(
+			name, sizeof name,
+#else
+		sprintf(
+			name,
+#endif
+			"Part %d", partNum + 1
+		);
 		timbreTemp = &synth->mt32ram.timbreTemp[partNum];
 	}
 	currentInstr[0] = 0;
@@ -195,12 +207,14 @@ void Part::setPatch(const PatchParam *patch) {
 	patchTemp->patch = *patch;
 }
 
-void RhythmPart::setTimbre(TimbreParam * /*timbre*/) {
-	synth->printDebug("%s: Attempted to call setTimbre() - doesn't make sense for rhythm", name);
+void RhythmPart::resetTimbre() {
+	synth->printDebug("%s: Attempted to call resetTimbre() - doesn't make sense for rhythm", name);
 }
 
-void Part::setTimbre(TimbreParam *timbre) {
-	*timbreTemp = *timbre;
+void Part::resetTimbre() {
+	holdpedal = false;
+	allSoundOff();
+	*timbreTemp = synth->mt32ram.timbres[getAbsTimbreNum()].timbre;
 }
 
 unsigned int RhythmPart::getAbsTimbreNum() const {
@@ -222,9 +236,7 @@ void RhythmPart::setProgram(unsigned int) { }
 
 void Part::setProgram(unsigned int patchNum) {
 	setPatch(&synth->mt32ram.patches[patchNum]);
-	holdpedal = false;
-	allSoundOff();
-	setTimbre(&synth->mt32ram.timbres[getAbsTimbreNum()].timbre);
+	resetTimbre();
 	refresh();
 }
 
@@ -498,9 +510,13 @@ void Part::playPoly(const PatchCache cache[4], const MemParams::RhythmTemp *rhyt
 		synth->printDebug("%s (%s): Insufficient free partials to play key %d (velocity %d); needed=%d, free=%d, assignMode=%d", name, currentInstr, midiKey, velocity, needPartials, synth->partialManager->getFreePartialCount(), patchTemp->patch.assignMode);
 		synth->printPartialUsage();
 #endif
+		synth->getReportHandler3()->onNoteOnIgnored(needPartials, synth->partialManager->getFreePartialCount());
+		return;
+	}
+	if (synth->isAbortingPoly()) {
+		synth->getReportHandler3()->onPlayingPolySilenced(needPartials, synth->partialManager->getFreePartialCount());
 		return;
 	}
-	if (synth->isAbortingPoly()) return;
 
 	Poly *poly = synth->partialManager->assignPolyToPart(this);
 	if (poly == NULL) {
diff --git a/audio/softsynth/mt32/Part.h b/audio/softsynth/mt32/Part.h
index 42bd23ddc23..d585410da4a 100644
--- a/audio/softsynth/mt32/Part.h
+++ b/audio/softsynth/mt32/Part.h
@@ -1,5 +1,5 @@
 /* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
- * Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ * Copyright (C) 2011-2025 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
@@ -86,6 +86,8 @@ protected:
 	const char *getName() const;
 
 public:
+	static const Part *getPart(Synth &synth, Bit8u partNum);
+
 	Part(Synth *synth, unsigned int usePartNum);
 	virtual ~Part();
 	void reset();
@@ -115,7 +117,7 @@ public:
 	void updatePitchBenderRange();
 	virtual void refresh();
 	virtual void refreshTimbre(unsigned int absTimbreNum);
-	virtual void setTimbre(TimbreParam *timbre);
+	virtual void resetTimbre();
 	virtual unsigned int getAbsTimbreNum() const;
 	const char *getCurrentInstr() const;
 	const Poly *getFirstActivePoly() const;
@@ -144,15 +146,15 @@ class RhythmPart: public Part {
 	PatchCache drumCache[85][4];
 public:
 	RhythmPart(Synth *synth, unsigned int usePartNum);
-	void refresh() override;
-	void refreshTimbre(unsigned int timbreNum) override;
-	void setTimbre(TimbreParam *timbre) override;
-	void noteOn(unsigned int key, unsigned int velocity) override;
-	void noteOff(unsigned int midiKey) override;
-	unsigned int getAbsTimbreNum() const override;
-	void setPan(unsigned int midiPan) override;
-	void setProgram(unsigned int patchNum) override;
-	void polyStateChanged(PolyState oldState, PolyState newState) override;
+	void refresh();
+	void refreshTimbre(unsigned int timbreNum);
+	void resetTimbre();
+	void noteOn(unsigned int key, unsigned int velocity);
+	void noteOff(unsigned int midiKey);
+	unsigned int getAbsTimbreNum() const;
+	void setPan(unsigned int midiPan);
+	void setProgram(unsigned int patchNum);
+	void polyStateChanged(PolyState oldState, PolyState newState);
 };
 
 } // namespace MT32Emu
diff --git a/audio/softsynth/mt32/Partial.cpp b/audio/softsynth/mt32/Partial.cpp
index 2a4b21d9f09..5b3fd7ebd0a 100644
--- a/audio/softsynth/mt32/Partial.cpp
+++ b/audio/softsynth/mt32/Partial.cpp
@@ -1,5 +1,5 @@
 /* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
- * Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ * Copyright (C) 2011-2026 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
@@ -34,6 +34,10 @@ namespace MT32Emu {
 static const Bit8u PAN_NUMERATOR_MASTER[] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7};
 static const Bit8u PAN_NUMERATOR_SLAVE[]  = {0, 1, 2, 3, 4, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7};
 
+static const Bit32u MAX_CUTOFF_VALUE = 240 << 18;
+
+static const Bit8u *pulseWidth100To255;
+
 // We assume the pan is applied using the same 13-bit multiplier circuit that is also used for ring modulation
 // because of the observed sample overflow, so the panSetting values are likely mapped in a similar way via a LUT.
 // FIXME: Sample analysis suggests that the use of panSetting is linear, but there are some quirks that still need to be resolved.
@@ -51,9 +55,26 @@ static Bit32s getPanFactor(Bit32s panSetting) {
 	return PAN_FACTORS[panSetting];
 }
 
+static bool initTables() {
+	const Tables &tables = Tables::getInstance();
+	pulseWidth100To255 = tables.pulseWidth100To255;
+	LA32IntPartialPair::initTables(tables);
+	LA32FloatPartialPair::initTables(tables);
+	LA32Ramp::initTables(tables);
+	TVA::initTables(tables);
+	TVF::initTables(tables);
+	return true;
+}
+
+static void ensureTables() {
+	static const bool initialised = initTables();
+	(void)initialised;
+}
+
 Partial::Partial(Synth *useSynth, int usePartialIndex) :
 	synth(useSynth), partialIndex(usePartialIndex), sampleNum(0),
 	floatMode(useSynth->getSelectedRendererType() == RendererType_FLOAT) {
+	ensureTables();
 	// Initialisation of tva, tvp and tvf uses 'this' pointer
 	// and thus should not be in the initializer list to avoid a compiler warning
 	tva = new TVA(this, &ampRamp);
@@ -201,7 +222,7 @@ void Partial::startPartial(const Part *part, Poly *usePoly, const PatchCache *us
 	}
 
 	// CONFIRMED: pulseWidthVal calculation is based on information from Mok
-	pulseWidthVal = (poly->getVelocity() - 64) * (patchCache->srcPartial.wg.pulseWidthVeloSensitivity - 7) + Tables::getInstance().pulseWidth100To255[patchCache->srcPartial.wg.pulseWidth];
+	pulseWidthVal = (poly->getVelocity() - 64) * (patchCache->srcPartial.wg.pulseWidthVeloSensitivity - 7) + pulseWidth100To255[patchCache->srcPartial.wg.pulseWidth];
 	if (pulseWidthVal < 0) {
 		pulseWidthVal = 0;
 	} else if (pulseWidthVal > 255) {
@@ -229,11 +250,24 @@ void Partial::startPartial(const Part *part, Poly *usePoly, const PatchCache *us
 	} else {
 		useLA32Pair->initSynth(pairType, (patchCache->waveform & 1) != 0, pulseWidthVal, patchCache->srcPartial.tvf.resonance + 1);
 	}
+	// Ensure that the first update always fires by setting the sentinels.
+	// The ramp values never exceed MAX_CURRENT. The pitch is clamped down to 59392.
+	currentPitch = Bit16u(currentAmpRampValue = currentCutoffModifier = ~0);
 	if (!hasRingModulatingSlave()) {
 		la32Pair->deactivate(LA32PartialPair::SLAVE);
 	}
 }
 
+bool Partial::updateAmp() {
+	Bit32u nextAmpRampValue = ampRamp.nextValue();
+	if (ampRamp.checkInterrupt()) {
+		tva->handleInterrupt();
+	}
+	if (currentAmpRampValue == nextAmpRampValue) return false;
+	currentAmpRampValue = nextAmpRampValue;
+	return true;
+}
+
 Bit32u Partial::getAmpValue() {
 	// SEMI-CONFIRMED: From sample analysis:
 	// (1) Tested with a single partial playing PCM wave 77 with pitchCoarse 36 and no keyfollow, velocity follow, etc.
@@ -245,22 +279,37 @@ Bit32u Partial::getAmpValue() {
 	//
 	// Also still partially unconfirmed is the behaviour when ramping between levels, as well as the timing.
 	// TODO: The tests above were performed using the float model, to be refined
-	Bit32u ampRampVal = 67117056 - ampRamp.nextValue();
-	if (ampRamp.checkInterrupt()) {
-		tva->handleInterrupt();
-	}
-	return ampRampVal;
+	return 67117056 - currentAmpRampValue;
 }
 
-Bit32u Partial::getCutoffValue() {
-	if (isPCM()) {
-		return 0;
-	}
-	Bit32u cutoffModifierRampVal = cutoffModifierRamp.nextValue();
+bool Partial::updatePitch() {
+	Bit16u nextPitch = tvp->nextPitch();
+	if (currentPitch == nextPitch) return false;
+	currentPitch = nextPitch;
+	return true;
+}
+
+bool Partial::updateCutoff() {
+	if (isPCM()) return false;
+	Bit32u nextCutoffModifier = cutoffModifierRamp.nextValue();
 	if (cutoffModifierRamp.checkInterrupt()) {
 		tvf->handleInterrupt();
 	}
-	return (tvf->getBaseCutoff() << 18) + cutoffModifierRampVal;
+	if (currentCutoffModifier == nextCutoffModifier) return false;
+	currentCutoffModifier = nextCutoffModifier;
+	return true;
+}
+
+Bit32u Partial::getCutoffValue() {
+	if (isPCM()) return 0;
+	Bit32u currentCutoffValue = (tvf->getBaseCutoff() << 18) + currentCutoffModifier;
+
+	// The cutoffModifier may not be supposed to be directly added to the cutoff -
+	// it may for example need to be multiplied in some way.
+	// The 240 cutoffVal limit was determined via sample analysis (internal Munt capture IDs: glop3, glop4).
+	// More research is needed to be sure that this is correct, however.
+	if (currentCutoffValue > MAX_CUTOFF_VALUE) return MAX_CUTOFF_VALUE;
+	return currentCutoffValue;
 }
 
 bool Partial::hasRingModulatingSlave() const {
@@ -318,9 +367,15 @@ bool Partial::generateNextSample(LA32PairImpl *la32PairImpl) {
 		deactivate();
 		return false;
 	}
-	la32PairImpl->generateNextSample(LA32PartialPair::MASTER, getAmpValue(), tvp->nextPitch(), getCutoffValue());
+	if (updateAmp()) la32PairImpl->setAmp(LA32PartialPair::MASTER, getAmpValue());
+	if (updatePitch()) la32PairImpl->setPitch(LA32PartialPair::MASTER, currentPitch);
+	if (updateCutoff()) la32PairImpl->setCutoff(LA32PartialPair::MASTER, getCutoffValue());
+	la32PairImpl->generateNextSample(LA32PartialPair::MASTER);
 	if (hasRingModulatingSlave()) {
-		la32PairImpl->generateNextSample(LA32PartialPair::SLAVE, pair->getAmpValue(), pair->tvp->nextPitch(), pair->getCutoffValue());
+		if (pair->updateAmp()) la32PairImpl->setAmp(LA32PartialPair::SLAVE, pair->getAmpValue());
+		if (pair->updatePitch()) la32PairImpl->setPitch(LA32PartialPair::SLAVE, pair->currentPitch);
+		if (pair->updateCutoff()) la32PairImpl->setCutoff(LA32PartialPair::SLAVE, pair->getCutoffValue());
+		la32PairImpl->generateNextSample(LA32PartialPair::SLAVE);
 		if (!pair->tva->isPlaying() || !la32PairImpl->isActive(LA32PartialPair::SLAVE)) {
 			pair->deactivate();
 			if (mixType == 2) {
diff --git a/audio/softsynth/mt32/Partial.h b/audio/softsynth/mt32/Partial.h
index bfc6f6dcade..dfff86c3020 100644
--- a/audio/softsynth/mt32/Partial.h
+++ b/audio/softsynth/mt32/Partial.h
@@ -1,5 +1,5 @@
 /* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
- * Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ * Copyright (C) 2011-2026 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
@@ -80,16 +80,26 @@ private:
 	const PatchCache *patchCache;
 	PatchCache cachebackup;
 
-	Bit32u getAmpValue();
-	Bit32u getCutoffValue();
+	// We keep these copies to avoid dependent computations until the values change.
+	Bit32u currentAmpRampValue;
+	Bit16u currentPitch;
+	Bit32u currentCutoffModifier;
+
+	// These methods pull new values from TVA, TVP and TVF and return whether they've changed.
+	inline bool updateAmp();
+	inline bool updatePitch();
+	inline bool updateCutoff();
+
+	inline Bit32u getAmpValue();
+	inline Bit32u getCutoffValue();
 
 	template <class Sample, class LA32PairImpl>
-	bool doProduceOutput(Sample *leftBuf, Sample *rightBuf, Bit32u length, LA32PairImpl *la32PairImpl);
-	bool canProduceOutput();
+	inline bool doProduceOutput(Sample *leftBuf, Sample *rightBuf, Bit32u length, LA32PairImpl *la32PairImpl);
+	inline bool canProduceOutput();
 	template <class LA32PairImpl>
-	bool generateNextSample(LA32PairImpl *la32PairImpl);
-	void produceAndMixSample(IntSample *&leftBuf, IntSample *&rightBuf, LA32IntPartialPair *la32IntPair);
-	void produceAndMixSample(FloatSample *&leftBuf, FloatSample *&rightBuf, LA32FloatPartialPair *la32FloatPair);
+	inline bool generateNextSample(LA32PairImpl *la32PairImpl);
+	inline void produceAndMixSample(IntSample *&leftBuf, IntSample *&rightBuf, LA32IntPartialPair *la32IntPair);
+	inline void produceAndMixSample(FloatSample *&leftBuf, FloatSample *&rightBuf, LA32FloatPartialPair *la32FloatPair);
 
 public:
 	bool alreadyOutputed;
diff --git a/audio/softsynth/mt32/PartialManager.cpp b/audio/softsynth/mt32/PartialManager.cpp
index 609adaa74ef..409e80618d9 100644
--- a/audio/softsynth/mt32/PartialManager.cpp
+++ b/audio/softsynth/mt32/PartialManager.cpp
@@ -1,5 +1,5 @@
 /* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
- * Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ * Copyright (C) 2011-2026 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
@@ -28,9 +28,13 @@
 
 namespace MT32Emu {
 
-PartialManager::PartialManager(Synth *useSynth, Part **useParts) {
+PartialManager *PartialManager::getPartialManager(Synth &synth) {
+	return synth.partialManager;
+}
+
+PartialManager::PartialManager(Synth *useSynth) {
 	synth = useSynth;
-	parts = useParts;
+	parts = useSynth->parts;
 	inactivePartialCount = synth->getPartialCount();
 	partialTable = new Partial *[inactivePartialCount];
 	inactivePartials = new int[inactivePartialCount];
@@ -114,6 +118,10 @@ void PartialManager::getPerPartPartialUsage(unsigned int perPartPartialUsage[9])
 	}
 }
 
+const Poly *PartialManager::getAbortingPoly() {
+	return synth->abortingPoly;
+}
+
 // Finds the lowest-priority part that is exceeding its reserved partial allocation and has a poly
 // in POLY_Releasing, then kills its first releasing poly.
 // Parts with higher priority than minPart are not checked.
@@ -158,7 +166,71 @@ bool PartialManager::abortFirstPolyPreferHeldWhereReserveExceeded(int minPart) {
 	return false;
 }
 
+bool PartialManager::abortFirstPolyPreferReleasingThenHeldWhereReserveExceeded(int minPartNum) {
+	for (int candidatePartNum = 7; candidatePartNum >= minPartNum; candidatePartNum--) {
+		if (parts[candidatePartNum]->getActivePartialCount() > numReservedPartialsForPart[candidatePartNum]) {
+			return abortFirstPolyOnPartPreferReleasingThenHeld(candidatePartNum);
+		}
+	}
+	return false;
+}
+
+bool PartialManager::abortFirstPolyOnPartPreferReleasingThenHeld(int partNum) {
+	if (parts[partNum]->abortFirstPoly(POLY_Releasing)) {
+		return true;
+	}
+	return parts[partNum]->abortFirstPolyPreferHeld();
+}
+
 bool PartialManager::freePartials(unsigned int needed, int partNum) {
+	// NOTE: Currently, we don't consider peculiarities of partial allocation when a timbre involves structures with ring modulation.
+
+	if (synth->controlROMFeatures->newGenNoteCancellation) {
+		return freePartialsNewGen(needed, partNum);
+	}
+
+	while (!synth->isAbortingPoly() && getFreePartialCount() < needed) {
+		if (parts[partNum]->getActiveNonReleasingPartialCount() + needed > numReservedPartialsForPart[partNum]) {
+			// If priority is given to earlier polys, there's nothing we can do.
+			if (synth->getPart(partNum)->getPatchTemp()->patch.assignMode & 1) return false;
+
+			if (needed <= numReservedPartialsForPart[partNum]) {
+				// No more partials needed than reserved for this part, only attempt to free partials on the same part.
+				abortFirstPolyOnPartPreferReleasingThenHeld(partNum);
+				continue;
+			}
+
+			// More partials desired than reserved, try to borrow some from parts with lesser priority.
+			// NOTE: there's a bug here in the old-gen program, so that the device exhibits undefined behaviour when trying to play
+			// a note on the rhythm part beyond the reserve while none of the voice parts has exceeded their reserve.
+			// We don't emulate this here, assuming that the intention was to traverse all voice parts, then check the rhythm part.
+			if (abortFirstPolyPreferReleasingThenHeldWhereReserveExceeded(partNum < 8 ? partNum : 0)) continue;
+
+			// At this point, old-gen devices try to borrow partials from the rhythm part if it's exceeding the reservation.
+			if (parts[8]->getActivePartialCount() > numReservedPartialsForPart[8]
+				&& abortFirstPolyOnPartPreferReleasingThenHeld(8)) continue;
+
+			// Alas, this one will be muted.
+			return false;
+		}
+
+		// OK, we're not going to exceed the reserve. Reclaim our partials from other parts starting from 7 to 0.
+		if (abortFirstPolyPreferReleasingThenHeldWhereReserveExceeded(0)) continue;
+
+		// Now try the rhythm part.
+		if (parts[8]->getActivePartialCount() > numReservedPartialsForPart[8]
+			&& abortFirstPolyOnPartPreferReleasingThenHeld(8)) continue;
+
+		// Lastly, try to silence a poly on this part.
+		if (abortFirstPolyOnPartPreferReleasingThenHeld(partNum)) continue;
+
+		// Fair enough, there's no room for it.
+		return false;
+	}
+	return true;
+}
+
+bool PartialManager::freePartialsNewGen(unsigned int needed, int partNum) {
 	// CONFIRMED: Barring bugs, this matches the real LAPC-I according to information from Mok.
 
 	// BUG: There's a bug in the LAPC-I implementation:
@@ -176,32 +248,15 @@ bool PartialManager::freePartials(unsigned int needed, int partNum) {
 		return true;
 	}
 
-	// Note that calling getFreePartialCount() also ensures that numReservedPartialsPerPart is up-to-date
 	if (getFreePartialCount() >= needed) {
 		return true;
 	}
 
-	// Note: These #ifdefs are temporary until we have proper "quirk" configuration.
-	// Also, the MT-32 version isn't properly confirmed yet.
-#ifdef MT32EMU_QUIRK_FREE_PARTIALS_MT32
-	// On MT-32, we bail out before even killing releasing partials if the allocating part has exceeded its reserve and is configured for priority-to-earlier-polys.
-	if (parts[partNum]->getActiveNonReleasingPartialCount() + needed > numReservedPartialsForPart[partNum] && (synth->getPart(partNum)->getPatchTemp()->patch.assignMode & 1)) {
-		return false;
-	}
-#endif
-
 	for (;;) {
-#ifdef MT32EMU_QUIRK_FREE_PARTIALS_MT32
-		// Abort releasing polys in parts that have exceeded their partial reservation (working backwards from part 7, with rhythm last)
-		if (!abortFirstReleasingPolyWhereReserveExceeded(-1)) {
-			break;
-		}
-#else
 		// Abort releasing polys in non-rhythm parts that have exceeded their partial reservation (working backwards from part 7)
 		if (!abortFirstReleasingPolyWhereReserveExceeded(0)) {
 			break;
 		}
-#endif
 		if (synth->isAbortingPoly() || getFreePartialCount() >= needed) {
 			return true;
 		}
@@ -229,7 +284,7 @@ bool PartialManager::freePartials(unsigned int needed, int partNum) {
 	} else {
 		// At this point, we're certain that we've reserved enough partials to play our poly.
 		// Check all parts from lowest to highest priority to see whether they've exceeded their
-		// reserve, and abort their polys until until we have enough free partials or they're within
+		// reserve, and abort their polys until we have enough free partials or they're within
 		// their reserve allocation.
 		for (;;) {
 			if (!abortFirstPolyPreferHeldWhereReserveExceeded(-1)) {
diff --git a/audio/softsynth/mt32/PartialManager.h b/audio/softsynth/mt32/PartialManager.h
index 5c019effe02..2e875f29ec8 100644
--- a/audio/softsynth/mt32/PartialManager.h
+++ b/audio/softsynth/mt32/PartialManager.h
@@ -1,5 +1,5 @@
 /* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
- * Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ * Copyright (C) 2011-2026 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
@@ -42,13 +42,19 @@ private:
 
 	bool abortFirstReleasingPolyWhereReserveExceeded(int minPart);
 	bool abortFirstPolyPreferHeldWhereReserveExceeded(int minPart);
+	bool abortFirstPolyPreferReleasingThenHeldWhereReserveExceeded(int minPart);
+	bool abortFirstPolyOnPartPreferReleasingThenHeld(int partNum);
+	bool freePartialsNewGen(unsigned int needed, int partNum);
 
 public:
-	PartialManager(Synth *synth, Part **parts);
+	static PartialManager *getPartialManager(Synth &synth);
+
+	PartialManager(Synth *useSynth);
 	~PartialManager();
 	Partial *allocPartial(int partNum);
 	unsigned int getFreePartialCount();
 	void getPerPartPartialUsage(unsigned int perPartPartialUsage[9]);
+	const Poly *getAbortingPoly();
 	bool freePartials(unsigned int needed, int partNum);
 	unsigned int setReserve(Bit8u *rset);
 	void deactivateAll();
diff --git a/audio/softsynth/mt32/ROMInfo.cpp b/audio/softsynth/mt32/ROMInfo.cpp
index 0f58cd292cb..7f89ad1d44e 100644
--- a/audio/softsynth/mt32/ROMInfo.cpp
+++ b/audio/softsynth/mt32/ROMInfo.cpp
@@ -1,5 +1,5 @@
 /* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
- * Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ * Copyright (C) 2011-2024 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
@@ -51,40 +51,70 @@ struct ROMInfoLists {
 
 }
 
-#define _CALC_ARRAY_LENGTH(x) Bit32u(sizeof (x) / sizeof *(x) - 1)
+#define MT32EMU_CALC_ARRAY_LENGTH(x) Bit32u(sizeof (x) / sizeof *(x) - 1)
 
 static const ROMInfoLists &getROMInfoLists() {
-	static ROMInfo CTRL_MT32_V1_04_A = {32768, "9cd4858014c4e8a9dff96053f784bfaac1092a2e", ROMInfo::Control, "ctrl_mt32_1_04_a", "MT-32 Control v1.04", ROMInfo::Mux0, NULL};
-	static ROMInfo CTRL_MT32_V1_04_B = {32768, "fe8db469b5bfeb37edb269fd47e3ce6d91014652", ROMInfo::Control, "ctrl_mt32_1_04_b", "MT-32 Control v1.04", ROMInfo::Mux1, &CTRL_MT32_V1_04_A};
-	static ROMInfo CTRL_MT32_V1_04 = {65536, "5a5cb5a77d7d55ee69657c2f870416daed52dea7", ROMInfo::Control, "ctrl_mt32_1_04", "MT-32 Control v1.04", ROMInfo::Full, NULL};
-	static ROMInfo CTRL_MT32_V1_05_A = {32768, "57a09d80d2f7ca5b9734edbe9645e6e700f83701", ROMInfo::Control, "ctrl_mt32_1_05_a", "MT-32 Control v1.05", ROMInfo::Mux0, NULL};
-	static ROMInfo CTRL_MT32_V1_05_B = {32768, "52e3c6666db9ef962591a8ee99be0cde17f3a6b6", ROMInfo::Control, "ctrl_mt32_1_05_b", "MT-32 Control v1.05", ROMInfo::Mux1, &CTRL_MT32_V1_05_A};
-	static ROMInfo CTRL_MT32_V1_05 = {65536, "e17a3a6d265bf1fa150312061134293d2b58288c", ROMInfo::Control, "ctrl_mt32_1_05", "MT-32 Control v1.05", ROMInfo::Full, NULL};
-	static ROMInfo CTRL_MT32_V1_06_A = {32768, "cc83bf23cee533097fb4c7e2c116e43b50ebacc8", ROMInfo::Control, "ctrl_mt32_1_06_a", "MT-32 Control v1.06", ROMInfo::Mux0, NULL};
-	static ROMInfo CTRL_MT32_V1_06_B = {32768, "bf4f15666bc46679579498386704893b630c1171", ROMInfo::Control, "ctrl_mt32_1_06_b", "MT-32 Control v1.06", ROMInfo::Mux1, &CTRL_MT32_V1_06_A};
-	static ROMInfo CTRL_MT32_V1_06 = {65536, "a553481f4e2794c10cfe597fef154eef0d8257de", ROMInfo::Control, "ctrl_mt32_1_06", "MT-32 Control v1.06", ROMInfo::Full, NULL};
-	static ROMInfo CTRL_MT32_V1_07_A = {32768, "13f06b38f0d9e0fc050b6503ab777bb938603260", ROMInfo::Control, "ctrl_mt32_1_07_a", "MT-32 Control v1.07", ROMInfo::Mux0, NULL};
-	static ROMInfo CTRL_MT32_V1_07_B = {32768, "c55e165487d71fa88bd8c5e9c083bc456c1a89aa", ROMInfo::Control, "ctrl_mt32_1_07_b", "MT-32 Control v1.07", ROMInfo::Mux1, &CTRL_MT32_V1_07_A};
-	static ROMInfo CTRL_MT32_V1_07 = {65536, "b083518fffb7f66b03c23b7eb4f868e62dc5a987", ROMInfo::Control, "ctrl_mt32_1_07", "MT-32 Control v1.07", ROMInfo::Full, NULL};
-	static ROMInfo CTRL_MT32_BLUER_A = {32768, "11a6ae5d8b6ee328b371af7f1e40b82125aa6b4d", ROMInfo::Control, "ctrl_mt32_bluer_a", "MT-32 Control BlueRidge", ROMInfo::Mux0, NULL};
-	static ROMInfo CTRL_MT32_BLUER_B = {32768, "e0934320d7cbb5edfaa29e0d01ae835ef620085b", ROMInfo::Control, "ctrl_mt32_bluer_b", "MT-32 Control BlueRidge", ROMInfo::Mux1, &CTRL_MT32_BLUER_A};
-	static ROMInfo CTRL_MT32_BLUER = {65536, "7b8c2a5ddb42fd0732e2f22b3340dcf5360edf92", ROMInfo::Control, "ctrl_mt32_bluer", "MT-32 Control BlueRidge", ROMInfo::Full, NULL};
-
-	static const ROMInfo CTRL_MT32_V2_03 = {131072, "5837064c9df4741a55f7c4d8787ac158dff2d3ce", ROMInfo::Control, "ctrl_mt32_2_03", "MT-32 Control v2.03", ROMInfo::Full, NULL};
-	static const ROMInfo CTRL_MT32_V2_04 = {131072, "2c16432b6c73dd2a3947cba950a0f4c19d6180eb", ROMInfo::Control, "ctrl_mt32_2_04", "MT-32 Control v2.04", ROMInfo::Full, NULL};
-	static const ROMInfo CTRL_MT32_V2_06 = {131072, "2869cf4c235d671668cfcb62415e2ce8323ad4ed", ROMInfo::Control, "ctrl_mt32_2_06", "MT-32 Control v2.06", ROMInfo::Full, NULL};
-	static const ROMInfo CTRL_MT32_V2_07 = {131072, "47b52adefedaec475c925e54340e37673c11707c", ROMInfo::Control, "ctrl_mt32_2_07", "MT-32 Control v2.07", ROMInfo::Full, NULL};
-	static const ROMInfo CTRL_CM32L_V1_00 = {65536, "73683d585cd6948cc19547942ca0e14a0319456d", ROMInfo::Control, "ctrl_cm32l_1_00", "CM-32L/LAPC-I Control v1.00", ROMInfo::Full, NULL};
-	static const ROMInfo CTRL_CM32L_V1_02 = {65536, "a439fbb390da38cada95a7cbb1d6ca199cd66ef8", ROMInfo::Control, "ctrl_cm32l_1_02", "CM-32L/LAPC-I Control v1.02", ROMInfo::Full, NULL};
-	static const ROMInfo CTRL_CM32LN_V1_00 = {65536, "dc1c5b1b90a4646d00f7daf3679733c7badc7077", ROMInfo::Control, "ctrl_cm32ln_1_00", "CM-32LN/CM-500/LAPC-N Control v1.00", ROMInfo::Full, NULL};
-
-	static ROMInfo PCM_MT32_L = {262144, "3a1e19b0cd4036623fd1d1d11f5f25995585962b", ROMInfo::PCM, "pcm_mt32_l", "MT-32 PCM ROM", ROMInfo::FirstHalf, NULL};
-	static ROMInfo PCM_MT32_H = {262144, "2cadb99d21a6a4a6f5b61b6218d16e9b43f61d01", ROMInfo::PCM, "pcm_mt32_h", "MT-32 PCM ROM", ROMInfo::SecondHalf, &PCM_MT32_L};
-	static ROMInfo PCM_MT32 = {524288, "f6b1eebc4b2d200ec6d3d21d51325d5b48c60252", ROMInfo::PCM, "pcm_mt32", "MT-32 PCM ROM", ROMInfo::Full, NULL};
+	static const File::SHA1Digest CTRL_MT32_V1_04_A_SHA1 = "9cd4858014c4e8a9dff96053f784bfaac1092a2e";
+	static const File::SHA1Digest CTRL_MT32_V1_04_B_SHA1 = "fe8db469b5bfeb37edb269fd47e3ce6d91014652";
+	static const File::SHA1Digest CTRL_MT32_V1_04_SHA1 = "5a5cb5a77d7d55ee69657c2f870416daed52dea7";
+	static const File::SHA1Digest CTRL_MT32_V1_05_A_SHA1 = "57a09d80d2f7ca5b9734edbe9645e6e700f83701";
+	static const File::SHA1Digest CTRL_MT32_V1_05_B_SHA1 = "52e3c6666db9ef962591a8ee99be0cde17f3a6b6";
+	static const File::SHA1Digest CTRL_MT32_V1_05_SHA1 = "e17a3a6d265bf1fa150312061134293d2b58288c";
+	static const File::SHA1Digest CTRL_MT32_V1_06_A_SHA1 = "cc83bf23cee533097fb4c7e2c116e43b50ebacc8";
+	static const File::SHA1Digest CTRL_MT32_V1_06_B_SHA1 = "bf4f15666bc46679579498386704893b630c1171";
+	static const File::SHA1Digest CTRL_MT32_V1_06_SHA1 = "a553481f4e2794c10cfe597fef154eef0d8257de";
+	static const File::SHA1Digest CTRL_MT32_V1_07_A_SHA1 = "13f06b38f0d9e0fc050b6503ab777bb938603260";
+	static const File::SHA1Digest CTRL_MT32_V1_07_B_SHA1 = "c55e165487d71fa88bd8c5e9c083bc456c1a89aa";
+	static const File::SHA1Digest CTRL_MT32_V1_07_SHA1 = "b083518fffb7f66b03c23b7eb4f868e62dc5a987";
+	static const File::SHA1Digest CTRL_MT32_BLUER_A_SHA1 = "11a6ae5d8b6ee328b371af7f1e40b82125aa6b4d";
+	static const File::SHA1Digest CTRL_MT32_BLUER_B_SHA1 = "e0934320d7cbb5edfaa29e0d01ae835ef620085b";
+	static const File::SHA1Digest CTRL_MT32_BLUER_SHA1 = "7b8c2a5ddb42fd0732e2f22b3340dcf5360edf92";
+
+	static const File::SHA1Digest CTRL_MT32_V2_03_SHA1 = "5837064c9df4741a55f7c4d8787ac158dff2d3ce";
+	static const File::SHA1Digest CTRL_MT32_V2_04_SHA1 = "2c16432b6c73dd2a3947cba950a0f4c19d6180eb";
+	static const File::SHA1Digest CTRL_MT32_V2_06_SHA1 = "2869cf4c235d671668cfcb62415e2ce8323ad4ed";
+	static const File::SHA1Digest CTRL_MT32_V2_07_SHA1 = "47b52adefedaec475c925e54340e37673c11707c";
+	static const File::SHA1Digest CTRL_CM32L_V1_00_SHA1 = "73683d585cd6948cc19547942ca0e14a0319456d";
+	static const File::SHA1Digest CTRL_CM32L_V1_02_SHA1 = "a439fbb390da38cada95a7cbb1d6ca199cd66ef8";
+	static const File::SHA1Digest CTRL_CM32LN_V1_00_SHA1 = "dc1c5b1b90a4646d00f7daf3679733c7badc7077";
+
+	static const File::SHA1Digest PCM_MT32_L_SHA1 = "3a1e19b0cd4036623fd1d1d11f5f25995585962b";
+	static const File::SHA1Digest PCM_MT32_H_SHA1 = "2cadb99d21a6a4a6f5b61b6218d16e9b43f61d01";
+	static const File::SHA1Digest PCM_MT32_SHA1 = "f6b1eebc4b2d200ec6d3d21d51325d5b48c60252";
+	static const File::SHA1Digest PCM_CM32L_H_SHA1 = "3ad889fde5db5b6437cbc2eb6e305312fec3df93";
+	static const File::SHA1Digest PCM_CM32L_SHA1 = "289cc298ad532b702461bfc738009d9ebe8025ea";
+
+	static ROMInfo CTRL_MT32_V1_04_A = {32768, CTRL_MT32_V1_04_A_SHA1, ROMInfo::Control, "ctrl_mt32_1_04_a", "MT-32 Control v1.04", ROMInfo::Mux0, NULL};
+	static ROMInfo CTRL_MT32_V1_04_B = {32768, CTRL_MT32_V1_04_B_SHA1, ROMInfo::Control, "ctrl_mt32_1_04_b", "MT-32 Control v1.04", ROMInfo::Mux1, &CTRL_MT32_V1_04_A};
+	static ROMInfo CTRL_MT32_V1_04 = {65536, CTRL_MT32_V1_04_SHA1, ROMInfo::Control, "ctrl_mt32_1_04", "MT-32 Control v1.04", ROMInfo::Full, NULL};
+	static ROMInfo CTRL_MT32_V1_05_A = {32768, CTRL_MT32_V1_05_A_SHA1, ROMInfo::Control, "ctrl_mt32_1_05_a", "MT-32 Control v1.05", ROMInfo::Mux0, NULL};
+	static ROMInfo CTRL_MT32_V1_05_B = {32768, CTRL_MT32_V1_05_B_SHA1, ROMInfo::Control, "ctrl_mt32_1_05_b", "MT-32 Control v1.05", ROMInfo::Mux1, &CTRL_MT32_V1_05_A};
+	static ROMInfo CTRL_MT32_V1_05 = {65536, CTRL_MT32_V1_05_SHA1, ROMInfo::Control, "ctrl_mt32_1_05", "MT-32 Control v1.05", ROMInfo::Full, NULL};
+	static ROMInfo CTRL_MT32_V1_06_A = {32768, CTRL_MT32_V1_06_A_SHA1, ROMInfo::Control, "ctrl_mt32_1_06_a", "MT-32 Control v1.06", ROMInfo::Mux0, NULL};
+	static ROMInfo CTRL_MT32_V1_06_B = {32768, CTRL_MT32_V1_06_B_SHA1, ROMInfo::Control, "ctrl_mt32_1_06_b", "MT-32 Control v1.06", ROMInfo::Mux1, &CTRL_MT32_V1_06_A};
+	static ROMInfo CTRL_MT32_V1_06 = {65536, CTRL_MT32_V1_06_SHA1, ROMInfo::Control, "ctrl_mt32_1_06", "MT-32 Control v1.06", ROMInfo::Full, NULL};
+	static ROMInfo CTRL_MT32_V1_07_A = {32768, CTRL_MT32_V1_07_A_SHA1, ROMInfo::Control, "ctrl_mt32_1_07_a", "MT-32 Control v1.07", ROMInfo::Mux0, NULL};
+	static ROMInfo CTRL_MT32_V1_07_B = {32768, CTRL_MT32_V1_07_B_SHA1, ROMInfo::Control, "ctrl_mt32_1_07_b", "MT-32 Control v1.07", ROMInfo::Mux1, &CTRL_MT32_V1_07_A};
+	static ROMInfo CTRL_MT32_V1_07 = {65536, CTRL_MT32_V1_07_SHA1, ROMInfo::Control, "ctrl_mt32_1_07", "MT-32 Control v1.07", ROMInfo::Full, NULL};
+	static ROMInfo CTRL_MT32_BLUER_A = {32768, CTRL_MT32_BLUER_A_SHA1, ROMInfo::Control, "ctrl_mt32_bluer_a", "MT-32 Control BlueRidge", ROMInfo::Mux0, NULL};
+	static ROMInfo CTRL_MT32_BLUER_B = {32768, CTRL_MT32_BLUER_B_SHA1, ROMInfo::Control, "ctrl_mt32_bluer_b", "MT-32 Control BlueRidge", ROMInfo::Mux1, &CTRL_MT32_BLUER_A};
+	static ROMInfo CTRL_MT32_BLUER = {65536, CTRL_MT32_BLUER_SHA1, ROMInfo::Control, "ctrl_mt32_bluer", "MT-32 Control BlueRidge", ROMInfo::Full, NULL};
+
+	static const ROMInfo CTRL_MT32_V2_03 = {131072, CTRL_MT32_V2_03_SHA1, ROMInfo::Control, "ctrl_mt32_2_03", "MT-32 Control v2.03", ROMInfo::Full, NULL};
+	static const ROMInfo CTRL_MT32_V2_04 = {131072, CTRL_MT32_V2_04_SHA1, ROMInfo::Control, "ctrl_mt32_2_04", "MT-32 Control v2.04", ROMInfo::Full, NULL};
+	static const ROMInfo CTRL_MT32_V2_06 = {131072, CTRL_MT32_V2_06_SHA1, ROMInfo::Control, "ctrl_mt32_2_06", "MT-32 Control v2.06", ROMInfo::Full, NULL};
+	static const ROMInfo CTRL_MT32_V2_07 = {131072, CTRL_MT32_V2_07_SHA1, ROMInfo::Control, "ctrl_mt32_2_07", "MT-32 Control v2.07", ROMInfo::Full, NULL};
+	static const ROMInfo CTRL_CM32L_V1_00 = {65536, CTRL_CM32L_V1_00_SHA1, ROMInfo::Control, "ctrl_cm32l_1_00", "CM-32L/LAPC-I Control v1.00", ROMInfo::Full, NULL};
+	static const ROMInfo CTRL_CM32L_V1_02 = {65536, CTRL_CM32L_V1_02_SHA1, ROMInfo::Control, "ctrl_cm32l_1_02", "CM-32L/LAPC-I Control v1.02", ROMInfo::Full, NULL};
+	static const ROMInfo CTRL_CM32LN_V1_00 = {65536, CTRL_CM32LN_V1_00_SHA1, ROMInfo::Control, "ctrl_cm32ln_1_00", "CM-32LN/CM-500/LAPC-N Control v1.00", ROMInfo::Full, NULL};
+
+	static ROMInfo PCM_MT32_L = {262144, PCM_MT32_L_SHA1, ROMInfo::PCM, "pcm_mt32_l", "MT-32 PCM ROM", ROMInfo::FirstHalf, NULL};
+	static ROMInfo PCM_MT32_H = {262144, PCM_MT32_H_SHA1, ROMInfo::PCM, "pcm_mt32_h", "MT-32 PCM ROM", ROMInfo::SecondHalf, &PCM_MT32_L};
+	static ROMInfo PCM_MT32 = {524288, PCM_MT32_SHA1, ROMInfo::PCM, "pcm_mt32", "MT-32 PCM ROM", ROMInfo::Full, NULL};
 	// Alias of PCM_MT32 ROM, only useful for pairing with PCM_CM32L_H.
-	static ROMInfo PCM_CM32L_L = {524288, "f6b1eebc4b2d200ec6d3d21d51325d5b48c60252", ROMInfo::PCM, "pcm_cm32l_l", "CM-32L/CM-64/LAPC-I PCM ROM", ROMInfo::FirstHalf, NULL};
-	static ROMInfo PCM_CM32L_H = {524288, "3ad889fde5db5b6437cbc2eb6e305312fec3df93", ROMInfo::PCM, "pcm_cm32l_h", "CM-32L/CM-64/LAPC-I PCM ROM", ROMInfo::SecondHalf, &PCM_CM32L_L};
-	static ROMInfo PCM_CM32L = {1048576, "289cc298ad532b702461bfc738009d9ebe8025ea", ROMInfo::PCM, "pcm_cm32l", "CM-32L/CM-64/LAPC-I PCM ROM", ROMInfo::Full, NULL};
+	static ROMInfo PCM_CM32L_L = {524288, PCM_MT32_SHA1, ROMInfo::PCM, "pcm_cm32l_l", "CM-32L/CM-64/LAPC-I PCM ROM", ROMInfo::FirstHalf, NULL};
+	static ROMInfo PCM_CM32L_H = {524288, PCM_CM32L_H_SHA1, ROMInfo::PCM, "pcm_cm32l_h", "CM-32L/CM-64/LAPC-I PCM ROM", ROMInfo::SecondHalf, &PCM_CM32L_L};
+	static ROMInfo PCM_CM32L = {1048576, PCM_CM32L_SHA1, ROMInfo::PCM, "pcm_cm32l", "CM-32L/CM-64/LAPC-I PCM ROM", ROMInfo::Full, NULL};
 
 	static const ROMInfo * const FULL_ROM_INFOS[] = {
 		&CTRL_MT32_V1_04,
@@ -113,7 +143,7 @@ static const ROMInfoLists &getROMInfoLists() {
 		&PCM_CM32L_L, &PCM_CM32L_H,
 		NULL
 	};
-	static const ROMInfo *ALL_ROM_INFOS[_CALC_ARRAY_LENGTH(FULL_ROM_INFOS) + _CALC_ARRAY_LENGTH(PARTIAL_ROM_INFOS) + 1];
+	static const ROMInfo *ALL_ROM_INFOS[MT32EMU_CALC_ARRAY_LENGTH(FULL_ROM_INFOS) + MT32EMU_CALC_ARRAY_LENGTH(PARTIAL_ROM_INFOS) + 1];
 
 	if (CTRL_MT32_V1_04_A.pairROMInfo == NULL) {
 		CTRL_MT32_V1_04_A.pairROMInfo = &CTRL_MT32_V1_04_B;
@@ -125,7 +155,7 @@ static const ROMInfoLists &getROMInfoLists() {
 		PCM_CM32L_L.pairROMInfo = &PCM_CM32L_H;
 
 		memcpy(&ALL_ROM_INFOS[0], FULL_ROM_INFOS, sizeof FULL_ROM_INFOS);
-		memcpy(&ALL_ROM_INFOS[_CALC_ARRAY_LENGTH(FULL_ROM_INFOS)], PARTIAL_ROM_INFOS, sizeof PARTIAL_ROM_INFOS); // Includes NULL terminator.
+		memcpy(&ALL_ROM_INFOS[MT32EMU_CALC_ARRAY_LENGTH(FULL_ROM_INFOS)], PARTIAL_ROM_INFOS, sizeof PARTIAL_ROM_INFOS); // Includes NULL terminator.
 	}
 
 	static const ROMInfo * const MT32_V1_04_ROMS[] = {&CTRL_MT32_V1_04, &PCM_MT32, &CTRL_MT32_V1_04_A, &CTRL_MT32_V1_04_B, &PCM_MT32_L, &PCM_MT32_H, NULL};
@@ -142,21 +172,21 @@ static const ROMInfoLists &getROMInfoLists() {
 	static const ROMInfo * const CM32LN_V1_00_ROMS[] = {&CTRL_CM32LN_V1_00, &PCM_CM32L, NULL};
 
 	static const ROMInfoLists romInfoLists = {
-		{MT32_V1_04_ROMS, _CALC_ARRAY_LENGTH(MT32_V1_04_ROMS)},
-		{MT32_V1_05_ROMS, _CALC_ARRAY_LENGTH(MT32_V1_05_ROMS)},
-		{MT32_V1_06_ROMS, _CALC_ARRAY_LENGTH(MT32_V1_06_ROMS)},
-		{MT32_V1_07_ROMS, _CALC_ARRAY_LENGTH(MT32_V1_07_ROMS)},
-		{MT32_BLUER_ROMS, _CALC_ARRAY_LENGTH(MT32_BLUER_ROMS)},
-		{MT32_V2_03_ROMS, _CALC_ARRAY_LENGTH(MT32_V2_03_ROMS)},
-		{MT32_V2_04_ROMS, _CALC_ARRAY_LENGTH(MT32_V2_04_ROMS)},
-		{MT32_V2_06_ROMS, _CALC_ARRAY_LENGTH(MT32_V2_06_ROMS)},
-		{MT32_V2_07_ROMS, _CALC_ARRAY_LENGTH(MT32_V2_07_ROMS)},
-		{CM32L_V1_00_ROMS, _CALC_ARRAY_LENGTH(CM32L_V1_00_ROMS)},
-		{CM32L_V1_02_ROMS, _CALC_ARRAY_LENGTH(CM32L_V1_02_ROMS)},
-		{CM32LN_V1_00_ROMS, _CALC_ARRAY_LENGTH(CM32LN_V1_00_ROMS)},
-		{FULL_ROM_INFOS, _CALC_ARRAY_LENGTH(FULL_ROM_INFOS)},
-		{PARTIAL_ROM_INFOS, _CALC_ARRAY_LENGTH(PARTIAL_ROM_INFOS)},
-		{ALL_ROM_INFOS, _CALC_ARRAY_LENGTH(ALL_ROM_INFOS)}
+		{MT32_V1_04_ROMS, MT32EMU_CALC_ARRAY_LENGTH(MT32_V1_04_ROMS)},
+		{MT32_V1_05_ROMS, MT32EMU_CALC_ARRAY_LENGTH(MT32_V1_05_ROMS)},
+		{MT32_V1_06_ROMS, MT32EMU_CALC_ARRAY_LENGTH(MT32_V1_06_ROMS)},
+		{MT32_V1_07_ROMS, MT32EMU_CALC_ARRAY_LENGTH(MT32_V1_07_ROMS)},
+		{MT32_BLUER_ROMS, MT32EMU_CALC_ARRAY_LENGTH(MT32_BLUER_ROMS)},
+		{MT32_V2_03_ROMS, MT32EMU_CALC_ARRAY_LENGTH(MT32_V2_03_ROMS)},
+		{MT32_V2_04_ROMS, MT32EMU_CALC_ARRAY_LENGTH(MT32_V2_04_ROMS)},
+		{MT32_V2_06_ROMS, MT32EMU_CALC_ARRAY_LENGTH(MT32_V2_06_ROMS)},
+		{MT32_V2_07_ROMS, MT32EMU_CALC_ARRAY_LENGTH(MT32_V2_07_ROMS)},
+		{CM32L_V1_00_ROMS, MT32EMU_CALC_ARRAY_LENGTH(CM32L_V1_00_ROMS)},
+		{CM32L_V1_02_ROMS, MT32EMU_CALC_ARRAY_LENGTH(CM32L_V1_02_ROMS)},
+		{CM32LN_V1_00_ROMS, MT32EMU_CALC_ARRAY_LENGTH(CM32LN_V1_00_ROMS)},
+		{FULL_ROM_INFOS, MT32EMU_CALC_ARRAY_LENGTH(FULL_ROM_INFOS)},
+		{PARTIAL_ROM_INFOS, MT32EMU_CALC_ARRAY_LENGTH(PARTIAL_ROM_INFOS)},
+		{ALL_ROM_INFOS, MT32EMU_CALC_ARRAY_LENGTH(ALL_ROM_INFOS)}
 	};
 	return romInfoLists;
 }
@@ -221,41 +251,27 @@ const ROMInfo * const *ROMInfo::getPartialROMInfos(Bit32u *itemCount) {
 	return getROMInfoLists().partialROMInfos.romInfos;
 }
 
-const ROMImage *ROMImage::makeFullROMImage(Bit8u *data, size_t dataSize) {
-	return new ROMImage(new ArrayFile(data, dataSize), true, getKnownROMInfoList());
-}
-
-const ROMImage *ROMImage::appendImages(const ROMImage *romImageLow, const ROMImage *romImageHigh) {
-	const Bit8u *romDataLow = romImageLow->getFile()->getData();
-	const Bit8u *romDataHigh = romImageHigh->getFile()->getData();
-	size_t partSize = romImageLow->getFile()->getSize();
+static File *appendROMFiles(File *romFileLow, File *romFileHigh) {
+	const Bit8u *romDataLow = romFileLow->getData();
+	const Bit8u *romDataHigh = romFileHigh->getData();
+	size_t partSize = romFileLow->getSize();
 	Bit8u *data = new Bit8u[2 * partSize];
 	memcpy(data, romDataLow, partSize);
 	memcpy(data + partSize, romDataHigh, partSize);
-	const ROMImage *romImageFull = makeFullROMImage(data, 2 * partSize);
-	if (romImageFull->getROMInfo() == NULL) {
-		freeROMImage(romImageFull);
-		return NULL;
-	}
-	return romImageFull;
+	return new ArrayFile(data, 2 * partSize);
 }
 
-const ROMImage *ROMImage::interleaveImages(const ROMImage *romImageEven, const ROMImage *romImageOdd) {
-	const Bit8u *romDataEven = romImageEven->getFile()->getData();
-	const Bit8u *romDataOdd = romImageOdd->getFile()->getData();
-	size_t partSize = romImageEven->getFile()->getSize();
+static File *interleaveROMFiles(File *romFileEven, File *romFileOdd) {
+	const Bit8u *romDataEven = romFileEven->getData();
+	const Bit8u *romDataOdd = romFileOdd->getData();
+	size_t partSize = romFileEven->getSize();
 	Bit8u *data = new Bit8u[2 * partSize];
 	Bit8u *writePtr = data;
 	for (size_t romDataIx = 0; romDataIx < partSize; romDataIx++) {
 		*(writePtr++) = romDataEven[romDataIx];
 		*(writePtr++) = romDataOdd[romDataIx];
 	}
-	const ROMImage *romImageFull = makeFullROMImage(data, 2 * partSize);
-	if (romImageFull->getROMInfo() == NULL) {
-		freeROMImage(romImageFull);
-		return NULL;
-	}
-	return romImageFull;
+	return new ArrayFile(data, 2 * partSize);
 }
 
 ROMImage::ROMImage(File *useFile, bool useOwnFile, const ROMInfo * const *romInfos) :
@@ -293,25 +309,38 @@ void ROMImage::freeROMImage(const ROMImage *romImage) {
 	delete romImage;
 }
 
-const ROMImage *ROMImage::mergeROMImages(const ROMImage *romImage1, const ROMImage *romImage2) {
-	if (romImage1->romInfo->pairROMInfo != romImage2->romInfo) {
+static File *mergePartialROMs(const ROMImage *romImage1, const ROMImage *romImage2) {
+	if (romImage1->getROMInfo()->pairROMInfo != romImage2->getROMInfo()) {
 		return NULL;
 	}
-	switch (romImage1->romInfo->pairType) {
+	File *romFile1 = romImage1->getFile();
+	File *romFile2 = romImage2->getFile();
+	switch (romImage1->getROMInfo()->pairType) {
 	case ROMInfo::FirstHalf:
-		return appendImages(romImage1, romImage2);
+		return appendROMFiles(romFile1, romFile2);
 	case ROMInfo::SecondHalf:
-		return appendImages(romImage2, romImage1);
+		return appendROMFiles(romFile2, romFile1);
 	case ROMInfo::Mux0:
-		return interleaveImages(romImage1, romImage2);
+		return interleaveROMFiles(romFile1, romFile2);
 	case ROMInfo::Mux1:
-		return interleaveImages(romImage2, romImage1);
+		return interleaveROMFiles(romFile2, romFile1);
 	default:
 		break;
 	}
 	return NULL;
 }
 
+const ROMImage *ROMImage::mergeROMImages(const ROMImage *romImage1, const ROMImage *romImage2) {
+	File *mergedFile = mergePartialROMs(romImage1, romImage2);
+	if (mergedFile == NULL) return NULL;
+	const ROMImage *mergedROMImage = new ROMImage(mergedFile, true, getKnownROMInfoList());
+	if (mergedROMImage->romInfo == NULL) {
+		freeROMImage(mergedROMImage);
+		return NULL;
+	}
+	return mergedROMImage;
+}
+
 File *ROMImage::getFile() const {
 	return file;
 }
@@ -342,7 +371,7 @@ const MachineConfiguration * const *MachineConfiguration::getAllMachineConfigura
 		&MT32_1_04, &MT32_1_05, &MT32_1_06, &MT32_1_07, &MT32_BLUER, &MT32_2_03, &MT32_2_04, &MT32_2_06, &MT32_2_07, &CM32L_1_00, &CM32L_1_02, &CM32LN_1_00, NULL
 	};
 
-	if (itemCount != NULL) *itemCount = _CALC_ARRAY_LENGTH(MACHINE_CONFIGURATIONS);
+	if (itemCount != NULL) *itemCount = MT32EMU_CALC_ARRAY_LENGTH(MACHINE_CONFIGURATIONS);
 	return MACHINE_CONFIGURATIONS;
 }
 
@@ -360,3 +389,15 @@ const ROMInfo * const *MachineConfiguration::getCompatibleROMInfos(Bit32u *itemC
 }
 
 } // namespace MT32Emu
+
+#ifdef MT32EMU_WITH_TESTING
+
+#include "test/TestAccessors.h"
+
+using namespace MT32Emu;
+
+File *Test::mergePartialROMs(const ROMImage *romImage1, const ROMImage *romImage2) {
+	return MT32Emu::mergePartialROMs(romImage1, romImage2);
+}
+
+#endif // #ifdef MT32EMU_WITH_TESTING
diff --git a/audio/softsynth/mt32/ROMInfo.h b/audio/softsynth/mt32/ROMInfo.h
index 1580362f4e1..06bddc70783 100644
--- a/audio/softsynth/mt32/ROMInfo.h
+++ b/audio/softsynth/mt32/ROMInfo.h
@@ -1,5 +1,5 @@
 /* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
- * Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ * Copyright (C) 2011-2024 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
@@ -122,10 +122,6 @@ public:
 	MT32EMU_EXPORT const ROMInfo *getROMInfo() const;
 
 private:
-	static const ROMImage *makeFullROMImage(Bit8u *data, size_t dataSize);
-	static const ROMImage *appendImages(const ROMImage *romImageLow, const ROMImage *romImageHigh);
-	static const ROMImage *interleaveImages(const ROMImage *romImageEven, const ROMImage *romImageOdd);
-
 	File * const file;
 	const bool ownFile;
 	const ROMInfo * const romInfo;
diff --git a/audio/softsynth/mt32/SampleRateConverter.cpp b/audio/softsynth/mt32/SampleRateConverter.cpp
index 54d0c246363..2e118499bfa 100644
--- a/audio/softsynth/mt32/SampleRateConverter.cpp
+++ b/audio/softsynth/mt32/SampleRateConverter.cpp
@@ -14,9 +14,7 @@
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#define MT32EMU_WITH_LIBSOXR_RESAMPLER 0
-#define MT32EMU_WITH_LIBSAMPLERATE_RESAMPLER 0
-#define MT32EMU_WITH_INTERNAL_RESAMPLER 1
+#include <cstddef>
 
 #include "SampleRateConverter.h"
 
@@ -30,7 +28,7 @@
 
 #include "Synth.h"
 
-using namespace MT32Emu;
+namespace MT32Emu {
 
 static inline void *createDelegate(Synth &synth, double targetSampleRate, SamplerateConversionQuality quality) {
 #if MT32EMU_WITH_LIBSOXR_RESAMPLER
@@ -126,3 +124,5 @@ double SampleRateConverter::convertOutputToSynthTimestamp(double outputTimestamp
 double SampleRateConverter::convertSynthToOutputTimestamp(double synthTimestamp) const {
 	return synthTimestamp / synthInternalToTargetSampleRateRatio;
 }
+
+} // namespace MT32Emu
diff --git a/audio/softsynth/mt32/Structures.h b/audio/softsynth/mt32/Structures.h
index 29362020193..ff390ed66bd 100644
--- a/audio/softsynth/mt32/Structures.h
+++ b/audio/softsynth/mt32/Structures.h
@@ -1,5 +1,5 @@
 /* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
- * Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ * Copyright (C) 2011-2026 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
@@ -194,6 +194,7 @@ struct ControlROMFeatureSet {
 	unsigned int quirkFastPitchChanges : 1;
 	unsigned int quirkDisplayCustomMessagePriority : 1;
 	unsigned int oldMT32DisplayFeatures : 1;
+	unsigned int newGenNoteCancellation : 1;
 
 	// Features below don't actually depend on control ROM version, which is used to identify hardware model
 	unsigned int defaultReverbMT32Compatible : 1;
diff --git a/audio/softsynth/mt32/Synth.cpp b/audio/softsynth/mt32/Synth.cpp
index a0e7356f5d5..257e45d3c81 100644
--- a/audio/softsynth/mt32/Synth.cpp
+++ b/audio/softsynth/mt32/Synth.cpp
@@ -1,5 +1,5 @@
 /* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
- * Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ * Copyright (C) 2011-2026 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
@@ -31,11 +31,9 @@
 #include "PartialManager.h"
 #include "Poly.h"
 #include "ROMInfo.h"
+#include "SysexBuilder.h"
 #include "TVA.h"
 
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
-#include "common/util.h"
-
 #if MT32EMU_MONITOR_SYSEX > 0
 #include "mmath.h"
 #endif
@@ -45,6 +43,8 @@ namespace MT32Emu {
 // MIDI interface data transfer rate in samples. Used to simulate the transfer delay.
 static const double MIDI_DATA_TRANSFER_RATE = double(SAMPLE_RATE) / 31250.0 * 8.0;
 
+static const Bit8u DEFAULT_MASTER_VOLUME = 100; // Confirmed
+
 static const ControlROMFeatureSet OLD_MT32_ELDER = {
 	true,  // quirkBasePitchOverflow
 	true,  // quirkPitchEnvelopeOverflow
@@ -56,6 +56,7 @@ static const ControlROMFeatureSet OLD_MT32_ELDER = {
 	false, // quirkFastPitchChanges
 	true,  // quirkDisplayCustomMessagePriority
 	true,  // oldMT32DisplayFeatures
+	false, // newGenNoteCancellation
 	true,  // defaultReverbMT32Compatible
 	true   // oldMT32AnalogLPF
 };
@@ -70,6 +71,7 @@ static const ControlROMFeatureSet OLD_MT32_LATER = {
 	false, // quirkFastPitchChanges
 	false, // quirkDisplayCustomMessagePriority
 	true,  // oldMT32DisplayFeatures
+	false, // newGenNoteCancellation
 	true,  // defaultReverbMT32Compatible
 	true   // oldMT32AnalogLPF
 };
@@ -84,6 +86,7 @@ static const ControlROMFeatureSet NEW_MT32_COMPATIBLE = {
 	false, // quirkFastPitchChanges
 	false, // quirkDisplayCustomMessagePriority
 	false, // oldMT32DisplayFeatures
+	true,  // newGenNoteCancellation
 	false, // defaultReverbMT32Compatible
 	false  // oldMT32AnalogLPF
 };
@@ -98,6 +101,7 @@ static const ControlROMFeatureSet CM32LN_COMPATIBLE = {
 	true,  // quirkFastPitchChanges
 	false, // quirkDisplayCustomMessagePriority
 	false, // oldMT32DisplayFeatures
+	true,  // newGenNoteCancellation
 	false, // defaultReverbMT32Compatible
 	false  // oldMT32AnalogLPF
 };
@@ -119,6 +123,15 @@ static const ControlROMMap ControlROMMaps[] = {
 	// (Note that old MT-32 ROMs actually have 86 entries for rhythmTemp)
 };
 
+static const ControlROMMap *getControlROMMap(const char *shortName) {
+	for (unsigned int i = 0; i < sizeof(ControlROMMaps) / sizeof(ControlROMMaps[0]); i++) {
+		if (strcmp(shortName, ControlROMMaps[i].shortName) == 0) {
+			return &ControlROMMaps[i];
+		}
+	}
+	return NULL;
+}
+
 static const PartialState PARTIAL_PHASE_TO_STATE[8] = {
 	PartialState_ATTACK, PartialState_ATTACK, PartialState_ATTACK, PartialState_ATTACK,
 	PartialState_SUSTAIN, PartialState_SUSTAIN, PartialState_RELEASE, PartialState_INACTIVE
@@ -216,10 +229,10 @@ public:
 		tmpBuffers(createTmpBuffers())
 	{}
 
-	void render(IntSample *stereoStream, Bit32u len) override;
-	void render(FloatSample *stereoStream, Bit32u len) override;
-	void renderStreams(const DACOutputStreams<IntSample> &streams, Bit32u len) override;
-	void renderStreams(const DACOutputStreams<FloatSample> &streams, Bit32u len) override;
+	void render(IntSample *stereoStream, Bit32u len);
+	void render(FloatSample *stereoStream, Bit32u len);
+	void renderStreams(const DACOutputStreams<IntSample> &streams, Bit32u len);
+	void renderStreams(const DACOutputStreams<FloatSample> &streams, Bit32u len);
 
 	template <class O>
 	void doRenderAndConvert(O *stereoStream, Bit32u len);
@@ -237,6 +250,7 @@ class Extensions {
 public:
 	RendererType selectedRendererType;
 	Bit32s masterTunePitchDelta;
+	Bit8u masterVolumeOverride;
 	bool niceAmpRamp;
 	bool nicePanning;
 	bool nicePartialMixing;
@@ -256,8 +270,9 @@ public:
 	Display *display;
 	bool oldMT32DisplayFeatures;
 
-	ReportHandler2 defaultReportHandler;
+	ReportHandler3 defaultReportHandler;
 	ReportHandler2 *reportHandler2;
+	ReportHandler3 *reportHandler3;
 };
 
 Bit32u Synth::getLibraryVersionInt() {
@@ -295,6 +310,7 @@ Synth::Synth(ReportHandler *useReportHandler) :
 
 	reportHandler = useReportHandler != NULL ? useReportHandler : &extensions.defaultReportHandler;
 	extensions.reportHandler2 = &extensions.defaultReportHandler;
+	extensions.reportHandler3 = &extensions.defaultReportHandler;
 
 	extensions.preallocatedReverbMemory = false;
 	for (int i = REVERB_MODE_ROOM; i <= REVERB_MODE_TAP_DELAY; i++) {
@@ -308,6 +324,7 @@ Synth::Synth(ReportHandler *useReportHandler) :
 	setOutputGain(1.0f);
 	setReverbOutputGain(1.0f);
 	setReversedStereoEnabled(false);
+	setMasterVolumeOverride(255);
 	setNiceAmpRampEnabled(true);
 	setNicePanningEnabled(false);
 	setNicePartialMixingEnabled(false);
@@ -352,6 +369,23 @@ void Synth::setReportHandler2(ReportHandler2 *reportHandler2) {
 		reportHandler = &extensions.defaultReportHandler;
 		extensions.reportHandler2 = &extensions.defaultReportHandler;
 	}
+	extensions.reportHandler3 = &extensions.defaultReportHandler;
+}
+
+void Synth::setReportHandler3(ReportHandler3 *reportHandler3) {
+	if (reportHandler3 != NULL) {
+		reportHandler = reportHandler3;
+		extensions.reportHandler2 = reportHandler3;
+		extensions.reportHandler3 = reportHandler3;
+	} else {
+		reportHandler = &extensions.defaultReportHandler;
+		extensions.reportHandler2 = &extensions.defaultReportHandler;
+		extensions.reportHandler3 = &extensions.defaultReportHandler;
+	}
+}
+
+ReportHandler3 *Synth::getReportHandler3() {
+	return extensions.reportHandler3;
 }
 
 void ReportHandler::showLCDMessage(const char *data) {
@@ -515,6 +549,18 @@ float Synth::getReverbOutputGain() const {
 	return reverbOutputGain;
 }
 
+void Synth::setMasterVolumeOverride(Bit8u volumeOverride) {
+	extensions.masterVolumeOverride = volumeOverride;
+	if (opened && volumeOverride <= DEFAULT_MASTER_VOLUME) {
+		mt32ram.system.masterVol = volumeOverride;
+		refreshSystemMasterVol();
+	}
+}
+
+Bit8u Synth::getMasterVolumeOverride() const {
+	return extensions.masterVolumeOverride;
+}
+
 void Synth::setPartVolumeOverride(Bit8u partNumber, Bit8u volumeOverride) {
 	if (opened && partNumber < 9) {
 		parts[partNumber]->setVolumeOverride(volumeOverride);
@@ -576,19 +622,16 @@ bool Synth::loadControlROM(const ROMImage &controlROMImage) {
 	memcpy(controlROMData, fileData, CONTROL_ROM_SIZE);
 
 	// Control ROM successfully loaded, now check whether it's a known type
-	controlROMMap = NULL;
-	controlROMFeatures = NULL;
-	for (unsigned int i = 0; i < ARRAYSIZE(ControlROMMaps); i++) {
-		if (strcmp(controlROMInfo->shortName, ControlROMMaps[i].shortName) == 0) {
-			controlROMMap = &ControlROMMaps[i];
-			controlROMFeatures = &controlROMMap->featureSet;
-			return true;
-		}
-	}
+	controlROMMap = getControlROMMap(controlROMInfo->shortName);
+	if (controlROMMap == NULL) {
+		controlROMFeatures = NULL;
 #if MT32EMU_MONITOR_INIT
-	printDebug("Control ROM failed to load");
+		printDebug("Control ROM failed to load");
 #endif
-	return false;
+		return false;
+	}
+	controlROMFeatures = &controlROMMap->featureSet;
+	return true;
 }
 
 bool Synth::loadPCMROM(const ROMImage &pcmROMImage) {
@@ -652,14 +695,15 @@ bool Synth::initPCMList(Bit16u mapAddress, Bit16u count) {
 	return false;
 }
 
-bool Synth::initCompressedTimbre(Bit16u timbreNum, const Bit8u *src, Bit32u srcLen) {
+bool Synth::initCompressedTimbre(TimbresMemoryRegion &tempRegion, Bit16u absTimbreNum, const Bit8u *src, Bit32u srcLen) {
 	// "Compressed" here means that muted partials aren't present in ROM (except in the case of partial 0 being muted).
 	// Instead the data from the previous unmuted partial is used.
 	if (srcLen < sizeof(TimbreParam::CommonParam)) {
 		return false;
 	}
-	TimbreParam *timbre = &mt32ram.timbres[timbreNum].timbre;
-	timbresMemoryRegion->write(timbreNum, 0, src, sizeof(TimbreParam::CommonParam), true);
+	TimbreParam *timbre = &mt32ram.timbres[absTimbreNum].timbre;
+	Bit32u timbreNum = absTimbreNum & 0x3F;
+	tempRegion.write(timbreNum, 0, src, sizeof(TimbreParam::CommonParam), true);
 	unsigned int srcPos = sizeof(TimbreParam::CommonParam);
 	unsigned int memPos = sizeof(TimbreParam::CommonParam);
 	for (int t = 0; t < 4; t++) {
@@ -669,7 +713,7 @@ bool Synth::initCompressedTimbre(Bit16u timbreNum, const Bit8u *src, Bit32u srcL
 		} else if (srcPos + sizeof(TimbreParam::PartialParam) >= srcLen) {
 			return false;
 		}
-		timbresMemoryRegion->write(timbreNum, memPos, src + srcPos, sizeof(TimbreParam::PartialParam));
+		tempRegion.write(timbreNum, memPos, src + srcPos, sizeof(TimbreParam::PartialParam));
 		srcPos += sizeof(TimbreParam::PartialParam);
 		memPos += sizeof(TimbreParam::PartialParam);
 	}
@@ -678,22 +722,26 @@ bool Synth::initCompressedTimbre(Bit16u timbreNum, const Bit8u *src, Bit32u srcL
 
 bool Synth::initTimbres(Bit16u mapAddress, Bit16u offset, Bit16u count, Bit16u startTimbre, bool compressed) {
 	const Bit8u *timbreMap = &controlROMData[mapAddress];
+	// We abuse TimbresMemoryRegion with the sole purpose of clamping the timbre parameters by the max table.
+	TimbresMemoryRegion tempRegion(reinterpret_cast<Bit8u *>(mt32ram.timbres + startTimbre), paddedTimbreMaxTable);
+	Bit16u timbreNum = 0;
 	for (Bit16u i = 0; i < count * 2; i += 2) {
+		Bit16u absTimbreNum = startTimbre + timbreNum;
 		Bit16u address = (timbreMap[i + 1] << 8) | timbreMap[i];
 		if (!compressed && (address + offset + sizeof(TimbreParam) > CONTROL_ROM_SIZE)) {
-			printDebug("Control ROM error: Timbre map entry 0x%04x for timbre %d points to invalid timbre address 0x%04x", i, startTimbre, address);
+			printDebug("Control ROM error: Timbre map entry 0x%04x for timbre %d points to invalid timbre address 0x%04x", i, absTimbreNum, address);
 			return false;
 		}
 		address += offset;
 		if (compressed) {
-			if (!initCompressedTimbre(startTimbre, &controlROMData[address], CONTROL_ROM_SIZE - address)) {
-				printDebug("Control ROM error: Timbre map entry 0x%04x for timbre %d points to invalid timbre at 0x%04x", i, startTimbre, address);
+			if (!initCompressedTimbre(tempRegion, absTimbreNum, &controlROMData[address], CONTROL_ROM_SIZE - address)) {
+				printDebug("Control ROM error: Timbre map entry 0x%04x for timbre %d points to invalid timbre at 0x%04x", i, absTimbreNum, address);
 				return false;
 			}
 		} else {
-			timbresMemoryRegion->write(startTimbre, 0, &controlROMData[address], sizeof(TimbreParam), true);
+			tempRegion.write(timbreNum, 0, &controlROMData[address], sizeof(TimbreParam), true);
 		}
-		startTimbre++;
+		timbreNum++;
 	}
 	return true;
 }
@@ -808,7 +856,7 @@ bool Synth::open(const ROMImage &controlROMImage, const ROMImage &pcmROMImage, B
 	// CM-64 seems to initialise all bytes in this bank to 0.
 	memset(&mt32ram.timbres[128], 0, sizeof(mt32ram.timbres[128]) * 64);
 
-	partialManager = new PartialManager(this, parts);
+	partialManager = new PartialManager(this);
 
 	pcmWaves = new PCMWaveEntry[controlROMMap->pcmCount];
 
@@ -853,7 +901,7 @@ bool Synth::open(const ROMImage &controlROMImage, const ROMImage &pcmROMImage, B
 		// The channel assignment is then {0, 1, 2, 3, 4, 5, 6, 7, 9}
 		mt32ram.system.chanAssign[i] = i + 1;
 	}
-	mt32ram.system.masterVol = 100; // Confirmed
+	mt32ram.system.masterVol = DEFAULT_MASTER_VOLUME;
 
 	bool oldReverbOverridden = reverbOverridden;
 	reverbOverridden = false;
@@ -904,6 +952,11 @@ bool Synth::open(const ROMImage &controlROMImage, const ROMImage &pcmROMImage, B
 	setOutputGain(outputGain);
 	setReverbOutputGain(reverbOutputGain);
 
+	if (extensions.masterVolumeOverride < DEFAULT_MASTER_VOLUME) {
+		mt32ram.system.masterVol = extensions.masterVolumeOverride;
+		refreshSystemMasterVol();
+	}
+
 	switch (getSelectedRendererType()) {
 		case RendererType_BIT16S:
 			renderer = new RendererImpl<IntSample>(*this);
@@ -1107,27 +1160,47 @@ bool Synth::playSysex(const Bit8u *sysex, Bit32u len, Bit32u timestamp) {
 void Synth::playMsgNow(Bit32u msg) {
 	if (!opened) return;
 
+	Bit8u command = Bit8u((msg & 0x0000F0) >> 4);
+
 	// NOTE: Active sense IS implemented in real hardware. However, realtime processing is clearly out of the library scope.
 	//       It is assumed that realtime consumers of the library respond to these MIDI events as appropriate.
+	if (command == 0x0F) {
+#if MT32EMU_MONITOR_MIDI > 0
+		printDebug("Unsupported MIDI System Common / Realtime: 0x%08x", msg);
+#endif
+		return;
+	}
+
+	if (command < 8) {
+#if MT32EMU_MONITOR_MIDI > 0
+		printDebug("playMsgNow for msg=0x%08x relies on running status; unsupported", msg);
+#endif
+		return;
+	}
 
-	Bit8u code = Bit8u((msg & 0x0000F0) >> 4);
 	Bit8u chan = Bit8u(msg & 0x00000F);
-	Bit8u note = Bit8u((msg & 0x007F00) >> 8);
-	Bit8u velocity = Bit8u((msg & 0x7F0000) >> 16);
+	Bit8u data1 = Bit8u((msg & 0x00FF00) >> 8);
+	Bit8u data2 = ((command & 0x0E) == 0x0C) ? 0 : Bit8u((msg & 0xFF0000) >> 16);
 
-	//printDebug("Playing chan %d, code 0x%01x note: 0x%02x", chan, code, note);
+	if (data1 > 127 || data2 > 127) {
+#if MT32EMU_MONITOR_MIDI > 0
+		printDebug("playMsgNow for msg=0x%08x with invalid data bytes: chan=%d, command=0x%01x, data1=%d, data2=%d",
+			msg, chan, command, data1, data2);
+#endif
+		return;
+	}
 
 	Bit8u *chanParts = extensions.chantable[chan];
 	if (*chanParts > 8) {
 #if MT32EMU_MONITOR_MIDI > 0
-		printDebug("Play msg on unreg chan %d (%d): code=0x%01x, vel=%d", chan, *chanParts, code, velocity);
+		printDebug("Play msg on unreg chan %d: command=0x%01x, data1=%d, data2=%d", chan, command, data1, data2);
 #endif
 		return;
 	}
 	for (Bit32u i = extensions.abortingPartIx; i <= 8; i++) {
 		const Bit32u partNum = chanParts[i];
 		if (partNum > 8) break;
-		playMsgOnPart(partNum, code, note, velocity);
+		playUnpackedShortMessage(partNum, command, data1, data2);
 		if (isAbortingPoly()) {
 			extensions.abortingPartIx = i;
 			break;
@@ -1137,73 +1210,72 @@ void Synth::playMsgNow(Bit32u msg) {
 	}
 }
 
-void Synth::playMsgOnPart(Bit8u part, Bit8u code, Bit8u note, Bit8u velocity) {
+void Synth::playMsgOnPart(Bit8u partNum, Bit8u command, Bit8u data1, Bit8u data2) {
 	if (!opened) return;
 
-	Bit32u bend;
+	if (partNum > 8 || data1 > 127 || data2 > 127) {
+#if MT32EMU_MONITOR_MIDI > 0
+		printDebug("playMsgOnPart with invalid params: part=%d, command=0x%01x, data1=%d, data2=%d", partNum, command, data1, data2);
+#endif
+		return;
+	}
+	playUnpackedShortMessage(partNum, command, data1, data2);
+}
 
+void Synth::playUnpackedShortMessage(Bit8u partNum, Bit8u command, Bit8u data1, Bit8u data2) {
 	if (!activated) activated = true;
-	//printDebug("Synth::playMsgOnPart(%02x, %02x, %02x, %02x)", part, code, note, velocity);
-	switch (code) {
+
+	switch (command) {
 	case 0x8:
-		//printDebug("Note OFF - Part %d", part);
 		// The MT-32 ignores velocity for note off
-		parts[part]->noteOff(note);
+		parts[partNum]->noteOff(data1);
 		break;
 	case 0x9:
-		//printDebug("Note ON - Part %d, Note %d Vel %d", part, note, velocity);
-		if (velocity == 0) {
+		if (data2 == 0) {
 			// MIDI defines note-on with velocity 0 as being the same as note-off with velocity 40
-			parts[part]->noteOff(note);
-		} else if (parts[part]->getVolumeOverride() > 0) {
-			parts[part]->noteOn(note, velocity);
+			parts[partNum]->noteOff(data1);
+		} else if (parts[partNum]->getVolumeOverride() > 0) {
+			parts[partNum]->noteOn(data1, data2);
 		}
 		break;
 	case 0xB: // Control change
-		switch (note) {
+		switch (data1) {
 		case 0x01:  // Modulation
-			//printDebug("Modulation: %d", velocity);
-			parts[part]->setModulation(velocity);
+			parts[partNum]->setModulation(data2);
 			break;
 		case 0x06:
-			parts[part]->setDataEntryMSB(velocity);
+			parts[partNum]->setDataEntryMSB(data2);
 			break;
 		case 0x07:  // Set volume
-			//printDebug("Volume set: %d", velocity);
-			parts[part]->setVolume(velocity);
+			parts[partNum]->setVolume(data2);
 			break;
 		case 0x0A:  // Pan
-			//printDebug("Pan set: %d", velocity);
-			parts[part]->setPan(velocity);
+			parts[partNum]->setPan(data2);
 			break;
 		case 0x0B:
-			//printDebug("Expression set: %d", velocity);
-			parts[part]->setExpression(velocity);
+			parts[partNum]->setExpression(data2);
 			break;
 		case 0x40: // Hold (sustain) pedal
-			//printDebug("Hold pedal set: %d", velocity);
-			parts[part]->setHoldPedal(velocity >= 64);
+			parts[partNum]->setHoldPedal(data2 >= 64);
 			break;
 
 		case 0x62:
 		case 0x63:
-			parts[part]->setNRPN();
+			parts[partNum]->setNRPN();
 			break;
 		case 0x64:
-			parts[part]->setRPNLSB(velocity);
+			parts[partNum]->setRPNLSB(data2);
 			break;
 		case 0x65:
-			parts[part]->setRPNMSB(velocity);
+			parts[partNum]->setRPNMSB(data2);
 			break;
 
 		case 0x79: // Reset all controllers
-			//printDebug("Reset all controllers");
-			parts[part]->resetAllControllers();
+			parts[partNum]->resetAllControllers();
 			break;
 
 		case 0x7B: // All notes off
-			//printDebug("All notes off");
-			parts[part]->allNotesOff();
+			parts[partNum]->allNotesOff();
 			break;
 
 		case 0x7C:
@@ -1211,35 +1283,32 @@ void Synth::playMsgOnPart(Bit8u part, Bit8u code, Bit8u note, Bit8u velocity) {
 		case 0x7E:
 		case 0x7F:
 			// CONFIRMED:Mok: A real LAPC-I responds to these controllers as follows:
-			parts[part]->setHoldPedal(false);
-			parts[part]->allNotesOff();
+			parts[partNum]->setHoldPedal(false);
+			parts[partNum]->allNotesOff();
 			break;
 
 		default:
 #if MT32EMU_MONITOR_MIDI > 0
-			printDebug("Unknown MIDI Control code: 0x%02x - vel 0x%02x", note, velocity);
+			printDebug("Unknown MIDI Control code: 0x%02x - data2: 0x%02x", data1, data2);
 #endif
 			return;
 		}
 		extensions.display->midiMessagePlayed();
 		break;
 	case 0xC: // Program change
-		//printDebug("Program change %01x", note);
-		parts[part]->setProgram(note);
-		if (part < 8) {
+		parts[partNum]->setProgram(data1);
+		if (partNum < 8) {
 			extensions.display->midiMessagePlayed();
-			extensions.display->programChanged(part);
+			extensions.display->programChanged(partNum);
 		}
 		break;
 	case 0xE: // Pitch bender
-		bend = (velocity << 7) | (note);
-		//printDebug("Pitch bender %02x", bend);
-		parts[part]->setBend(bend);
+		parts[partNum]->setBend((data2 << 7) | data1);
 		extensions.display->midiMessagePlayed();
 		break;
 	default:
 #if MT32EMU_MONITOR_MIDI > 0
-		printDebug("Unknown Midi code: 0x%01x - %02x - %02x", code, note, velocity);
+		printDebug("Unknown Midi command: 0x%01x - %02x - %02x", command, data1, data2);
 #endif
 		return;
 	}
@@ -1347,6 +1416,107 @@ void Synth::playSysexWithoutHeader(Bit8u device, Bit8u command, const Bit8u *sys
 	}
 }
 
+bool SysexBuilder::appendSysex(Bit32u sysexAddress, const Bit8u *data, Bit32u dataLength) {
+	static const Bit8u SYSEX_HEADER[] = { 0xF0, SYSEX_MANUFACTURER_ROLAND, 0x10, SYSEX_MDL_MT32, SYSEX_CMD_DT1 };
+	static const Bit8u SYSEX_TERMINATOR = 0xF7;
+
+	if ((data == NULL && dataLength > 0) || (&writePtr[dataLength + 10] > endPtr)) return false;
+
+	memcpy(writePtr, SYSEX_HEADER, sizeof SYSEX_HEADER);
+	writePtr += sizeof SYSEX_HEADER;
+	const Bit8u *headerEndPtr = writePtr;
+	*(writePtr++) = (sysexAddress >> 16) & 0xFF;
+	*(writePtr++) = (sysexAddress >> 8) & 0xFF;
+	*(writePtr++) = sysexAddress & 0xFF;
+	if (dataLength > 0) {
+		memcpy(writePtr, data, dataLength);
+		writePtr += dataLength;
+	}
+	*(writePtr++) = Synth::calcSysexChecksum(headerEndPtr, dataLength + 3);
+	*(writePtr++) = SYSEX_TERMINATOR;
+	return true;
+}
+
+struct SysexBankBuilder : SysexBuilder {
+	SysexBankBuilder(Bit8u *sysexBank, Bit32u size) : SysexBuilder(sysexBank, size) {}
+
+	bool appendTimbreMemorySysexes(MemParams::PaddedTimbre *timbreMemory) {
+		for (Bit32u timbreIx = 0; timbreIx < 64; timbreIx++) {
+			if (!appendSysex(0x80000 + timbreIx * 0x200, reinterpret_cast<Bit8u *>(&timbreMemory[timbreIx + 128]), sizeof(TimbreParam))) {
+				return false;
+			}
+		}
+		return true;
+	}
+
+	bool appendPatchMemorySysexes(PatchParam *patchMemory) {
+		for (Bit32u patchBlockIx = 0; patchBlockIx < 4; patchBlockIx++) {
+			if (!appendSysex(0x50000 + patchBlockIx * 0x200, &patchMemory[patchBlockIx * 32].timbreGroup, sizeof(PatchParam) * 32))
+				return false;
+		}
+		return true;
+	}
+
+	bool appendRhythmSetupSysexes(MemParams::RhythmTemp *rhythmSetup) {
+		return appendSysex(0x30110, &rhythmSetup->timbre, sizeof(MemParams::RhythmTemp) * 64)
+			&& appendSysex(0x30310, &rhythmSetup->timbre, sizeof(MemParams::RhythmTemp) * 21);
+	}
+
+	bool appendTimbreTempSysexes(TimbreParam *timbreTemp) {
+		for (Bit32u timbreIx = 0; timbreIx < 8; timbreIx++) {
+			if (!appendSysex(0x40000 + MT32EMU_SYSEXMEMADDR(timbreIx * 0xF6), reinterpret_cast<Bit8u *>(&timbreTemp[timbreIx]),
+				sizeof(TimbreParam))) return false;
+		}
+		return true;
+	}
+};
+
+Bit32u Synth::dumpSysexBank(Bit8u *sysexBank, Bit32u size) const {
+	static const Bit32u maxBankSize = Bit32u(
+		10 // Reset SysEx, no data.
+		+ sizeof(MemParams::System) + 10
+		+ 64 * (sizeof(TimbreParam) + 10)
+		+ 4 * (32 * sizeof(PatchParam) + 10)
+		+ 64 * sizeof(MemParams::RhythmTemp) + 10
+		+ 21 * sizeof(MemParams::RhythmTemp) + 10
+		+ 9 * sizeof(MemParams::PatchTemp) + 10
+		+ 8 * (sizeof(TimbreParam) + 10)
+	);
+
+	if (!opened) return 0;
+
+	if (sysexBank && size) {
+		SysexBankBuilder builder(sysexBank, size);
+		builder.appendSysex(0x7F0000, NULL, 0)
+			&& builder.appendSysex(0x100000, &mt32ram.system.masterTune, sizeof(MemParams::System))
+			&& builder.appendTimbreMemorySysexes(mt32ram.timbres)
+			&& builder.appendPatchMemorySysexes(mt32ram.patches)
+			&& builder.appendRhythmSetupSysexes(mt32ram.rhythmTemp)
+			&& builder.appendSysex(0x030000, &mt32ram.patchTemp->patch.timbreGroup, sizeof mt32ram.patchTemp)
+			&& builder.appendTimbreTempSysexes(mt32ram.timbreTemp);
+	}
+	return maxBankSize;
+}
+
+Bit32u Synth::applySysexBank(const Bit8u *sysexBank, Bit32u size) {
+	if (!opened) return 0;
+
+	Bit32u sysexesPlayed = 0;
+	const Bit8u *sysexBeginPtr = NULL;
+	const Bit8u *sysexBankEndPtr = sysexBank + size;
+	for (const Bit8u *p = sysexBank; p < sysexBankEndPtr; p++) {
+		if (*p == 0xF0) {
+			sysexBeginPtr = p;
+		} else if (*p == 0xF7 && sysexBeginPtr) {
+			Bit32u sysexLength = Bit32u(p - sysexBeginPtr) + 1;
+			playSysexNow(sysexBeginPtr, sysexLength);
+			sysexBeginPtr = NULL;
+			sysexesPlayed++;
+		}
+	}
+	return sysexesPlayed;
+}
+
 void Synth::readSysex(Bit8u /*device*/, const Bit8u * /*sysex*/, Bit32u /*len*/) const {
 	// NYI
 }
@@ -1495,14 +1665,14 @@ void Synth::initMemoryRegions() {
 		pos += sizeof(TimbreParam::PartialParam);
 	}
 	memset(&paddedTimbreMaxTable[pos], 0, 10); // Padding
-	patchTempMemoryRegion = new PatchTempMemoryRegion(this, reinterpret_cast<Bit8u *>(&mt32ram.patchTemp[0]), &controlROMData[controlROMMap->patchMaxTable]);
-	rhythmTempMemoryRegion = new RhythmTempMemoryRegion(this, reinterpret_cast<Bit8u *>(&mt32ram.rhythmTemp[0]), &controlROMData[controlROMMap->rhythmMaxTable]);
-	timbreTempMemoryRegion = new TimbreTempMemoryRegion(this, reinterpret_cast<Bit8u *>(&mt32ram.timbreTemp[0]), paddedTimbreMaxTable);
-	patchesMemoryRegion = new PatchesMemoryRegion(this, reinterpret_cast<Bit8u *>(&mt32ram.patches[0]), &controlROMData[controlROMMap->patchMaxTable]);
-	timbresMemoryRegion = new TimbresMemoryRegion(this, reinterpret_cast<Bit8u *>(&mt32ram.timbres[0]), paddedTimbreMaxTable);
-	systemMemoryRegion = new SystemMemoryRegion(this, reinterpret_cast<Bit8u *>(&mt32ram.system), &controlROMData[controlROMMap->systemMaxTable]);
-	displayMemoryRegion = new DisplayMemoryRegion(this);
-	resetMemoryRegion = new ResetMemoryRegion(this);
+	patchTempMemoryRegion = new PatchTempMemoryRegion(reinterpret_cast<Bit8u *>(&mt32ram.patchTemp[0]), &controlROMData[controlROMMap->patchMaxTable]);
+	rhythmTempMemoryRegion = new RhythmTempMemoryRegion(reinterpret_cast<Bit8u *>(&mt32ram.rhythmTemp[0]), &controlROMData[controlROMMap->rhythmMaxTable]);
+	timbreTempMemoryRegion = new TimbreTempMemoryRegion(reinterpret_cast<Bit8u *>(&mt32ram.timbreTemp[0]), paddedTimbreMaxTable);
+	patchesMemoryRegion = new PatchesMemoryRegion(reinterpret_cast<Bit8u *>(&mt32ram.patches[0]), &controlROMData[controlROMMap->patchMaxTable]);
+	timbresMemoryRegion = new TimbresMemoryRegion(reinterpret_cast<Bit8u *>(&mt32ram.timbres[/* Bank M */ 128]), paddedTimbreMaxTable);
+	systemMemoryRegion = new SystemMemoryRegion(reinterpret_cast<Bit8u *>(&mt32ram.system), &controlROMData[controlROMMap->systemMaxTable]);
+	displayMemoryRegion = new DisplayMemoryRegion();
+	resetMemoryRegion = new ResetMemoryRegion();
 }
 
 void Synth::deleteMemoryRegions() {
@@ -1594,7 +1764,7 @@ void Synth::writeMemoryRegion(const MemoryRegion *region, Bit32u addr, Bit32u le
 						printDebug(" (Not updating timbre, since those values weren't touched)");
 #endif
 					} else {
-						parts[i]->setTimbre(&mt32ram.timbres[parts[i]->getAbsTimbreNum()].timbre);
+						parts[i]->resetTimbre();
 					}
 				}
 				parts[i]->refresh();
@@ -1650,8 +1820,6 @@ void Synth::writeMemoryRegion(const MemoryRegion *region, Bit32u addr, Bit32u le
 		break;
 	case MR_Timbres:
 		// Timbres
-		first += 128;
-		last += 128;
 		region->write(first, off, data, len);
 		for (unsigned int i = first; i <= last; i++) {
 #if MT32EMU_MONITOR_TIMBRES >= 1
@@ -1775,7 +1943,14 @@ void Synth::writeMemoryRegion(const MemoryRegion *region, Bit32u addr, Bit32u le
 			refreshSystemChanAssign(Bit8u(firstPart), Bit8u(lastPart));
 		}
 		if (off <= SYSTEM_MASTER_VOL_OFF && off + len > SYSTEM_MASTER_VOL_OFF) {
-			refreshSystemMasterVol();
+			if (extensions.masterVolumeOverride <= DEFAULT_MASTER_VOLUME) {
+#if MT32EMU_MONITOR_SYSEX > 0
+				printDebug(" Master volume overridden, wanted: %d - ignoring", mt32ram.system.masterVol);
+#endif
+				mt32ram.system.masterVol = extensions.masterVolumeOverride;
+			} else {
+				refreshSystemMasterVol();
+			}
 		}
 		break;
 	case MR_Display:
@@ -1921,6 +2096,9 @@ void Synth::reset() {
 			parts[8]->refresh();
 		}
 	}
+	if (extensions.masterVolumeOverride < DEFAULT_MASTER_VOLUME) {
+		mt32ram.system.masterVol = extensions.masterVolumeOverride;
+	}
 	refreshSystem();
 	resetMasterTunePitchDelta();
 	isActive();
@@ -1981,13 +2159,13 @@ public:
 /** Storage space for SysEx data is allocated dynamically on demand and is disposed lazily. */
 class DynamicSysexDataStorage : public MidiEventQueue::SysexDataStorage {
 public:
-	Bit8u *allocate(Bit32u sysexLength) override {
+	Bit8u *allocate(Bit32u sysexLength) {
 		return new Bit8u[sysexLength];
 	}
 
-	void reclaimUnused(const Bit8u *, Bit32u) override {}
+	void reclaimUnused(const Bit8u *, Bit32u) {}
 
-	void dispose(const Bit8u *sysexData, Bit32u) override {
+	void dispose(const Bit8u *sysexData, Bit32u) {
 		delete[] sysexData;
 	}
 };
@@ -2010,7 +2188,7 @@ public:
 		delete[] storageBuffer;
 	}
 
-	Bit8u *allocate(Bit32u sysexLength) override {
+	Bit8u *allocate(Bit32u sysexLength) {
 		Bit32u myStartPosition = startPosition;
 		Bit32u myEndPosition = endPosition;
 
@@ -2036,7 +2214,7 @@ public:
 		return storageBuffer + myEndPosition;
 	}
 
-	void reclaimUnused(const Bit8u *sysexData, Bit32u sysexLength) override {
+	void reclaimUnused(const Bit8u *sysexData, Bit32u sysexLength) {
 		if (sysexData == NULL) return;
 		Bit32u allocatedPosition = startPosition;
 		if (storageBuffer + allocatedPosition == sysexData) {
@@ -2047,7 +2225,7 @@ public:
 		}
 	}
 
-	void dispose(const Bit8u *, Bit32u) override {}
+	void dispose(const Bit8u *, Bit32u) {}
 
 private:
 	Bit8u * const storageBuffer;
@@ -2730,3 +2908,15 @@ void MemoryRegion::write(unsigned int entry, unsigned int off, const Bit8u *src,
 }
 
 } // namespace MT32Emu
+
+#ifdef MT32EMU_WITH_TESTING
+
+#include "test/TestAccessors.h"
+
+using namespace MT32Emu;
+
+const ControlROMMap *Test::getControlROMMap(const char *shortName) {
+	return MT32Emu::getControlROMMap(shortName);
+}
+
+#endif // #ifdef MT32EMU_WITH_TESTING
diff --git a/audio/softsynth/mt32/Synth.h b/audio/softsynth/mt32/Synth.h
index 0f88eb9f050..38097200cd0 100644
--- a/audio/softsynth/mt32/Synth.h
+++ b/audio/softsynth/mt32/Synth.h
@@ -1,5 +1,5 @@
 /* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
- * Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ * Copyright (C) 2011-2026 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
@@ -128,10 +128,21 @@ public:
 	virtual void onMidiMessageLEDStateUpdated(bool /* ledState */) {}
 };
 
+// Extends ReportHandler for delivering signals about insufficient partials conditions to the client.
+class MT32EMU_EXPORT_V(2.8) ReportHandler3 : public ReportHandler2 {
+public:
+	virtual ~ReportHandler3() {}
+
+	// Invoked in case the NoteOn MIDI message currently being processed cannot be played due to insufficient free partials.
+	virtual void onNoteOnIgnored(Bit32u /* partialsNeeded */, Bit32u /* partialsFree */) {}
+	// Invoked in case the partial allocator starts premature silencing a currently playing poly to free partials necessary
+	// for processing the preceding NoteOn MIDI message.
+	virtual void onPlayingPolySilenced(Bit32u /* partialsNeeded */, Bit32u /* partialsFree */) {}
+};
+
 class Synth {
 friend class DefaultMidiStreamParser;
 friend class Display;
-friend class MemoryRegion;
 friend class Part;
 friend class Partial;
 friend class PartialManager;
@@ -228,7 +239,7 @@ private:
 
 	bool initPCMList(Bit16u mapAddress, Bit16u count);
 	bool initTimbres(Bit16u mapAddress, Bit16u offset, Bit16u timbreCount, Bit16u startTimbre, bool compressed);
-	bool initCompressedTimbre(Bit16u drumNum, const Bit8u *mem, Bit32u memLen);
+	bool initCompressedTimbre(TimbresMemoryRegion &tempRegion, Bit16u absTimbreNum, const Bit8u *src, Bit32u srcLen);
 	void initReverbModels(bool mt32CompatibleMode);
 	void initSoundGroups(char newSoundGroupNames[][9]);
 
@@ -256,6 +267,10 @@ private:
 	void resetMasterTunePitchDelta();
 	Bit32s getMasterTunePitchDelta() const;
 
+	ReportHandler3 *getReportHandler3();
+
+	void playUnpackedShortMessage(Bit8u partNum, Bit8u command, Bit8u data1, Bit8u data2);
+
 public:
 	static inline Bit16s clipSampleEx(Bit32s sampleEx) {
 		// Clamp values above 32767 to 32767, and values below -32768 to -32768
@@ -313,6 +328,9 @@ public:
 	// Sets an implementation of ReportHandler2 interface for reporting various errors, information and debug messages.
 	// If the argument is NULL, the default implementation is installed as a fallback.
 	MT32EMU_EXPORT_V(2.6) void setReportHandler2(ReportHandler2 *reportHandler2);
+	// Sets an implementation of ReportHandler3 interface for reporting various errors, information and debug messages.
+	// If the argument is NULL, the default implementation is installed as a fallback.
+	MT32EMU_EXPORT_V(2.8) void setReportHandler3(ReportHandler3 *reportHandler3);
 
 	// Used to initialise the MT-32. Must be called before any other function.
 	// Returns true if initialization was successful, otherwise returns false.
@@ -361,27 +379,31 @@ public:
 	// Calls from multiple threads must be synchronised, although, no synchronisation is required with the rendering thread.
 	// The methods return false if the MIDI event queue is full and the message cannot be enqueued.
 
-	// Enqueues a single short MIDI message to play at specified time. The message must contain a status byte.
+	// Enqueues a single short MIDI message to play at specified time. The message must contain a status byte and one or two data
+	// bytes (as appropriate for the MIDI command).
 	MT32EMU_EXPORT bool playMsg(Bit32u msg, Bit32u timestamp);
 	// Enqueues a single well formed System Exclusive MIDI message to play at specified time.
 	MT32EMU_EXPORT bool playSysex(const Bit8u *sysex, Bit32u len, Bit32u timestamp);
 
-	// Enqueues a single short MIDI message to be processed ASAP. The message must contain a status byte.
+	// Enqueues a single short MIDI message to be processed ASAP. The message must contain a status byte and one or two data
+	// bytes (as appropriate for the MIDI command).
 	MT32EMU_EXPORT bool playMsg(Bit32u msg);
 	// Enqueues a single well formed System Exclusive MIDI message to be processed ASAP.
 	MT32EMU_EXPORT bool playSysex(const Bit8u *sysex, Bit32u len);
 
 	// WARNING:
-	// The methods below don't ensure minimum 1-sample delay between sequential MIDI events,
-	// and a sequence of NoteOn and immediately succeeding NoteOff messages is always silent.
-	// A thread that invokes these methods must be explicitly synchronised with the thread performing sample rendering.
+	// The methods below may have no effect while the synth is aborting a poly. They also don't ensure minimum 1-sample delay between
+	// sequential MIDI events, and a sequence of NoteOn and immediately succeeding NoteOff messages is always silent.
+	// A thread that invokes these methods must be explicitly synchronised with the thread performing sample rendering or be the same.
 
-	// Sends a short MIDI message to the synth for immediate playback. The message must contain a status byte.
+	// Sends a short MIDI message to the synth for immediate playback. The message must contain a status byte and one or two data
+	// bytes (as appropriate for the MIDI command), otherwise it is ignored.
 	// See the WARNING above.
 	MT32EMU_EXPORT void playMsgNow(Bit32u msg);
-	// Sends unpacked short MIDI message to the synth for immediate playback. The message must contain a status byte.
+	// Sends unpacked short MIDI message to the synth for immediate playback. All the message parameters must be within the supported
+	// range, otherwise the message is ignored.
 	// See the WARNING above.
-	MT32EMU_EXPORT void playMsgOnPart(Bit8u part, Bit8u code, Bit8u note, Bit8u velocity);
+	MT32EMU_EXPORT void playMsgOnPart(Bit8u partNum, Bit8u command, Bit8u data1, Bit8u data2);
 
 	// Sends a single well formed System Exclusive MIDI message for immediate processing. The length is in bytes.
 	// See the WARNING above.
@@ -396,6 +418,18 @@ public:
 	// See the WARNING above.
 	MT32EMU_EXPORT void writeSysex(Bit8u channel, const Bit8u *sysex, Bit32u len);
 
+	// Stores internal state of the emulated synth into the provided array. The messages within the SysEx bank are ordered so that
+	// they can be replayed back in the same sequence without data loss, provided that the given array has sufficient size.
+	// The SysEx messages written in the array can be re-played using applySysexBank() function or even sent to a real device.
+	// Returns the full length of the SysEx bank in bytes that is needed to fit all the available data.
+	// This function can be used to retrieve the required size of the SysEx bank by supplying NULL sysexBank or zero size arguments,
+	// in which case it does nothing else.
+	MT32EMU_EXPORT_V(2.8) Bit32u dumpSysexBank(Bit8u *sysexBank, Bit32u size) const;
+	// Applies the content of the given SysEx bank to the emulated synth from the provided array. All complete SysEx messages
+	// contained within the sysexBank are played in sequence, any other data is ignored.
+	// Returns the number of played SysEx messages.
+	MT32EMU_EXPORT_V(2.8) Bit32u applySysexBank(const Bit8u *sysexBank, Bit32u size);
+
 	// Allows to disable wet reverb output altogether.
 	MT32EMU_EXPORT void setReverbEnabled(bool reverbEnabled);
 	// Returns whether wet reverb output is enabled.
@@ -447,6 +481,16 @@ public:
 	// Returns current output gain factor for reverb wet output channels.
 	MT32EMU_EXPORT float getReverbOutputGain() const;
 
+	// Sets or removes an override for the Master Volume. When the Master Volume is overridden, a SysEx write to the system area
+	// will have no effect on the Master Volume setting, yet a system memory read will return the overridden Master Volume.
+	// To enable the override mode, argument volumeOverride should be in range 0..100. Setting a value outside this range
+	// disables the override mode allowing the Master Volume to change further on (without changing the current volume).
+	// This setting persists synth reopening.
+	MT32EMU_EXPORT_V(2.8) void setMasterVolumeOverride(Bit8u volumeOverride);
+	// Returns the overridden master volume previously set, if any; a value outside the range 0..100 means no override
+	// is currently in effect.
+	MT32EMU_EXPORT_V(2.8) Bit8u getMasterVolumeOverride() const;
+
 	// Sets (or removes) an override for the current volume (output level) on a specific part.
 	// When the part volume is overridden, the MIDI controller Volume (7) on the MIDI channel this part is assigned to
 	// has no effect on the output level of this part. Similarly, the output level value set on this part via a SysEx that
@@ -588,6 +632,7 @@ public:
 	MT32EMU_EXPORT_V(2.7) bool getSoundName(char *soundName, Bit8u timbreGroup, Bit8u timbreNumber) const;
 
 	// Stores internal state of emulated synth into an array provided (as it would be acquired from hardware).
+	// Note, addr parameter is expressed in the linear space and *not* the SysEx address space.
 	MT32EMU_EXPORT void readMemory(Bit32u addr, Bit32u len, Bit8u *data);
 
 	// Retrieves the current state of the emulated MT-32 display facilities.
diff --git a/audio/softsynth/mt32/SysexBuilder.h b/audio/softsynth/mt32/SysexBuilder.h
new file mode 100644
index 00000000000..167b6b3d3c9
--- /dev/null
+++ b/audio/softsynth/mt32/SysexBuilder.h
@@ -0,0 +1,44 @@
+/* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
+ * Copyright (C) 2011-2026 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
+ *  the Free Software Foundation, either version 2.1 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef MT32EMU_SYSEX_BUILDER_H
+#define MT32EMU_SYSEX_BUILDER_H
+
+#include "globals.h"
+#include "Types.h"
+
+namespace MT32Emu {
+
+/**
+ * Facilitates creation of a bank of MT-32 compatible SysEx messages.
+ */
+class SysexBuilder {
+	Bit8u *writePtr;
+	const Bit8u * const endPtr;
+
+public:
+	// Initialises the builder to fill SysEx messages into sysexBank of the given size.
+	SysexBuilder(Bit8u *sysexBank, Bit32u size) : writePtr(sysexBank), endPtr(sysexBank + size) {}
+
+	// Wraps the provided data array to be written to sysexAddress into a SysEx message with the header and trailer and appends it
+	// to the SysEx bank if there is enough free space within.
+	bool appendSysex(Bit32u sysexAddress, const Bit8u *data, Bit32u dataLength);
+};
+
+} // namespace MT32Emu
+
+#endif // #ifndef MT32EMU_SYSEX_BUILDER_H
diff --git a/audio/softsynth/mt32/TVA.cpp b/audio/softsynth/mt32/TVA.cpp
index e3f76181f16..cd7f950d834 100644
--- a/audio/softsynth/mt32/TVA.cpp
+++ b/audio/softsynth/mt32/TVA.cpp
@@ -32,7 +32,17 @@
 namespace MT32Emu {
 
 // CONFIRMED: Matches a table in ROM - haven't got around to coming up with a formula for it yet.
-static Bit8u biasLevelToAmpSubtractionCoeff[13] = {255, 187, 137, 100, 74, 54, 40, 29, 21, 15, 10, 5, 0};
+static const Bit8u biasLevelToAmpSubtractionCoeff[13] = {255, 187, 137, 100, 74, 54, 40, 29, 21, 15, 10, 5, 0};
+
+static const Bit8u *envLogarithmicTime;
+static const Bit8u *levelToAmpSubtraction;
+static const Bit8u *masterVolToAmpSubtraction;
+
+void TVA::initTables(const Tables &tables) {
+	envLogarithmicTime = tables.envLogarithmicTime;
+	levelToAmpSubtraction = tables.levelToAmpSubtraction;
+	masterVolToAmpSubtraction = tables.masterVolToAmpSubtraction;
+}
 
 TVA::TVA(const Partial *usePartial, LA32Ramp *useAmpRamp) :
 	partial(usePartial), ampRamp(useAmpRamp), system(&usePartial->getSynth()->mt32ram.system), phase(TVA_PHASE_DEAD) {
@@ -99,24 +109,24 @@ static int calcVeloAmpSubtraction(Bit8u veloSensitivity, unsigned int velocity)
 	return absVelocityMult - (velocityMult >> 8); // PORTABILITY NOTE: Assumes arithmetic shift
 }
 
-static int calcBasicAmp(const Tables *tables, const Partial *partial, const MemParams::System *system, const TimbreParam::PartialParam *partialParam, Bit8u partVolume, const MemParams::RhythmTemp *rhythmTemp, int biasAmpSubtraction, int veloAmpSubtraction, Bit8u expression, bool hasRingModQuirk) {
+static int calcBasicAmp(const Partial *partial, const MemParams::System *system, const TimbreParam::PartialParam *partialParam, Bit8u partVolume, const MemParams::RhythmTemp *rhythmTemp, int biasAmpSubtraction, int veloAmpSubtraction, Bit8u expression, bool hasRingModQuirk) {
 	int amp = 155;
 
 	if (!(hasRingModQuirk ? partial->isRingModulatingNoMix() : partial->isRingModulatingSlave())) {
-		amp -= tables->masterVolToAmpSubtraction[system->masterVol];
+		amp -= masterVolToAmpSubtraction[system->masterVol];
 		if (amp < 0) {
 			return 0;
 		}
-		amp -= tables->levelToAmpSubtraction[partVolume];
+		amp -= levelToAmpSubtraction[partVolume];
 		if (amp < 0) {
 			return 0;
 		}
-		amp -= tables->levelToAmpSubtraction[expression];
+		amp -= levelToAmpSubtraction[expression];
 		if (amp < 0) {
 			return 0;
 		}
 		if (rhythmTemp != NULL) {
-			amp -= tables->levelToAmpSubtraction[rhythmTemp->outputLevel];
+			amp -= levelToAmpSubtraction[rhythmTemp->outputLevel];
 			if (amp < 0) {
 				return 0;
 			}
@@ -126,7 +136,7 @@ static int calcBasicAmp(const Tables *tables, const Partial *partial, const MemP
 	if (amp < 0) {
 		return 0;
 	}
-	amp -= tables->levelToAmpSubtraction[partialParam->tva.level];
+	amp -= levelToAmpSubtraction[partialParam->tva.level];
 	if (amp < 0) {
 		return 0;
 	}
@@ -158,8 +168,6 @@ void TVA::reset(const Part *newPart, const TimbreParam::PartialParam *newPartial
 
 	playing = true;
 
-	const Tables *tables = &Tables::getInstance();
-
 	int key = partial->getPoly()->getKey();
 	int velocity = partial->getPoly()->getVelocity();
 
@@ -168,7 +176,7 @@ void TVA::reset(const Part *newPart, const TimbreParam::PartialParam *newPartial
 	biasAmpSubtraction = calcBiasAmpSubtractions(partialParam, key);
 	veloAmpSubtraction = calcVeloAmpSubtraction(partialParam->tva.veloSensitivity, velocity);
 
-	int newTarget = calcBasicAmp(tables, partial, system, partialParam, part->getVolume(), newRhythmTemp, biasAmpSubtraction, veloAmpSubtraction, part->getExpression(), partial->getSynth()->controlROMFeatures->quirkRingModulationNoMix);
+	int newTarget = calcBasicAmp(partial, system, partialParam, part->getVolume(), newRhythmTemp, biasAmpSubtraction, veloAmpSubtraction, part->getExpression(), partial->getSynth()->controlROMFeatures->quirkRingModulationNoMix);
 	int newPhase;
 	if (partialParam->tva.envTime[0] == 0) {
 		// Initially go to the TVA_PHASE_ATTACK target amp, and spend the next phase going from there to the TVA_PHASE_2 target amp
@@ -219,8 +227,7 @@ void TVA::recalcSustain() {
 		return;
 	}
 	// We're sustaining. Recalculate all the values
-	const Tables *tables = &Tables::getInstance();
-	int newTarget = calcBasicAmp(tables, partial, system, partialParam, part->getVolume(), rhythmTemp, biasAmpSubtraction, veloAmpSubtraction, part->getExpression(), partial->getSynth()->controlROMFeatures->quirkRingModulationNoMix);
+	int newTarget = calcBasicAmp(partial, system, partialParam, part->getVolume(), rhythmTemp, biasAmpSubtraction, veloAmpSubtraction, part->getExpression(), partial->getSynth()->controlROMFeatures->quirkRingModulationNoMix);
 	newTarget += partialParam->tva.envLevel[3];
 
 	// Although we're in TVA_PHASE_SUSTAIN at this point, we cannot be sure that there is no active ramp at the moment.
@@ -235,9 +242,9 @@ void TVA::recalcSustain() {
 	Bit8u newIncrement;
 	bool descending = targetDelta < 0;
 	if (!descending) {
-		newIncrement = tables->envLogarithmicTime[Bit8u(targetDelta)] - 2;
+		newIncrement = envLogarithmicTime[Bit8u(targetDelta)] - 2;
 	} else {
-		newIncrement = (tables->envLogarithmicTime[Bit8u(-targetDelta)] - 2) | 0x80;
+		newIncrement = (envLogarithmicTime[Bit8u(-targetDelta)] - 2) | 0x80;
 	}
 	if (part->getSynth()->isNiceAmpRampEnabled() && (descending != ampRamp->isBelowCurrent(newTarget))) {
 		newIncrement ^= 0x80;
@@ -256,8 +263,6 @@ int TVA::getPhase() const {
 }
 
 void TVA::nextPhase() {
-	const Tables *tables = &Tables::getInstance();
-
 	if (phase >= TVA_PHASE_DEAD || !playing) {
 		partial->getSynth()->printDebug("TVA::nextPhase(): Shouldn't have got here with phase %d, playing=%s", phase, playing ? "true" : "false");
 		return;
@@ -293,7 +298,7 @@ void TVA::nextPhase() {
 	int envPointIndex = phase;
 
 	if (!allLevelsZeroFromNowOn) {
-		newTarget = calcBasicAmp(tables, partial, system, partialParam, part->getVolume(), rhythmTemp, biasAmpSubtraction, veloAmpSubtraction, part->getExpression(), partial->getSynth()->controlROMFeatures->quirkRingModulationNoMix);
+		newTarget = calcBasicAmp(partial, system, partialParam, part->getVolume(), rhythmTemp, biasAmpSubtraction, veloAmpSubtraction, part->getExpression(), partial->getSynth()->controlROMFeatures->quirkRingModulationNoMix);
 
 		if (newPhase == TVA_PHASE_SUSTAIN || newPhase == TVA_PHASE_RELEASE) {
 			if (partialParam->tva.envLevel[3] == 0) {
@@ -352,14 +357,14 @@ void TVA::nextPhase() {
 					}
 				}
 				targetDelta = -targetDelta;
-				newIncrement = tables->envLogarithmicTime[Bit8u(targetDelta)] - envTimeSetting;
+				newIncrement = envLogarithmicTime[Bit8u(targetDelta)] - envTimeSetting;
 				if (newIncrement <= 0) {
 					newIncrement = 1;
 				}
 				newIncrement = newIncrement | 0x80;
 			} else {
 				// FIXME: The last 22 or so entries in this table are 128 - surely that fucks things up, since that ends up being -128 signed?
-				newIncrement = tables->envLogarithmicTime[Bit8u(targetDelta)] - envTimeSetting;
+				newIncrement = envLogarithmicTime[Bit8u(targetDelta)] - envTimeSetting;
 				if (newIncrement <= 0) {
 					newIncrement = 1;
 				}
diff --git a/audio/softsynth/mt32/TVA.h b/audio/softsynth/mt32/TVA.h
index 415909be826..06bbbceb7bb 100644
--- a/audio/softsynth/mt32/TVA.h
+++ b/audio/softsynth/mt32/TVA.h
@@ -27,6 +27,7 @@ namespace MT32Emu {
 class LA32Ramp;
 class Part;
 class Partial;
+struct Tables;
 
 // Note that when entering nextPhase(), newPhase is set to phase + 1, and the descriptions/names below refer to
 // newPhase's value.
@@ -83,6 +84,8 @@ private:
 	void nextPhase();
 
 public:
+	static void initTables(const Tables &tables);
+
 	TVA(const Partial *partial, LA32Ramp *ampRamp);
 	void reset(const Part *part, const TimbreParam::PartialParam *partialParam, const MemParams::RhythmTemp *rhythmTemp);
 	void handleInterrupt();
diff --git a/audio/softsynth/mt32/TVF.cpp b/audio/softsynth/mt32/TVF.cpp
index 47ce0a93655..99b01f40339 100644
--- a/audio/softsynth/mt32/TVF.cpp
+++ b/audio/softsynth/mt32/TVF.cpp
@@ -53,6 +53,8 @@ enum {
 	PHASE_DONE = 7
 };
 
+static const Bit8u *envLogarithmicTime;
+
 static int calcBaseCutoff(const TimbreParam::PartialParam *partialParam, Bit32u basePitch, unsigned int key, bool quirkTVFBaseCutoffLimit) {
 	// This table matches the values used by a real LAPC-I.
 	static const Bit8s biasLevelToBiasMult[] = {85, 42, 21, 16, 10, 5, 2, 0, -2, -5, -10, -16, -21, -74, -85};
@@ -108,6 +110,10 @@ static int calcBaseCutoff(const TimbreParam::PartialParam *partialParam, Bit32u
 	return Bit8u(baseCutoff);
 }
 
+void TVF::initTables(const Tables &tables) {
+	envLogarithmicTime = tables.envLogarithmicTime;
+}
+
 TVF::TVF(const Partial *usePartial, LA32Ramp *useCutoffModifierRamp) :
 	partial(usePartial), cutoffModifierRamp(useCutoffModifierRamp) {
 }
@@ -127,8 +133,6 @@ void TVF::reset(const TimbreParam::PartialParam *newPartialParam, unsigned int b
 	unsigned int key = partial->getPoly()->getKey();
 	unsigned int velocity = partial->getPoly()->getVelocity();
 
-	const Tables *tables = &Tables::getInstance();
-
 	baseCutoff = calcBaseCutoff(newPartialParam, basePitch, key, partial->getSynth()->controlROMFeatures->quirkTVFBaseCutoffLimit);
 #if MT32EMU_MONITOR_TVF >= 1
 	partial->getSynth()->printDebug("[+%lu] [Partial %d] TVF,base,%d", partial->debugGetSampleNum(), partial->debugGetPartialNum(), baseCutoff);
@@ -160,7 +164,7 @@ void TVF::reset(const TimbreParam::PartialParam *newPartialParam, unsigned int b
 	if (envTimeSetting <= 0) {
 		newIncrement = (0x80 | 127);
 	} else {
-		newIncrement = tables->envLogarithmicTime[newTarget] - envTimeSetting;
+		newIncrement = envLogarithmicTime[newTarget] - envTimeSetting;
 		if (newIncrement <= 0) {
 			newIncrement = 1;
 		}
@@ -189,7 +193,6 @@ void TVF::startDecay() {
 }
 
 void TVF::nextPhase() {
-	const Tables *tables = &Tables::getInstance();
 	int newPhase = phase + 1;
 
 	switch (newPhase) {
@@ -226,7 +229,7 @@ void TVF::nextPhase() {
 				newTarget--;
 			}
 		}
-		newIncrement = tables->envLogarithmicTime[targetDelta < 0 ? -targetDelta : targetDelta] - envTimeSetting;
+		newIncrement = envLogarithmicTime[targetDelta < 0 ? -targetDelta : targetDelta] - envTimeSetting;
 		if (newIncrement <= 0) {
 			newIncrement = 1;
 		}
diff --git a/audio/softsynth/mt32/TVF.h b/audio/softsynth/mt32/TVF.h
index 1b766e8ed63..3237fbafdaa 100644
--- a/audio/softsynth/mt32/TVF.h
+++ b/audio/softsynth/mt32/TVF.h
@@ -26,6 +26,7 @@ namespace MT32Emu {
 
 class LA32Ramp;
 class Partial;
+struct Tables;
 
 class TVF {
 private:
@@ -44,6 +45,8 @@ private:
 	void nextPhase();
 
 public:
+	static void initTables(const Tables &tables);
+
 	TVF(const Partial *partial, LA32Ramp *cutoffModifierRamp);
 	void reset(const TimbreParam::PartialParam *partialParam, Bit32u basePitch);
 	// Returns the base cutoff (without envelope modification).
diff --git a/audio/softsynth/mt32/TVP.cpp b/audio/softsynth/mt32/TVP.cpp
index 9921f3a4d99..05ddfe10d97 100644
--- a/audio/softsynth/mt32/TVP.cpp
+++ b/audio/softsynth/mt32/TVP.cpp
@@ -29,17 +29,17 @@
 namespace MT32Emu {
 
 // FIXME: Add Explanation
-static Bit16u lowerDurationToDivisor[] = {34078, 37162, 40526, 44194, 48194, 52556, 57312, 62499};
+static const Bit16u lowerDurationToDivisor[] = {34078, 37162, 40526, 44194, 48194, 52556, 57312, 62499};
 
 // These values represent unique options with no consistent pattern, so we have to use something like a table in any case.
 // The table matches exactly what the manual claims (when divided by 8192):
 // -1, -1/2, -1/4, 0, 1/8, 1/4, 3/8, 1/2, 5/8, 3/4, 7/8, 1, 5/4, 3/2, 2, s1, s2
 // ...except for the last two entries, which are supposed to be "1 cent above 1" and "2 cents above 1", respectively. They can only be roughly approximated with this integer math.
-static Bit16s pitchKeyfollowMult[] = {-8192, -4096, -2048, 0, 1024, 2048, 3072, 4096, 5120, 6144, 7168, 8192, 10240, 12288, 16384, 8198, 8226};
+static const Bit16s pitchKeyfollowMult[] = {-8192, -4096, -2048, 0, 1024, 2048, 3072, 4096, 5120, 6144, 7168, 8192, 10240, 12288, 16384, 8198, 8226};
 
 // Note: Keys < 60 use keyToPitchTable[60 - key], keys >= 60 use keyToPitchTable[key - 60].
 // FIXME: This table could really be shorter, since we never use e.g. key 127.
-static Bit16u keyToPitchTable[] = {
+static const Bit16u keyToPitchTable[] = {
 	    0,   341,   683,  1024,  1365,  1707,  2048,  2389,
 	 2731,  3072,  3413,  3755,  4096,  4437,  4779,  5120,
 	 5461,  5803,  6144,  6485,  6827,  7168,  7509,  7851,
diff --git a/audio/softsynth/mt32/Tables.cpp b/audio/softsynth/mt32/Tables.cpp
index dff042d2066..6ed664a2331 100644
--- a/audio/softsynth/mt32/Tables.cpp
+++ b/audio/softsynth/mt32/Tables.cpp
@@ -91,7 +91,7 @@ Tables::Tables() {
 
 	// found from sample analysis
 	static const Bit8u resAmpDecayFactorTable[] = {31, 16, 12, 8, 5, 3, 2, 1};
-	resAmpDecayFactor = resAmpDecayFactorTable;
+	resAmpDecayFactors = resAmpDecayFactorTable;
 }
 
 } // namespace MT32Emu
diff --git a/audio/softsynth/mt32/Tables.h b/audio/softsynth/mt32/Tables.h
index 2f90532153c..f8d5b217497 100644
--- a/audio/softsynth/mt32/Tables.h
+++ b/audio/softsynth/mt32/Tables.h
@@ -23,13 +23,9 @@
 
 namespace MT32Emu {
 
-class Tables {
-private:
-	Tables();
-	Tables(Tables &);
-	~Tables() {}
-
-public:
+struct Tables {
+	// Ensures a singleton that is immutable yet guaranteed to be initialised orderly.
+	// However, this normally adds some performance penalty, so it should be avoided on the critical path.
 	static const Tables &getInstance();
 
 	// Constant LUTs
@@ -54,8 +50,14 @@ public:
 	Bit16u exp9[512];
 	Bit16u logsin9[512];
 
-	const Bit8u *resAmpDecayFactor;
-}; // class Tables
+	const Bit8u *resAmpDecayFactors;
+
+private:
+	Tables();
+	Tables(const Tables &);
+	~Tables() {}
+	Tables &operator=(const Tables &);
+}; // struct Tables
 
 } // namespace MT32Emu
 
diff --git a/audio/softsynth/mt32/VersionTagging.cpp b/audio/softsynth/mt32/VersionTagging.cpp
index 0a3388f3bf9..10607dee5c1 100644
--- a/audio/softsynth/mt32/VersionTagging.cpp
+++ b/audio/softsynth/mt32/VersionTagging.cpp
@@ -17,6 +17,9 @@
 
 #include "globals.h"
 
+#undef MT32EMU_EXPORT_V
+#define MT32EMU_EXPORT_V(symbol_version_tag) MT32EMU_EXPORT_ATTRIBUTE
+
 extern "C" {
 // Here's a list of all tagged minor library versions through global (potentially versioned) symbols.
 // An application that's been linked with an older library version will be able to find a matching tag,
@@ -25,8 +28,9 @@ extern "C" {
 MT32EMU_EXPORT_V(2.5) extern const volatile char mt32emu_2_5 = 0;
 MT32EMU_EXPORT_V(2.6) extern const volatile char mt32emu_2_6 = 0;
 MT32EMU_EXPORT_V(2.7) extern const volatile char mt32emu_2_7 = 0;
+MT32EMU_EXPORT_V(2.8) extern const volatile char mt32emu_2_8 = 0;
 
-#if MT32EMU_VERSION_MAJOR > 2 || MT32EMU_VERSION_MINOR > 7
+#if MT32EMU_VERSION_MAJOR > 2 || MT32EMU_VERSION_MINOR > 8
 #error "Missing version tag definition for current library version"
 #endif
 }
diff --git a/audio/softsynth/mt32/VersionTagging.h b/audio/softsynth/mt32/VersionTagging.h
index df211f3c065..5d79f9c0045 100644
--- a/audio/softsynth/mt32/VersionTagging.h
+++ b/audio/softsynth/mt32/VersionTagging.h
@@ -34,6 +34,9 @@
 #define MT32EMU_BUILD_VERSION_TAG(major, minor) MT32EMU_REALLY_BUILD_VERSION_TAG(major, minor)
 #define MT32EMU_VERSION_TAG MT32EMU_BUILD_VERSION_TAG(MT32EMU_VERSION_MAJOR, MT32EMU_VERSION_MINOR)
 
+#undef MT32EMU_EXPORT
+#define MT32EMU_EXPORT MT32EMU_EXPORT_ATTRIBUTE
+
 #if defined(__cplusplus)
 
 extern "C" {
diff --git a/audio/softsynth/mt32/c_interface/c_interface.cpp b/audio/softsynth/mt32/c_interface/c_interface.cpp
index d7612a28d32..9fc5e740bfd 100644
--- a/audio/softsynth/mt32/c_interface/c_interface.cpp
+++ b/audio/softsynth/mt32/c_interface/c_interface.cpp
@@ -1,5 +1,5 @@
 /* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
- * Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ * Copyright (C) 2011-2026 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
@@ -43,7 +43,7 @@ static mt32emu_service_version MT32EMU_C_CALL getSynthVersionID(mt32emu_service_
 	return MT32EMU_SERVICE_VERSION_CURRENT;
 }
 
-static const mt32emu_service_i_v6 SERVICE_VTABLE = {
+static const mt32emu_service_i_v7 SERVICE_VTABLE = {
 	getSynthVersionID,
 	mt32emu_get_supported_report_handler_version,
 	mt32emu_get_supported_midi_receiver_version,
@@ -136,13 +136,17 @@ static const mt32emu_service_i_v6 SERVICE_VTABLE = {
 	mt32emu_set_part_volume_override,
 	mt32emu_get_part_volume_override,
 	mt32emu_get_sound_group_name,
-	mt32emu_get_sound_name
+	mt32emu_get_sound_name,
+	mt32emu_set_master_volume_override,
+	mt32emu_get_master_volume_override,
+	mt32emu_dump_sysex_bank,
+	mt32emu_apply_sysex_bank
 };
 
 } // namespace MT32Emu
 
 struct mt32emu_data {
-	ReportHandler2 *reportHandler;
+	ReportHandler3 *reportHandler;
 	Synth *synth;
 	const ROMImage *controlROMImage;
 	const ROMImage *pcmROMImage;
@@ -156,7 +160,7 @@ struct mt32emu_data {
 
 namespace MT32Emu {
 
-class DelegatingReportHandlerAdapter : public ReportHandler2 {
+class DelegatingReportHandlerAdapter : public ReportHandler3 {
 public:
 	DelegatingReportHandlerAdapter(mt32emu_report_handler_i useReportHandler, void *useInstanceData) :
 		delegate(useReportHandler), instanceData(useInstanceData) {}
@@ -169,7 +173,7 @@ private:
 		return delegate.v0->getVersionID(delegate) < versionID;
 	}
 
-	void printDebug(const char *fmt, va_list list) override {
+	void printDebug(const char *fmt, va_list list) {
 		if (delegate.v0->printDebug == NULL) {
 			ReportHandler::printDebug(fmt, list);
 		} else {
@@ -177,7 +181,7 @@ private:
 		}
 	}
 
-	void onErrorControlROM() override {
+	void onErrorControlROM() {
 		if (delegate.v0->onErrorControlROM == NULL) {
 			ReportHandler::onErrorControlROM();
 		} else {
@@ -185,7 +189,7 @@ private:
 		}
 	}
 
-	void onErrorPCMROM() override {
+	void onErrorPCMROM() {
 		if (delegate.v0->onErrorPCMROM == NULL) {
 			ReportHandler::onErrorPCMROM();
 		} else {
@@ -193,7 +197,7 @@ private:
 		}
 	}
 
-	void showLCDMessage(const char *message) override {
+	void showLCDMessage(const char *message) {
 		if (delegate.v0->showLCDMessage == NULL) {
 			ReportHandler::showLCDMessage(message);
 		} else {
@@ -201,7 +205,7 @@ private:
 		}
 	}
 
-	void onMIDIMessagePlayed() override {
+	void onMIDIMessagePlayed() {
 		if (delegate.v0->onMIDIMessagePlayed == NULL) {
 			ReportHandler::onMIDIMessagePlayed();
 		} else {
@@ -209,14 +213,14 @@ private:
 		}
 	}
 
-	bool onMIDIQueueOverflow() override {
+	bool onMIDIQueueOverflow() {
 		if (delegate.v0->onMIDIQueueOverflow == NULL) {
 			return ReportHandler::onMIDIQueueOverflow();
 		}
 		return delegate.v0->onMIDIQueueOverflow(instanceData) != MT32EMU_BOOL_FALSE;
 	}
 
-	void onMIDISystemRealtime(Bit8u systemRealtime) override {
+	void onMIDISystemRealtime(Bit8u systemRealtime) {
 		if (delegate.v0->onMIDISystemRealtime == NULL) {
 			ReportHandler::onMIDISystemRealtime(systemRealtime);
 		} else {
@@ -224,7 +228,7 @@ private:
 		}
 	}
 
-	void onDeviceReset() override {
+	void onDeviceReset() {
 		if (delegate.v0->onDeviceReset == NULL) {
 			ReportHandler::onDeviceReset();
 		} else {
@@ -232,7 +236,7 @@ private:
 		}
 	}
 
-	void onDeviceReconfig() override {
+	void onDeviceReconfig() {
 		if (delegate.v0->onDeviceReconfig == NULL) {
 			ReportHandler::onDeviceReconfig();
 		} else {
@@ -240,7 +244,7 @@ private:
 		}
 	}
 
-	void onNewReverbMode(Bit8u mode) override {
+	void onNewReverbMode(Bit8u mode) {
 		if (delegate.v0->onNewReverbMode == NULL) {
 			ReportHandler::onNewReverbMode(mode);
 		} else {
@@ -248,7 +252,7 @@ private:
 		}
 	}
 
-	void onNewReverbTime(Bit8u time) override {
+	void onNewReverbTime(Bit8u time) {
 		if (delegate.v0->onNewReverbTime == NULL) {
 			ReportHandler::onNewReverbTime(time);
 		} else {
@@ -256,7 +260,7 @@ private:
 		}
 	}
 
-	void onNewReverbLevel(Bit8u level) override {
+	void onNewReverbLevel(Bit8u level) {
 		if (delegate.v0->onNewReverbLevel == NULL) {
 			ReportHandler::onNewReverbLevel(level);
 		} else {
@@ -264,7 +268,7 @@ private:
 		}
 	}
 
-	void onPolyStateChanged(Bit8u partNum) override {
+	void onPolyStateChanged(Bit8u partNum) {
 		if (delegate.v0->onPolyStateChanged == NULL) {
 			ReportHandler::onPolyStateChanged(partNum);
 		} else {
@@ -272,7 +276,7 @@ private:
 		}
 	}
 
-	void onProgramChanged(Bit8u partNum, const char *soundGroupName, const char *patchName) override {
+	void onProgramChanged(Bit8u partNum, const char *soundGroupName, const char *patchName) {
 		if (delegate.v0->onProgramChanged == NULL) {
 			ReportHandler::onProgramChanged(partNum, soundGroupName, patchName);
 		} else {
@@ -280,7 +284,7 @@ private:
 		}
 	}
 
-	void onLCDStateUpdated() override {
+	void onLCDStateUpdated() {
 		if (isVersionLess(MT32EMU_REPORT_HANDLER_VERSION_1) || delegate.v1->onLCDStateUpdated == NULL) {
 			ReportHandler2::onLCDStateUpdated();
 		} else {
@@ -288,13 +292,29 @@ private:
 		}
 	}
 
-	void onMidiMessageLEDStateUpdated(bool ledState) override {
+	void onMidiMessageLEDStateUpdated(bool ledState) {
 		if (isVersionLess(MT32EMU_REPORT_HANDLER_VERSION_1) || delegate.v1->onMidiMessageLEDStateUpdated == NULL) {
 			ReportHandler2::onMidiMessageLEDStateUpdated(ledState);
 		} else {
 			delegate.v1->onMidiMessageLEDStateUpdated(instanceData, ledState ? MT32EMU_BOOL_TRUE : MT32EMU_BOOL_FALSE);
 		}
 	}
+
+	void onNoteOnIgnored(Bit32u partialsNeeded, Bit32u partialsFree) {
+		if (isVersionLess(MT32EMU_REPORT_HANDLER_VERSION_2) || delegate.v2->onNoteOnIgnored == NULL) {
+			ReportHandler3::onNoteOnIgnored(partialsNeeded, partialsFree);
+		} else {
+			delegate.v2->onNoteOnIgnored(instanceData, partialsNeeded, partialsFree);
+		}
+	}
+
+	void onPlayingPolySilenced(Bit32u partialsNeeded, Bit32u partialsFree) {
+		if (isVersionLess(MT32EMU_REPORT_HANDLER_VERSION_2) || delegate.v2->onPlayingPolySilenced == NULL) {
+			ReportHandler3::onPlayingPolySilenced(partialsNeeded, partialsFree);
+		} else {
+			delegate.v2->onPlayingPolySilenced(instanceData, partialsNeeded, partialsFree);
+		}
+	}
 };
 
 class DelegatingMidiStreamParser : public DefaultMidiStreamParser {
@@ -307,7 +327,7 @@ protected:
 	void *instanceData;
 
 private:
-	void handleShortMessage(const Bit32u message) override {
+	void handleShortMessage(const Bit32u message) {
 		if (delegate.v0->handleShortMessage == NULL) {
 			DefaultMidiStreamParser::handleShortMessage(message);
 		} else {
@@ -315,7 +335,7 @@ private:
 		}
 	}
 
-	void handleSysex(const Bit8u *stream, const Bit32u length) override {
+	void handleSysex(const Bit8u *stream, const Bit32u length) {
 		if (delegate.v0->handleSysex == NULL) {
 			DefaultMidiStreamParser::handleSysex(stream, length);
 		} else {
@@ -323,7 +343,7 @@ private:
 		}
 	}
 
-	void handleSystemRealtimeMessage(const Bit8u realtime) override {
+	void handleSystemRealtimeMessage(const Bit8u realtime) {
 		if (delegate.v0->handleSystemRealtimeMessage == NULL) {
 			DefaultMidiStreamParser::handleSystemRealtimeMessage(realtime);
 		} else {
@@ -466,7 +486,7 @@ extern "C" {
 
 mt32emu_service_i MT32EMU_C_CALL mt32emu_get_service_i() {
 	mt32emu_service_i i;
-	i.v6 = &SERVICE_VTABLE;
+	i.v7 = &SERVICE_VTABLE;
 	return i;
 }
 
@@ -546,7 +566,7 @@ mt32emu_context MT32EMU_C_CALL mt32emu_create_context(mt32emu_report_handler_i r
 	data->synth = new Synth;
 	if (report_handler.v0 != NULL) {
 		data->reportHandler = new DelegatingReportHandlerAdapter(report_handler, instance_data);
-		data->synth->setReportHandler2(data->reportHandler);
+		data->synth->setReportHandler3(data->reportHandler);
 	} else {
 		data->reportHandler = NULL;
 	}
@@ -779,8 +799,8 @@ void MT32EMU_C_CALL mt32emu_play_msg_now(mt32emu_const_context context, mt32emu_
 	context->synth->playMsgNow(msg);
 }
 
-void MT32EMU_C_CALL mt32emu_play_msg_on_part(mt32emu_const_context context, mt32emu_bit8u part, mt32emu_bit8u code, mt32emu_bit8u note, mt32emu_bit8u velocity) {
-	context->synth->playMsgOnPart(part, code, note, velocity);
+void MT32EMU_C_CALL mt32emu_play_msg_on_part(mt32emu_const_context context, mt32emu_bit8u part_number, mt32emu_bit8u command, mt32emu_bit8u data1, mt32emu_bit8u data2) {
+	context->synth->playMsgOnPart(part_number, command, data1, data2);
 }
 
 void MT32EMU_C_CALL mt32emu_play_sysex_now(mt32emu_const_context context, const mt32emu_bit8u *sysex, mt32emu_bit32u len) {
@@ -791,6 +811,15 @@ void MT32EMU_C_CALL mt32emu_write_sysex(mt32emu_const_context context, mt32emu_b
 	context->synth->writeSysex(channel, sysex, len);
 }
 
+
+mt32emu_bit32u MT32EMU_C_CALL mt32emu_dump_sysex_bank(mt32emu_const_context context, mt32emu_bit8u *sysex_bank, mt32emu_bit32u size) {
+	return context->synth->dumpSysexBank(sysex_bank, size);
+}
+
+mt32emu_bit32u MT32EMU_C_CALL mt32emu_apply_sysex_bank(mt32emu_const_context context, const mt32emu_bit8u *sysex_bank, mt32emu_bit32u size) {
+	return context->synth->applySysexBank(sysex_bank, size);
+}
+
 void MT32EMU_C_CALL mt32emu_set_reverb_enabled(mt32emu_const_context context, const mt32emu_boolean reverb_enabled) {
 	context->synth->setReverbEnabled(reverb_enabled != MT32EMU_BOOL_FALSE);
 }
@@ -855,6 +884,14 @@ float MT32EMU_C_CALL mt32emu_get_reverb_output_gain(mt32emu_const_context contex
 	return context->synth->getReverbOutputGain();
 }
 
+void MT32EMU_C_CALL mt32emu_set_master_volume_override(mt32emu_const_context context, mt32emu_bit8u volume_override) {
+	context->synth->setMasterVolumeOverride(volume_override);
+}
+
+mt32emu_bit8u MT32EMU_C_CALL mt32emu_get_master_volume_override(mt32emu_const_context context) {
+	return context->synth->getMasterVolumeOverride();
+}
+
 void MT32EMU_C_CALL mt32emu_set_part_volume_override(mt32emu_const_context context, mt32emu_bit8u part_number, mt32emu_bit8u volume_override) {
 	context->synth->setPartVolumeOverride(part_number, volume_override);
 }
@@ -980,3 +1017,17 @@ mt32emu_boolean MT32EMU_C_CALL mt32emu_is_default_display_old_mt32_compatible(mt
 }
 
 } // extern "C"
+
+#ifdef MT32EMU_WITH_TESTING
+
+#include "../test/TestAccessors.h"
+
+const MachineConfiguration *Test::findMachineConfiguration(const char *machineID) {
+	return MT32Emu::findMachineConfiguration(machineID);
+}
+
+ReportHandler3 *Test::getReportHandlerDelegate(const mt32emu_data *context) {
+	return context->reportHandler;
+}
+
+#endif // #ifdef MT32EMU_WITH_TESTING
diff --git a/audio/softsynth/mt32/c_interface/c_interface.h b/audio/softsynth/mt32/c_interface/c_interface.h
index 5653c905164..116e6f0ae6a 100644
--- a/audio/softsynth/mt32/c_interface/c_interface.h
+++ b/audio/softsynth/mt32/c_interface/c_interface.h
@@ -1,5 +1,5 @@
 /* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
- * Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ * Copyright (C) 2011-2026 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
@@ -355,32 +355,42 @@ MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_play_short_message(mt32emu_const_cont
  */
 MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_play_short_message_at(mt32emu_const_context context, mt32emu_bit32u message, mt32emu_bit32u timestamp);
 
-/** Enqueues a single short MIDI message to be processed ASAP. The message must contain a status byte. */
+/**
+ * Enqueues a single short MIDI message to be processed ASAP. The message must contain a status byte and one or two data
+ * bytes (as appropriate for the MIDI command).
+ */
 MT32EMU_EXPORT mt32emu_return_code MT32EMU_C_CALL mt32emu_play_msg(mt32emu_const_context context, mt32emu_bit32u msg);
 /** Enqueues a single well formed System Exclusive MIDI message to be processed ASAP. */
 MT32EMU_EXPORT mt32emu_return_code MT32EMU_C_CALL mt32emu_play_sysex(mt32emu_const_context context, const mt32emu_bit8u *sysex, mt32emu_bit32u len);
 
-/** Enqueues a single short MIDI message to play at specified time. The message must contain a status byte. */
+/**
+ * Enqueues a single short MIDI message to play at specified time. The message must contain a status byte and one or two data
+ * bytes (as appropriate for the MIDI command).
+ */
 MT32EMU_EXPORT mt32emu_return_code MT32EMU_C_CALL mt32emu_play_msg_at(mt32emu_const_context context, mt32emu_bit32u msg, mt32emu_bit32u timestamp);
 /** Enqueues a single well formed System Exclusive MIDI message to play at specified time. */
 MT32EMU_EXPORT mt32emu_return_code MT32EMU_C_CALL mt32emu_play_sysex_at(mt32emu_const_context context, const mt32emu_bit8u *sysex, mt32emu_bit32u len, mt32emu_bit32u timestamp);
 
 /* WARNING:
- * The methods below don't ensure minimum 1-sample delay between sequential MIDI events,
- * and a sequence of NoteOn and immediately succeeding NoteOff messages is always silent.
- * A thread that invokes these methods must be explicitly synchronised with the thread performing sample rendering.
+ * The methods below may have no effect while the synth is aborting a poly. They also don't ensure minimum 1-sample delay between
+ * sequential MIDI events, and a sequence of NoteOn and immediately succeeding NoteOff messages is always silent.
+ * A thread that invokes these methods must be explicitly synchronised with the thread performing sample rendering or be the same.
  */
 
 /**
- * Sends a short MIDI message to the synth for immediate playback. The message must contain a status byte.
+ * Sends a short MIDI message to the synth for immediate playback. The message must contain a status byte and one or two data
+ * bytes (as appropriate for the MIDI command), otherwise it is ignored.
  * See the WARNING above.
  */
 MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_play_msg_now(mt32emu_const_context context, mt32emu_bit32u msg);
 /**
- * Sends unpacked short MIDI message to the synth for immediate playback. The message must contain a status byte.
+ * Sends unpacked short MIDI message to the synth for immediate playback. All the message parameters must be within the supported
+ * range, otherwise the message is ignored.
+ * Argument partNumber should be 0..7 for Part 1..8, or 8 for Rhythm.
+ * Argument command should be 8..14 and represents the high 4 bits of the status byte.
  * See the WARNING above.
  */
-MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_play_msg_on_part(mt32emu_const_context context, mt32emu_bit8u part, mt32emu_bit8u code, mt32emu_bit8u note, mt32emu_bit8u velocity);
+MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_play_msg_on_part(mt32emu_const_context context, mt32emu_bit8u part_number, mt32emu_bit8u command, mt32emu_bit8u data1, mt32emu_bit8u data2);
 
 /**
  * Sends a single well formed System Exclusive MIDI message for immediate processing. The length is in bytes.
@@ -393,6 +403,22 @@ MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_play_sysex_now(mt32emu_const_context
  */
 MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_write_sysex(mt32emu_const_context context, mt32emu_bit8u channel, const mt32emu_bit8u *sysex, mt32emu_bit32u len);
 
+/**
+ * Stores internal state of the emulated synth into the provided array. The messages within the SysEx bank are ordered so that
+ * they can be replayed back in the same sequence without data loss, provided that the given array has sufficient size.
+ * The SysEx messages written in the array can be re-played using applySysexBank() function or even sent to a real device.
+ * Returns the full length of the SysEx bank in bytes that is needed to fit all the available data.
+ * This function can be used to retrieve the required size of the SysEx bank by supplying NULL sysexBank or zero size arguments,
+ * in which case it does nothing else.
+ */
+MT32EMU_EXPORT_V(2.8) mt32emu_bit32u MT32EMU_C_CALL mt32emu_dump_sysex_bank(mt32emu_const_context context, mt32emu_bit8u *sysex_bank, mt32emu_bit32u size);
+/**
+ * Applies the content of the given SysEx bank to the emulated synth from the provided array. All complete SysEx messages
+ * contained within the sysexBank are played in sequence, any other data is ignored.
+ * Returns the number of played SysEx messages.
+ */
+MT32EMU_EXPORT_V(2.8) mt32emu_bit32u MT32EMU_C_CALL mt32emu_apply_sysex_bank(mt32emu_const_context context, const mt32emu_bit8u *sysex_bank, mt32emu_bit32u size);
+
 /** Allows to disable wet reverb output altogether. */
 MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_set_reverb_enabled(mt32emu_const_context context, const mt32emu_boolean reverb_enabled);
 /** Returns whether wet reverb output is enabled. */
@@ -457,6 +483,20 @@ MT32EMU_EXPORT void MT32EMU_C_CALL mt32emu_set_reverb_output_gain(mt32emu_const_
 /** Returns current output gain factor for reverb wet output channels. */
 MT32EMU_EXPORT float MT32EMU_C_CALL mt32emu_get_reverb_output_gain(mt32emu_const_context context);
 
+/**
+ * Sets or removes an override for the Master Volume. When the Master Volume is overridden, a SysEx write to the system area
+ * will have no effect on the Master Volume setting, yet a system memory read will return the overridden Master Volume.
+ * To enable the override mode, argument volume_override should be in range 0..100. Setting a value outside this range
+ * disables the override mode allowing the Master Volume to change further on (without changing the current volume).
+ * This setting persists synth reopening.
+ */
+MT32EMU_EXPORT_V(2.8) void MT32EMU_C_CALL mt32emu_set_master_volume_override(mt32emu_const_context context, mt32emu_bit8u volume_override);
+/**
+ * Returns the overridden master volume previously set, if any; a value outside the range 0..100 means no override
+ * is currently in effect.
+ */
+MT32EMU_EXPORT_V(2.8) mt32emu_bit8u MT32EMU_C_CALL mt32emu_get_master_volume_override(mt32emu_const_context context);
+
 /**
  * Sets (or removes) an override for the current volume (output level) on a specific part.
  * When the part volume is overridden, the MIDI controller Volume (7) on the MIDI channel this part is assigned to
@@ -638,7 +678,7 @@ MT32EMU_EXPORT_V(2.6) mt32emu_boolean MT32EMU_C_CALL mt32emu_is_display_old_mt32
 MT32EMU_EXPORT_V(2.6) mt32emu_boolean MT32EMU_C_CALL mt32emu_is_default_display_old_mt32_compatible(mt32emu_const_context context);
 
 #ifdef __cplusplus
-} // extern "C"
+} /* extern "C" */
 #endif
 
 #endif /* #ifndef MT32EMU_C_INTERFACE_H */
diff --git a/audio/softsynth/mt32/c_interface/c_types.h b/audio/softsynth/mt32/c_interface/c_types.h
index 8928bfeae3b..f81ff782c90 100644
--- a/audio/softsynth/mt32/c_interface/c_types.h
+++ b/audio/softsynth/mt32/c_interface/c_types.h
@@ -1,5 +1,5 @@
 /* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
- * Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ * Copyright (C) 2011-2026 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
@@ -118,7 +118,8 @@ typedef struct {
 typedef enum {
 	MT32EMU_REPORT_HANDLER_VERSION_0 = 0,
 	MT32EMU_REPORT_HANDLER_VERSION_1 = 1,
-	MT32EMU_REPORT_HANDLER_VERSION_CURRENT = MT32EMU_REPORT_HANDLER_VERSION_1
+	MT32EMU_REPORT_HANDLER_VERSION_2 = 2,
+	MT32EMU_REPORT_HANDLER_VERSION_CURRENT = MT32EMU_REPORT_HANDLER_VERSION_2
 } mt32emu_report_handler_version;
 
 /** MIDI receiver interface versions */
@@ -136,7 +137,8 @@ typedef enum {
 	MT32EMU_SERVICE_VERSION_4 = 4,
 	MT32EMU_SERVICE_VERSION_5 = 5,
 	MT32EMU_SERVICE_VERSION_6 = 6,
-	MT32EMU_SERVICE_VERSION_CURRENT = MT32EMU_SERVICE_VERSION_6
+	MT32EMU_SERVICE_VERSION_7 = 7,
+	MT32EMU_SERVICE_VERSION_CURRENT = MT32EMU_SERVICE_VERSION_7
 } mt32emu_service_version;
 
 /* === Report Handler Interface === */
@@ -188,6 +190,17 @@ typedef union mt32emu_report_handler_i mt32emu_report_handler_i;
 	/** Invoked when the emulated MIDI MESSAGE LED changes state. The led_state parameter represents whether the LED is ON. */ \
 	void (MT32EMU_C_CALL *onMidiMessageLEDStateUpdated)(void *instance_data, mt32emu_boolean led_state);
 
+#define MT32EMU_REPORT_HANDLER_I_V2 \
+	/**
+	 * Invoked in case the NoteOn MIDI message currently being processed cannot be played due to insufficient free partials.
+	 */ \
+	void (MT32EMU_C_CALL *onNoteOnIgnored)(void *instance_data, mt32emu_bit32u partials_needed, mt32emu_bit32u partials_free); \
+	/**
+	 * Invoked in case the partial allocator starts premature silencing a currently playing poly to free partials necessary
+	 * for processing the preceding NoteOn MIDI message.
+	 */ \
+	void (MT32EMU_C_CALL *onPlayingPolySilenced)(void *instance_data, mt32emu_bit32u partials_needed, mt32emu_bit32u partials_free);
+
 typedef struct {
 	MT32EMU_REPORT_HANDLER_I_V0
 } mt32emu_report_handler_i_v0;
@@ -197,6 +210,12 @@ typedef struct {
 	MT32EMU_REPORT_HANDLER_I_V1
 } mt32emu_report_handler_i_v1;
 
+typedef struct {
+	MT32EMU_REPORT_HANDLER_I_V0
+	MT32EMU_REPORT_HANDLER_I_V1
+	MT32EMU_REPORT_HANDLER_I_V2
+} mt32emu_report_handler_i_v2;
+
 /**
  * Extensible interface for handling reported events.
  * Union intended to view an interface of any subsequent version as any parent interface not requiring a cast.
@@ -205,10 +224,12 @@ typedef struct {
 union mt32emu_report_handler_i {
 	const mt32emu_report_handler_i_v0 *v0;
 	const mt32emu_report_handler_i_v1 *v1;
+	const mt32emu_report_handler_i_v2 *v2;
 };
 
 #undef MT32EMU_REPORT_HANDLER_I_V0
 #undef MT32EMU_REPORT_HANDLER_I_V1
+#undef MT32EMU_REPORT_HANDLER_I_V2
 
 /* === MIDI Receiver Interface === */
 
@@ -285,7 +306,7 @@ typedef union mt32emu_service_i mt32emu_service_i;
 	mt32emu_return_code (MT32EMU_C_CALL *playSysexAt)(mt32emu_const_context context, const mt32emu_bit8u *sysex, mt32emu_bit32u len, mt32emu_bit32u timestamp); \
 \
 	void (MT32EMU_C_CALL *playMsgNow)(mt32emu_const_context context, mt32emu_bit32u msg); \
-	void (MT32EMU_C_CALL *playMsgOnPart)(mt32emu_const_context context, mt32emu_bit8u part, mt32emu_bit8u code, mt32emu_bit8u note, mt32emu_bit8u velocity); \
+	void (MT32EMU_C_CALL *playMsgOnPart)(mt32emu_const_context context, mt32emu_bit8u part_number, mt32emu_bit8u command, mt32emu_bit8u data1, mt32emu_bit8u data2); \
 	void (MT32EMU_C_CALL *playSysexNow)(mt32emu_const_context context, const mt32emu_bit8u *sysex, mt32emu_bit32u len); \
 	void (MT32EMU_C_CALL *writeSysex)(mt32emu_const_context context, mt32emu_bit8u channel, const mt32emu_bit8u *sysex, mt32emu_bit32u len); \
 \
@@ -370,6 +391,12 @@ typedef union mt32emu_service_i mt32emu_service_i;
 	mt32emu_boolean (MT32EMU_C_CALL *getSoundGroupName)(mt32emu_const_context context, char *sound_group_name, mt32emu_bit8u timbre_group, mt32emu_bit8u timbre_number); \
 	mt32emu_boolean (MT32EMU_C_CALL *getSoundName)(mt32emu_const_context context, char *sound_name, mt32emu_bit8u timbre_group, mt32emu_bit8u timbre_number);
 
+#define MT32EMU_SERVICE_I_V7 \
+	void (MT32EMU_C_CALL *setMasterVolumeOverride)(mt32emu_const_context context, mt32emu_bit8u volume_override); \
+	mt32emu_bit8u (MT32EMU_C_CALL *getMasterVolumeOverride)(mt32emu_const_context context); \
+	mt32emu_bit32u (MT32EMU_C_CALL *dumpSysexBank)(mt32emu_const_context context, mt32emu_bit8u *sysex_bank, mt32emu_bit32u size); \
+	mt32emu_bit32u (MT32EMU_C_CALL *applySysexBank)(mt32emu_const_context context, const mt32emu_bit8u *sysex_bank, mt32emu_bit32u size);
+
 typedef struct {
 	MT32EMU_SERVICE_I_V0
 } mt32emu_service_i_v0;
@@ -419,6 +446,17 @@ typedef struct {
 	MT32EMU_SERVICE_I_V6
 } mt32emu_service_i_v6;
 
+typedef struct {
+	MT32EMU_SERVICE_I_V0
+	MT32EMU_SERVICE_I_V1
+	MT32EMU_SERVICE_I_V2
+	MT32EMU_SERVICE_I_V3
+	MT32EMU_SERVICE_I_V4
+	MT32EMU_SERVICE_I_V5
+	MT32EMU_SERVICE_I_V6
+	MT32EMU_SERVICE_I_V7
+} mt32emu_service_i_v7;
+
 /**
  * Extensible interface for all the library services.
  * Union intended to view an interface of any subsequent version as any parent interface not requiring a cast.
@@ -432,6 +470,7 @@ union mt32emu_service_i {
 	const mt32emu_service_i_v4 *v4;
 	const mt32emu_service_i_v5 *v5;
 	const mt32emu_service_i_v6 *v6;
+	const mt32emu_service_i_v7 *v7;
 };
 
 #undef MT32EMU_SERVICE_I_V0
@@ -441,5 +480,6 @@ union mt32emu_service_i {
 #undef MT32EMU_SERVICE_I_V4
 #undef MT32EMU_SERVICE_I_V5
 #undef MT32EMU_SERVICE_I_V6
+#undef MT32EMU_SERVICE_I_V7
 
 #endif /* #ifndef MT32EMU_C_TYPES_H */
diff --git a/audio/softsynth/mt32/c_interface/cpp_interface.h b/audio/softsynth/mt32/c_interface/cpp_interface.h
index d22897b7426..4ecd055f9fb 100644
--- a/audio/softsynth/mt32/c_interface/cpp_interface.h
+++ b/audio/softsynth/mt32/c_interface/cpp_interface.h
@@ -1,5 +1,5 @@
 /* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
- * Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ * Copyright (C) 2011-2026 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
@@ -82,6 +82,8 @@ mt32emu_service_i mt32emu_get_service_i();
 #define mt32emu_play_msg_on_part i.v0->playMsgOnPart
 #define mt32emu_play_sysex_now i.v0->playSysexNow
 #define mt32emu_write_sysex i.v0->writeSysex
+#define mt32emu_dump_sysex_bank iV7()->dumpSysexBank
+#define mt32emu_apply_sysex_bank iV7()->applySysexBank
 #define mt32emu_set_reverb_enabled i.v0->setReverbEnabled
 #define mt32emu_is_reverb_enabled i.v0->isReverbEnabled
 #define mt32emu_set_reverb_overridden i.v0->setReverbOverridden
@@ -98,6 +100,8 @@ mt32emu_service_i mt32emu_get_service_i();
 #define mt32emu_get_output_gain i.v0->getOutputGain
 #define mt32emu_set_reverb_output_gain i.v0->setReverbOutputGain
 #define mt32emu_get_reverb_output_gain i.v0->getReverbOutputGain
+#define mt32emu_set_master_volume_override iV7()->setMasterVolumeOverride
+#define mt32emu_get_master_volume_override iV7()->getMasterVolumeOverride
 #define mt32emu_set_part_volume_override iV5()->setPartVolumeOverride
 #define mt32emu_get_part_volume_override iV5()->getPartVolumeOverride
 #define mt32emu_set_reversed_stereo_enabled i.v0->setReversedStereoEnabled
@@ -186,6 +190,17 @@ protected:
 	~IReportHandlerV1() {}
 };
 
+// Extends IReportHandlerV1 for delivering signals about insufficient partials conditions to the client.
+// Corresponds to the mt32emu_report_handler_i_v2 interface.
+class IReportHandlerV2 : public IReportHandlerV1 {
+public:
+	virtual void onNoteOnIgnored(Bit32u partialsNeeded, Bit32u partialsFree) = 0;
+	virtual void onPlayingPolySilenced(Bit32u partialsNeeded, Bit32u partialsFree) = 0;
+
+protected:
+	~IReportHandlerV2() {}
+};
+
 // Defines the interface for receiving MIDI messages generated by MIDI stream parser.
 // Corresponds to the current version of mt32emu_midi_receiver_i interface.
 class IMidiReceiver {
@@ -234,6 +249,7 @@ public:
 	void createContext(mt32emu_report_handler_i report_handler = CppInterfaceImpl::NULL_REPORT_HANDLER, void *instance_data = NULL) { freeContext(); c = mt32emu_create_context(report_handler, instance_data); }
 	void createContext(IReportHandler &report_handler) { createContext(CppInterfaceImpl::getReportHandlerThunk(MT32EMU_REPORT_HANDLER_VERSION_0), &report_handler); }
 	void createContext(IReportHandlerV1 &report_handler) { createContext(CppInterfaceImpl::getReportHandlerThunk(MT32EMU_REPORT_HANDLER_VERSION_1), &report_handler); }
+	void createContext(IReportHandlerV2 &report_handler) { createContext(CppInterfaceImpl::getReportHandlerThunk(MT32EMU_REPORT_HANDLER_VERSION_2), &report_handler); }
 	void freeContext() { if (c != NULL) { mt32emu_free_context(c); c = NULL; } }
 	mt32emu_return_code addROMData(const Bit8u *data, size_t data_size, const mt32emu_sha1_digest *sha1_digest = NULL) { return mt32emu_add_rom_data(c, data, data_size, sha1_digest); }
 	mt32emu_return_code addROMFile(const char *filename) { return mt32emu_add_rom_file(c, filename); }
@@ -275,6 +291,9 @@ public:
 	void playSysexNow(const Bit8u *sysex, Bit32u len) { mt32emu_play_sysex_now(c, sysex, len); }
 	void writeSysex(Bit8u channel, const Bit8u *sysex, Bit32u len) { mt32emu_write_sysex(c, channel, sysex, len); }
 
+	Bit32u dumpSysexBank(Bit8u *sysex_bank, Bit32u size) { return mt32emu_dump_sysex_bank(c, sysex_bank, size); }
+	Bit32u applySysexBank(const Bit8u *sysex_bank, Bit32u size) { return mt32emu_apply_sysex_bank(c, sysex_bank, size); }
+
 	void setReverbEnabled(const bool reverb_enabled) { mt32emu_set_reverb_enabled(c, reverb_enabled ? MT32EMU_BOOL_TRUE : MT32EMU_BOOL_FALSE); }
 	bool isReverbEnabled() { return mt32emu_is_reverb_enabled(c) != MT32EMU_BOOL_FALSE; }
 	void setReverbOverridden(const bool reverb_overridden) { mt32emu_set_reverb_overridden(c, reverb_overridden ? MT32EMU_BOOL_TRUE : MT32EMU_BOOL_FALSE); }
@@ -295,6 +314,9 @@ public:
 	void setReverbOutputGain(float gain) { mt32emu_set_reverb_output_gain(c, gain); }
 	float getReverbOutputGain() { return mt32emu_get_reverb_output_gain(c); }
 
+	void setMasterVolumeOverride(Bit8u volume_override) { mt32emu_set_master_volume_override(c, volume_override); }
+	Bit8u getMasterVolumeOverride() { return mt32emu_get_master_volume_override(c); }
+
 	void setPartVolumeOverride(Bit8u part_number, Bit8u volume_override) { mt32emu_set_part_volume_override(c, part_number, volume_override); }
 	Bit8u getPartVolumeOverride(Bit8u part_number) { return mt32emu_get_part_volume_override(c, part_number); }
 
@@ -346,6 +368,7 @@ private:
 	const mt32emu_service_i_v4 *iV4() { return (getVersionID() < MT32EMU_SERVICE_VERSION_4) ? NULL : i.v4; }
 	const mt32emu_service_i_v5 *iV5() { return (getVersionID() < MT32EMU_SERVICE_VERSION_5) ? NULL : i.v5; }
 	const mt32emu_service_i_v6 *iV6() { return (getVersionID() < MT32EMU_SERVICE_VERSION_6) ? NULL : i.v6; }
+	const mt32emu_service_i_v7 *iV7() { return (getVersionID() < MT32EMU_SERVICE_VERSION_7) ? NULL : i.v7; }
 #endif
 
 	Service(const Service &);            // prevent copy-construction
@@ -420,6 +443,13 @@ static void MT32EMU_C_CALL onMidiMessageLEDStateUpdated(void *instance_data, mt3
 	static_cast<IReportHandlerV1 *>(instance_data)->onMidiMessageLEDStateUpdated(led_state != MT32EMU_BOOL_FALSE);
 }
 
+static void MT32EMU_C_CALL onNoteOnIgnored(void *instance_data, Bit32u partialsNeeded, Bit32u partialsFree) {
+	static_cast<IReportHandlerV2 *>(instance_data)->onNoteOnIgnored(partialsNeeded, partialsFree);
+}
+static void MT32EMU_C_CALL onPlayingPolySilenced(void *instance_data, Bit32u partialsNeeded, Bit32u partialsFree) {
+	static_cast<IReportHandlerV2 *>(instance_data)->onPlayingPolySilenced(partialsNeeded, partialsFree);
+}
+
 #define MT32EMU_REPORT_HANDLER_V0_THUNK \
 	getReportHandlerVersionID, \
 	printDebug, \
@@ -437,27 +467,44 @@ static void MT32EMU_C_CALL onMidiMessageLEDStateUpdated(void *instance_data, mt3
 	onPolyStateChanged, \
 	onProgramChanged
 
+#define MT32EMU_REPORT_HANDLER_V1_THUNK \
+	onLCDStateUpdated, \
+	onMidiMessageLEDStateUpdated
+
+#define MT32EMU_REPORT_HANDLER_V2_THUNK \
+	onNoteOnIgnored, \
+	onPlayingPolySilenced
+
 static const mt32emu_report_handler_i_v0 REPORT_HANDLER_V0_THUNK = {
 	MT32EMU_REPORT_HANDLER_V0_THUNK
 };
 
 static const mt32emu_report_handler_i_v1 REPORT_HANDLER_V1_THUNK = {
 	MT32EMU_REPORT_HANDLER_V0_THUNK,
-	onLCDStateUpdated,
-	onMidiMessageLEDStateUpdated
+	MT32EMU_REPORT_HANDLER_V1_THUNK
+};
+
+static const mt32emu_report_handler_i_v2 REPORT_HANDLER_V2_THUNK = {
+	MT32EMU_REPORT_HANDLER_V0_THUNK,
+	MT32EMU_REPORT_HANDLER_V1_THUNK,
+	MT32EMU_REPORT_HANDLER_V2_THUNK
 };
 
 #undef MT32EMU_REPORT_HANDLER_THUNK_V0
+#undef MT32EMU_REPORT_HANDLER_THUNK_V1
+#undef MT32EMU_REPORT_HANDLER_THUNK_V2
 
 static mt32emu_report_handler_version MT32EMU_C_CALL getReportHandlerVersionID(mt32emu_report_handler_i thunk) {
 	if (thunk.v0 == &REPORT_HANDLER_V0_THUNK) return MT32EMU_REPORT_HANDLER_VERSION_0;
+	if (thunk.v1 == &REPORT_HANDLER_V1_THUNK) return MT32EMU_REPORT_HANDLER_VERSION_1;
 	return MT32EMU_REPORT_HANDLER_VERSION_CURRENT;
 }
 
 static mt32emu_report_handler_i getReportHandlerThunk(mt32emu_report_handler_version versionID) {
 	mt32emu_report_handler_i thunk;
 	if (versionID == MT32EMU_REPORT_HANDLER_VERSION_0) thunk.v0 = &REPORT_HANDLER_V0_THUNK;
-	else thunk.v1 = &REPORT_HANDLER_V1_THUNK;
+	else if (versionID == MT32EMU_REPORT_HANDLER_VERSION_1) thunk.v1 = &REPORT_HANDLER_V1_THUNK;
+	else thunk.v2 = &REPORT_HANDLER_V2_THUNK;
 	return thunk;
 }
 
@@ -543,6 +590,8 @@ static mt32emu_midi_receiver_i getMidiReceiverThunk() {
 #undef mt32emu_play_msg_on_part
 #undef mt32emu_play_sysex_now
 #undef mt32emu_write_sysex
+#undef mt32emu_dump_sysex_bank
+#undef mt32emu_apply_sysex_bank
 #undef mt32emu_set_reverb_enabled
 #undef mt32emu_is_reverb_enabled
 #undef mt32emu_set_reverb_overridden
@@ -559,6 +608,10 @@ static mt32emu_midi_receiver_i getMidiReceiverThunk() {
 #undef mt32emu_get_output_gain
 #undef mt32emu_set_reverb_output_gain
 #undef mt32emu_get_reverb_output_gain
+#undef mt32emu_set_master_volume_override
+#undef mt32emu_get_master_volume_override
+#undef mt32emu_set_part_volume_override
+#undef mt32emu_get_part_volume_override
 #undef mt32emu_set_reversed_stereo_enabled
 #undef mt32emu_is_reversed_stereo_enabled
 #undef mt32emu_set_nice_amp_ramp_enabled
diff --git a/audio/softsynth/mt32/config.h b/audio/softsynth/mt32/config.h
index 0509c1606e6..7624467e6c8 100644
--- a/audio/softsynth/mt32/config.h
+++ b/audio/softsynth/mt32/config.h
@@ -1,5 +1,5 @@
 /* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
- * Copyright (C) 2011-2021 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ * Copyright (C) 2011-2022 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
@@ -18,10 +18,10 @@
 #ifndef MT32EMU_CONFIG_H
 #define MT32EMU_CONFIG_H
 
-#define MT32EMU_VERSION      "2.7.0"
+#define MT32EMU_VERSION      "2.8.6"
 #define MT32EMU_VERSION_MAJOR 2
-#define MT32EMU_VERSION_MINOR 7
-#define MT32EMU_VERSION_PATCH 0
+#define MT32EMU_VERSION_MINOR 8
+#define MT32EMU_VERSION_PATCH 6
 
 /* Library Exports Configuration
  *
diff --git a/audio/softsynth/mt32/mmath.h b/audio/softsynth/mt32/mmath.h
index 3164c7bfca2..a4f6f35f7cd 100644
--- a/audio/softsynth/mt32/mmath.h
+++ b/audio/softsynth/mt32/mmath.h
@@ -1,5 +1,5 @@
 /* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher
- * Copyright (C) 2011-2022 Dean Beeler, Jerome Fisher, Sergey V. Mikayev
+ * Copyright (C) 2011-2026 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
@@ -22,39 +22,28 @@
 
 namespace MT32Emu {
 
+using ::std::fmod;
+using ::std::exp;
+using ::std::log;
+using ::std::log10;
+using ::std::sin;
+using ::std::cos;
+
 // Mathematical constants
-const double DOUBLE_PI = 3.141592653589793;
-const double DOUBLE_LN_10 = 2.302585092994046;
 const float FLOAT_PI = 3.1415927f;
 const float FLOAT_2PI = 6.2831853f;
 const float FLOAT_LN_2 = 0.6931472f;
-const float FLOAT_LN_10 = 2.3025851f;
-
-static inline float POWF(float x, float y) {
-	return pow(x, y);
-}
-
-static inline float EXPF(float x) {
-	return exp(x);
-}
 
 static inline float EXP2F(float x) {
-#ifdef __APPLE__
-	// on OSX exp2f() is 1.59 times faster than "exp() and the multiplication with FLOAT_LN_2"
+#ifdef MT32EMU_WITH_EXP2F
 	return exp2f(x);
 #else
+	// This is an inaccurate approximation.
+	// We prefer it as a faster alternative to a combination of modf, exp and ldexp which would improve the accuracy.
 	return exp(FLOAT_LN_2 * x);
 #endif
 }
 
-static inline float EXP10F(float x) {
-	return exp(FLOAT_LN_10 * x);
-}
-
-static inline float LOGF(float x) {
-	return log(x);
-}
-
 static inline float LOG2F(float x) {
 	return log(x) / FLOAT_LN_2;
 }
diff --git a/audio/softsynth/mt32/srchelper/InternalResampler.cpp b/audio/softsynth/mt32/srchelper/InternalResampler.cpp
index 8f384091328..4e6a5a7489e 100644
--- a/audio/softsynth/mt32/srchelper/InternalResampler.cpp
+++ b/audio/softsynth/mt32/srchelper/InternalResampler.cpp
@@ -32,7 +32,7 @@ public:
 	SynthWrapper(Synth &useSynth) : synth(useSynth)
 	{}
 
-	void getOutputSamples(FloatSample *outBuffer, unsigned int size) override {
+	void getOutputSamples(FloatSample *outBuffer, unsigned int size) {
 		synth.render(outBuffer, size);
 	}
 };
diff --git a/audio/softsynth/mt32/srchelper/srctools/include/FIRResampler.h b/audio/softsynth/mt32/srchelper/srctools/include/FIRResampler.h
index 2635f5e15d1..b8e0be1bb7e 100644
--- a/audio/softsynth/mt32/srchelper/srctools/include/FIRResampler.h
+++ b/audio/softsynth/mt32/srchelper/srctools/include/FIRResampler.h
@@ -30,8 +30,8 @@ public:
 	FIRResampler(const unsigned int upsampleFactor, const double downsampleFactor, const FIRCoefficient kernel[], const unsigned int kernelLength);
 	~FIRResampler();
 
-	void process(const FloatSample *&inSamples, unsigned int &inLength, FloatSample *&outSamples, unsigned int &outLength) override;
-	unsigned int estimateInLength(const unsigned int outLength) const override;
+	void process(const FloatSample *&inSamples, unsigned int &inLength, FloatSample *&outSamples, unsigned int &outLength);
+	unsigned int estimateInLength(const unsigned int outLength) const;
 
 private:
 	const struct Constants {
diff --git a/audio/softsynth/mt32/srchelper/srctools/include/IIR2xResampler.h b/audio/softsynth/mt32/srchelper/srctools/include/IIR2xResampler.h
index b165cd18976..247d575685f 100644
--- a/audio/softsynth/mt32/srchelper/srctools/include/IIR2xResampler.h
+++ b/audio/softsynth/mt32/srchelper/srctools/include/IIR2xResampler.h
@@ -78,8 +78,8 @@ public:
 	explicit IIR2xInterpolator(const Quality quality);
 	explicit IIR2xInterpolator(const unsigned int useSectionsCount, const IIRCoefficient useFIR, const IIRSection useSections[]);
 
-	void process(const FloatSample *&inSamples, unsigned int &inLength, FloatSample *&outSamples, unsigned int &outLength) override;
-	unsigned int estimateInLength(const unsigned int outLength) const override;
+	void process(const FloatSample *&inSamples, unsigned int &inLength, FloatSample *&outSamples, unsigned int &outLength);
+	unsigned int estimateInLength(const unsigned int outLength) const;
 
 private:
 	FloatSample lastInputSamples[IIR_RESAMPER_CHANNEL_COUNT];
@@ -91,8 +91,8 @@ public:
 	explicit IIR2xDecimator(const Quality quality);
 	explicit IIR2xDecimator(const unsigned int useSectionsCount, const IIRCoefficient useFIR, const IIRSection useSections[]);
 
-	void process(const FloatSample *&inSamples, unsigned int &inLength, FloatSample *&outSamples, unsigned int &outLength) override;
-	unsigned int estimateInLength(const unsigned int outLength) const override;
+	void process(const FloatSample *&inSamples, unsigned int &inLength, FloatSample *&outSamples, unsigned int &outLength);
+	unsigned int estimateInLength(const unsigned int outLength) const;
 };
 
 } // namespace SRCTools
diff --git a/audio/softsynth/mt32/srchelper/srctools/include/LinearResampler.h b/audio/softsynth/mt32/srchelper/srctools/include/LinearResampler.h
index 035f27a45c2..a55f4ae67b3 100644
--- a/audio/softsynth/mt32/srchelper/srctools/include/LinearResampler.h
+++ b/audio/softsynth/mt32/srchelper/srctools/include/LinearResampler.h
@@ -28,8 +28,8 @@ public:
 	LinearResampler(double sourceSampleRate, double targetSampleRate);
 	~LinearResampler() {}
 
-	unsigned int estimateInLength(const unsigned int outLength) const override;
-	void process(const FloatSample *&inSamples, unsigned int &inLength, FloatSample *&outSamples, unsigned int &outLength) override;
+	unsigned int estimateInLength(const unsigned int outLength) const;
+	void process(const FloatSample *&inSamples, unsigned int &inLength, FloatSample *&outSamples, unsigned int &outLength);
 
 private:
 	const double inputToOutputRatio;
diff --git a/audio/softsynth/mt32/srchelper/srctools/src/ResamplerModel.cpp b/audio/softsynth/mt32/srchelper/srctools/src/ResamplerModel.cpp
index eadf6ffc73c..504024629e1 100644
--- a/audio/softsynth/mt32/srchelper/srctools/src/ResamplerModel.cpp
+++ b/audio/softsynth/mt32/srchelper/srctools/src/ResamplerModel.cpp
@@ -36,7 +36,7 @@ friend void freeResamplerModel(FloatSampleProvider &model, FloatSampleProvider &
 public:
 	CascadeStage(FloatSampleProvider &source, ResamplerStage &resamplerStage);
 
-	void getOutputSamples(FloatSample *outBuffer, unsigned int size) override;
+	void getOutputSamples(FloatSample *outBuffer, unsigned int size);
 
 protected:
 	ResamplerStage &resamplerStage;


Commit: f64f0b72dcad8cfe1cfab4d3822a65c44b7e75bc
    https://github.com/scummvm/scummvm/commit/f64f0b72dcad8cfe1cfab4d3822a65c44b7e75bc
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2026-12-02T20:29:04+02:00

Commit Message:
AUDIO: MT32: Configure MT32 emulator for ScummVM use

Changed paths:
    audio/softsynth/mt32/config.h


diff --git a/audio/softsynth/mt32/config.h b/audio/softsynth/mt32/config.h
index 7624467e6c8..d43e05c8dbd 100644
--- a/audio/softsynth/mt32/config.h
+++ b/audio/softsynth/mt32/config.h
@@ -23,6 +23,19 @@
 #define MT32EMU_VERSION_MINOR 8
 #define MT32EMU_VERSION_PATCH 6
 
+// ScummVM configuration
+
+// Fix -Wundef warnings
+#define MT32EMU_WITH_LIBSOXR_RESAMPLER       0
+#define MT32EMU_WITH_LIBSAMPLERATE_RESAMPLER 0
+#define MT32EMU_WITH_INTERNAL_RESAMPLER      1
+
+// Use snprintf() instead of sprintf()
+#define MT32EMU_WITH_SNPRINTF                1
+
+// Use exp2f() instead of approximation
+#define MT32EMU_WITH_EXP2F                   1
+
 /* Library Exports Configuration
  *
  * This reflects the API types actually provided by the library build.


Commit: f425b1b692a9930820621d22e98d15fcc2c99751
    https://github.com/scummvm/scummvm/commit/f425b1b692a9930820621d22e98d15fcc2c99751
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2026-12-02T20:29:04+02:00

Commit Message:
AUDIO: MT32: Restore override keywords

Changed paths:
    audio/softsynth/mt32/Analog.cpp
    audio/softsynth/mt32/BReverbModel.cpp
    audio/softsynth/mt32/File.h
    audio/softsynth/mt32/FileStream.h
    audio/softsynth/mt32/LA32FloatWaveGenerator.h
    audio/softsynth/mt32/LA32WaveGenerator.h
    audio/softsynth/mt32/MidiStreamParser.h
    audio/softsynth/mt32/Part.h
    audio/softsynth/mt32/Synth.cpp
    audio/softsynth/mt32/c_interface/c_interface.cpp
    audio/softsynth/mt32/srchelper/InternalResampler.cpp
    audio/softsynth/mt32/srchelper/srctools/include/FIRResampler.h
    audio/softsynth/mt32/srchelper/srctools/include/IIR2xResampler.h
    audio/softsynth/mt32/srchelper/srctools/include/LinearResampler.h
    audio/softsynth/mt32/srchelper/srctools/src/ResamplerModel.cpp


diff --git a/audio/softsynth/mt32/Analog.cpp b/audio/softsynth/mt32/Analog.cpp
index 41fb19b44b9..0c9a8f82a89 100644
--- a/audio/softsynth/mt32/Analog.cpp
+++ b/audio/softsynth/mt32/Analog.cpp
@@ -127,7 +127,7 @@ public:
 template <class SampleEx>
 class NullLowPassFilter : public AbstractLowPassFilter<SampleEx> {
 public:
-	SampleEx process(const SampleEx sample) {
+	SampleEx process(const SampleEx sample) override {
 		return sample;
 	}
 };
@@ -150,7 +150,7 @@ public:
 		Synth::muteSampleBuffer(ringBuffer, COARSE_LPF_DELAY_LINE_LENGTH);
 	}
 
-	SampleEx process(const SampleEx inSample) {
+	SampleEx process(const SampleEx inSample) override {
 		static const unsigned int DELAY_LINE_MASK = COARSE_LPF_DELAY_LINE_LENGTH - 1;
 
 		SampleEx sample = lpfTaps[COARSE_LPF_DELAY_LINE_LENGTH] * ringBuffer[ringBufferPosition];
@@ -179,12 +179,12 @@ private:
 
 public:
 	AccurateLowPassFilter(const bool oldMT32AnalogLPF, const bool oversample);
-	FloatSample process(const FloatSample sample);
-	IntSampleEx process(const IntSampleEx sample);
-	bool hasNextSample() const;
-	unsigned int getOutputSampleRate() const;
-	unsigned int estimateInSampleCount(const unsigned int outSamples) const;
-	void addPositionIncrement(const unsigned int positionIncrement);
+	FloatSample process(const FloatSample sample) override;
+	IntSampleEx process(const IntSampleEx sample) override;
+	bool hasNextSample() const override;
+	unsigned int getOutputSampleRate() const override;
+	unsigned int estimateInSampleCount(const unsigned int outSamples) const override;
+	void addPositionIncrement(const unsigned int positionIncrement) override;
 };
 
 static inline IntSampleEx normaliseSample(const IntSampleEx sample) {
@@ -223,19 +223,19 @@ public:
 		delete &rightChannelLPF;
 	}
 
-	unsigned int getOutputSampleRate() const {
+	unsigned int getOutputSampleRate() const override {
 		return leftChannelLPF.getOutputSampleRate();
 	}
 
-	Bit32u getDACStreamsLength(const Bit32u outputLength) const {
+	Bit32u getDACStreamsLength(const Bit32u outputLength) const override {
 		return leftChannelLPF.estimateInSampleCount(outputLength);
 	}
 
-	void setSynthOutputGain(const float synthGain);
-	void setReverbOutputGain(const float reverbGain, const bool mt32ReverbCompatibilityMode);
+	void setSynthOutputGain(const float synthGain) override;
+	void setReverbOutputGain(const float reverbGain, const bool mt32ReverbCompatibilityMode) override;
 
-	bool process(IntSample *outStream, const IntSample *nonReverbLeft, const IntSample *nonReverbRight, const IntSample *reverbDryLeft, const IntSample *reverbDryRight, const IntSample *reverbWetLeft, const IntSample *reverbWetRight, Bit32u outLength);
-	bool process(FloatSample *outStream, const FloatSample *nonReverbLeft, const FloatSample *nonReverbRight, const FloatSample *reverbDryLeft, const FloatSample *reverbDryRight, const FloatSample *reverbWetLeft, const FloatSample *reverbWetRight, Bit32u outLength);
+	bool process(IntSample *outStream, const IntSample *nonReverbLeft, const IntSample *nonReverbRight, const IntSample *reverbDryLeft, const IntSample *reverbDryRight, const IntSample *reverbWetLeft, const IntSample *reverbWetRight, Bit32u outLength) override;
+	bool process(FloatSample *outStream, const FloatSample *nonReverbLeft, const FloatSample *nonReverbRight, const FloatSample *reverbDryLeft, const FloatSample *reverbDryRight, const FloatSample *reverbWetLeft, const FloatSample *reverbWetRight, Bit32u outLength) override;
 
 	template <class Sample>
 	void produceOutput(Sample *outStream, const Sample *nonReverbLeft, const Sample *nonReverbRight, const Sample *reverbDryLeft, const Sample *reverbDryRight, const Sample *reverbWetLeft, const Sample *reverbWetRight, Bit32u outLength) {
diff --git a/audio/softsynth/mt32/BReverbModel.cpp b/audio/softsynth/mt32/BReverbModel.cpp
index 05a2e4240c9..3080db3fe9f 100644
--- a/audio/softsynth/mt32/BReverbModel.cpp
+++ b/audio/softsynth/mt32/BReverbModel.cpp
@@ -455,11 +455,11 @@ public:
 		close();
 	}
 
-	bool isOpen() const {
+	bool isOpen() const override {
 		return combs != NULL;
 	}
 
-	void open() {
+	void open() override {
 		if (isOpen()) return;
 		if (currentSettings.numberOfAllpasses > 0) {
 			allpasses = new AllpassFilter<Sample>*[currentSettings.numberOfAllpasses];
@@ -479,7 +479,7 @@ public:
 		mute();
 	}
 
-	void close() {
+	void close() override {
 		if (allpasses != NULL) {
 			for (Bit32u i = 0; i < currentSettings.numberOfAllpasses; i++) {
 				if (allpasses[i] != NULL) {
@@ -502,7 +502,7 @@ public:
 		}
 	}
 
-	void mute() {
+	void mute() override {
 		if (allpasses != NULL) {
 			for (Bit32u i = 0; i < currentSettings.numberOfAllpasses; i++) {
 				allpasses[i]->mute();
@@ -515,7 +515,7 @@ public:
 		}
 	}
 
-	void setParameters(Bit8u time, Bit8u level) {
+	void setParameters(Bit8u time, Bit8u level) override {
 		if (!isOpen()) return;
 		level &= 7;
 		time &= 7;
@@ -542,7 +542,7 @@ public:
 		}
 	}
 
-	bool isActive() const {
+	bool isActive() const override {
 		if (!isOpen()) return false;
 		for (Bit32u i = 0; i < currentSettings.numberOfAllpasses; i++) {
 			if (!allpasses[i]->isEmpty()) return true;
@@ -553,7 +553,7 @@ public:
 		return false;
 	}
 
-	bool isMT32Compatible(const ReverbMode mode) const {
+	bool isMT32Compatible(const ReverbMode mode) const override {
 		return &currentSettings == &getMT32Settings(mode);
 	}
 
@@ -622,8 +622,8 @@ public:
 		} // while ((numSamples--) > 0)
 	} // produceOutput
 
-	bool process(const IntSample *inLeft, const IntSample *inRight, IntSample *outLeft, IntSample *outRight, Bit32u numSamples);
-	bool process(const FloatSample *inLeft, const FloatSample *inRight, FloatSample *outLeft, FloatSample *outRight, Bit32u numSamples);
+	bool process(const IntSample *inLeft, const IntSample *inRight, IntSample *outLeft, IntSample *outRight, Bit32u numSamples) override;
+	bool process(const FloatSample *inLeft, const FloatSample *inRight, FloatSample *outLeft, FloatSample *outRight, Bit32u numSamples) override;
 };
 
 BReverbModel *BReverbModel::createBReverbModel(const ReverbMode mode, const bool mt32CompatibleModel, const RendererType rendererType) {
diff --git a/audio/softsynth/mt32/File.h b/audio/softsynth/mt32/File.h
index 2aa34b4c774..6d00d9962dc 100644
--- a/audio/softsynth/mt32/File.h
+++ b/audio/softsynth/mt32/File.h
@@ -40,7 +40,7 @@ public:
 
 class MT32EMU_EXPORT AbstractFile : public File {
 public:
-	const SHA1Digest &getSHA1();
+	const SHA1Digest &getSHA1() override;
 
 protected:
 	AbstractFile();
@@ -59,9 +59,9 @@ public:
 	ArrayFile(const Bit8u *data, size_t size);
 	ArrayFile(const Bit8u *data, size_t size, const SHA1Digest &sha1Digest);
 
-	size_t getSize();
-	const Bit8u *getData();
-	void close() {}
+	size_t getSize() override;
+	const Bit8u *getData() override;
+	void close() override {}
 
 private:
 	const Bit8u *data;
diff --git a/audio/softsynth/mt32/FileStream.h b/audio/softsynth/mt32/FileStream.h
index 3b397686962..1d3b509e6cc 100644
--- a/audio/softsynth/mt32/FileStream.h
+++ b/audio/softsynth/mt32/FileStream.h
@@ -30,10 +30,10 @@ class FileStream : public AbstractFile {
 public:
 	MT32EMU_EXPORT FileStream();
 	MT32EMU_EXPORT ~FileStream();
-	MT32EMU_EXPORT size_t getSize();
-	MT32EMU_EXPORT const Bit8u *getData();
+	MT32EMU_EXPORT size_t getSize() override;
+	MT32EMU_EXPORT const Bit8u *getData() override;
 	MT32EMU_EXPORT bool open(const char *filename);
-	MT32EMU_EXPORT void close();
+	MT32EMU_EXPORT void close() override;
 
 private:
 	std::ifstream &ifsp;
diff --git a/audio/softsynth/mt32/LA32FloatWaveGenerator.h b/audio/softsynth/mt32/LA32FloatWaveGenerator.h
index 0a81568b5ac..98b0f7d1129 100644
--- a/audio/softsynth/mt32/LA32FloatWaveGenerator.h
+++ b/audio/softsynth/mt32/LA32FloatWaveGenerator.h
@@ -136,13 +136,13 @@ public:
 	// ringModulated should be set to false for the structures with mixing or stereo output
 	// ringModulated should be set to true for the structures with ring modulation
 	// mixed is used for the structures with ring modulation and indicates whether the master partial output is mixed to the ring modulator output
-	void init(const bool ringModulated, const bool mixed);
+	void init(const bool ringModulated, const bool mixed) override;
 
 	// Initialise the WG engine for generation of synth partial samples and set up the invariant parameters
-	void initSynth(const PairType master, const bool sawtoothWaveform, const Bit8u pulseWidth, const Bit8u resonance);
+	void initSynth(const PairType master, const bool sawtoothWaveform, const Bit8u pulseWidth, const Bit8u resonance) override;
 
 	// Initialise the WG engine for generation of PCM partial samples and set up the invariant parameters
-	void initPCM(const PairType master, const Bit16s * const pcmWaveAddress, const Bit32u pcmWaveLength, const bool pcmWaveLooped);
+	void initPCM(const PairType master, const Bit16s * const pcmWaveAddress, const Bit32u pcmWaveLength, const bool pcmWaveLooped) override;
 
 	// Update parameters with respect to TVP, TVA and TVF; should only be called when the values change
 	void setAmp(const PairType master, const Bit32u amp);
@@ -156,7 +156,7 @@ public:
 	float nextOutSample();
 
 	// Deactivate the WG engine
-	void deactivate(const PairType master);
+	void deactivate(const PairType master) override;
 
 	// Return active state of the WG engine
 	bool isActive(const PairType master) const;
diff --git a/audio/softsynth/mt32/LA32WaveGenerator.h b/audio/softsynth/mt32/LA32WaveGenerator.h
index de946c7ccef..71c0f23274b 100644
--- a/audio/softsynth/mt32/LA32WaveGenerator.h
+++ b/audio/softsynth/mt32/LA32WaveGenerator.h
@@ -251,13 +251,13 @@ public:
 	// ringModulated should be set to false for the structures with mixing or stereo output
 	// ringModulated should be set to true for the structures with ring modulation
 	// mixed is used for the structures with ring modulation and indicates whether the master partial output is mixed to the ring modulator output
-	void init(const bool ringModulated, const bool mixed);
+	void init(const bool ringModulated, const bool mixed) override;
 
 	// Initialise the WG engine for generation of synth partial samples and set up the invariant parameters
-	void initSynth(const PairType master, const bool sawtoothWaveform, const Bit8u pulseWidth, const Bit8u resonance);
+	void initSynth(const PairType master, const bool sawtoothWaveform, const Bit8u pulseWidth, const Bit8u resonance) override;
 
 	// Initialise the WG engine for generation of PCM partial samples and set up the invariant parameters
-	void initPCM(const PairType master, const Bit16s * const pcmWaveAddress, const Bit32u pcmWaveLength, const bool pcmWaveLooped);
+	void initPCM(const PairType master, const Bit16s * const pcmWaveAddress, const Bit32u pcmWaveLength, const bool pcmWaveLooped) override;
 
 	// Update parameters with respect to TVP, TVA and TVF; should only be called when the values change
 	void setAmp(const PairType master, const Bit32u amp);
@@ -272,7 +272,7 @@ public:
 	Bit16s nextOutSample();
 
 	// Deactivate the WG engine
-	void deactivate(const PairType master);
+	void deactivate(const PairType master) override;
 
 	// Return active state of the WG engine
 	bool isActive(const PairType master) const;
diff --git a/audio/softsynth/mt32/MidiStreamParser.h b/audio/softsynth/mt32/MidiStreamParser.h
index d3a76c8a037..5437ddc392a 100644
--- a/audio/softsynth/mt32/MidiStreamParser.h
+++ b/audio/softsynth/mt32/MidiStreamParser.h
@@ -108,10 +108,10 @@ public:
 	void resetTimestamp();
 
 protected:
-	void handleShortMessage(const Bit32u message);
-	void handleSysex(const Bit8u *stream, const Bit32u length);
-	void handleSystemRealtimeMessage(const Bit8u realtime);
-	void printDebug(const char *debugMessage);
+	void handleShortMessage(const Bit32u message) override;
+	void handleSysex(const Bit8u *stream, const Bit32u length) override;
+	void handleSystemRealtimeMessage(const Bit8u realtime) override;
+	void printDebug(const char *debugMessage) override;
 
 private:
 	Synth &synth;
diff --git a/audio/softsynth/mt32/Part.h b/audio/softsynth/mt32/Part.h
index d585410da4a..3bbfd990e8c 100644
--- a/audio/softsynth/mt32/Part.h
+++ b/audio/softsynth/mt32/Part.h
@@ -146,15 +146,15 @@ class RhythmPart: public Part {
 	PatchCache drumCache[85][4];
 public:
 	RhythmPart(Synth *synth, unsigned int usePartNum);
-	void refresh();
-	void refreshTimbre(unsigned int timbreNum);
-	void resetTimbre();
-	void noteOn(unsigned int key, unsigned int velocity);
-	void noteOff(unsigned int midiKey);
-	unsigned int getAbsTimbreNum() const;
-	void setPan(unsigned int midiPan);
-	void setProgram(unsigned int patchNum);
-	void polyStateChanged(PolyState oldState, PolyState newState);
+	void refresh() override;
+	void refreshTimbre(unsigned int timbreNum) override;
+	void resetTimbre() override;
+	void noteOn(unsigned int key, unsigned int velocity) override;
+	void noteOff(unsigned int midiKey) override;
+	unsigned int getAbsTimbreNum() const override;
+	void setPan(unsigned int midiPan) override;
+	void setProgram(unsigned int patchNum) override;
+	void polyStateChanged(PolyState oldState, PolyState newState) override;
 };
 
 } // namespace MT32Emu
diff --git a/audio/softsynth/mt32/Synth.cpp b/audio/softsynth/mt32/Synth.cpp
index 257e45d3c81..26bb77ab40a 100644
--- a/audio/softsynth/mt32/Synth.cpp
+++ b/audio/softsynth/mt32/Synth.cpp
@@ -229,10 +229,10 @@ public:
 		tmpBuffers(createTmpBuffers())
 	{}
 
-	void render(IntSample *stereoStream, Bit32u len);
-	void render(FloatSample *stereoStream, Bit32u len);
-	void renderStreams(const DACOutputStreams<IntSample> &streams, Bit32u len);
-	void renderStreams(const DACOutputStreams<FloatSample> &streams, Bit32u len);
+	void render(IntSample *stereoStream, Bit32u len) override;
+	void render(FloatSample *stereoStream, Bit32u len) override;
+	void renderStreams(const DACOutputStreams<IntSample> &streams, Bit32u len) override;
+	void renderStreams(const DACOutputStreams<FloatSample> &streams, Bit32u len) override;
 
 	template <class O>
 	void doRenderAndConvert(O *stereoStream, Bit32u len);
@@ -2159,13 +2159,13 @@ public:
 /** Storage space for SysEx data is allocated dynamically on demand and is disposed lazily. */
 class DynamicSysexDataStorage : public MidiEventQueue::SysexDataStorage {
 public:
-	Bit8u *allocate(Bit32u sysexLength) {
+	Bit8u *allocate(Bit32u sysexLength) override {
 		return new Bit8u[sysexLength];
 	}
 
-	void reclaimUnused(const Bit8u *, Bit32u) {}
+	void reclaimUnused(const Bit8u *, Bit32u) override {}
 
-	void dispose(const Bit8u *sysexData, Bit32u) {
+	void dispose(const Bit8u *sysexData, Bit32u) override {
 		delete[] sysexData;
 	}
 };
@@ -2188,7 +2188,7 @@ public:
 		delete[] storageBuffer;
 	}
 
-	Bit8u *allocate(Bit32u sysexLength) {
+	Bit8u *allocate(Bit32u sysexLength) override {
 		Bit32u myStartPosition = startPosition;
 		Bit32u myEndPosition = endPosition;
 
@@ -2214,7 +2214,7 @@ public:
 		return storageBuffer + myEndPosition;
 	}
 
-	void reclaimUnused(const Bit8u *sysexData, Bit32u sysexLength) {
+	void reclaimUnused(const Bit8u *sysexData, Bit32u sysexLength) override {
 		if (sysexData == NULL) return;
 		Bit32u allocatedPosition = startPosition;
 		if (storageBuffer + allocatedPosition == sysexData) {
@@ -2225,7 +2225,7 @@ public:
 		}
 	}
 
-	void dispose(const Bit8u *, Bit32u) {}
+	void dispose(const Bit8u *, Bit32u) override {}
 
 private:
 	Bit8u * const storageBuffer;
diff --git a/audio/softsynth/mt32/c_interface/c_interface.cpp b/audio/softsynth/mt32/c_interface/c_interface.cpp
index 9fc5e740bfd..7792163ee03 100644
--- a/audio/softsynth/mt32/c_interface/c_interface.cpp
+++ b/audio/softsynth/mt32/c_interface/c_interface.cpp
@@ -173,7 +173,7 @@ private:
 		return delegate.v0->getVersionID(delegate) < versionID;
 	}
 
-	void printDebug(const char *fmt, va_list list) {
+	void printDebug(const char *fmt, va_list list) override {
 		if (delegate.v0->printDebug == NULL) {
 			ReportHandler::printDebug(fmt, list);
 		} else {
@@ -181,7 +181,7 @@ private:
 		}
 	}
 
-	void onErrorControlROM() {
+	void onErrorControlROM() override {
 		if (delegate.v0->onErrorControlROM == NULL) {
 			ReportHandler::onErrorControlROM();
 		} else {
@@ -189,7 +189,7 @@ private:
 		}
 	}
 
-	void onErrorPCMROM() {
+	void onErrorPCMROM() override {
 		if (delegate.v0->onErrorPCMROM == NULL) {
 			ReportHandler::onErrorPCMROM();
 		} else {
@@ -197,7 +197,7 @@ private:
 		}
 	}
 
-	void showLCDMessage(const char *message) {
+	void showLCDMessage(const char *message) override {
 		if (delegate.v0->showLCDMessage == NULL) {
 			ReportHandler::showLCDMessage(message);
 		} else {
@@ -205,7 +205,7 @@ private:
 		}
 	}
 
-	void onMIDIMessagePlayed() {
+	void onMIDIMessagePlayed() override {
 		if (delegate.v0->onMIDIMessagePlayed == NULL) {
 			ReportHandler::onMIDIMessagePlayed();
 		} else {
@@ -213,14 +213,14 @@ private:
 		}
 	}
 
-	bool onMIDIQueueOverflow() {
+	bool onMIDIQueueOverflow() override {
 		if (delegate.v0->onMIDIQueueOverflow == NULL) {
 			return ReportHandler::onMIDIQueueOverflow();
 		}
 		return delegate.v0->onMIDIQueueOverflow(instanceData) != MT32EMU_BOOL_FALSE;
 	}
 
-	void onMIDISystemRealtime(Bit8u systemRealtime) {
+	void onMIDISystemRealtime(Bit8u systemRealtime) override {
 		if (delegate.v0->onMIDISystemRealtime == NULL) {
 			ReportHandler::onMIDISystemRealtime(systemRealtime);
 		} else {
@@ -228,7 +228,7 @@ private:
 		}
 	}
 
-	void onDeviceReset() {
+	void onDeviceReset() override {
 		if (delegate.v0->onDeviceReset == NULL) {
 			ReportHandler::onDeviceReset();
 		} else {
@@ -236,7 +236,7 @@ private:
 		}
 	}
 
-	void onDeviceReconfig() {
+	void onDeviceReconfig() override {
 		if (delegate.v0->onDeviceReconfig == NULL) {
 			ReportHandler::onDeviceReconfig();
 		} else {
@@ -244,7 +244,7 @@ private:
 		}
 	}
 
-	void onNewReverbMode(Bit8u mode) {
+	void onNewReverbMode(Bit8u mode) override {
 		if (delegate.v0->onNewReverbMode == NULL) {
 			ReportHandler::onNewReverbMode(mode);
 		} else {
@@ -252,7 +252,7 @@ private:
 		}
 	}
 
-	void onNewReverbTime(Bit8u time) {
+	void onNewReverbTime(Bit8u time) override {
 		if (delegate.v0->onNewReverbTime == NULL) {
 			ReportHandler::onNewReverbTime(time);
 		} else {
@@ -260,7 +260,7 @@ private:
 		}
 	}
 
-	void onNewReverbLevel(Bit8u level) {
+	void onNewReverbLevel(Bit8u level) override {
 		if (delegate.v0->onNewReverbLevel == NULL) {
 			ReportHandler::onNewReverbLevel(level);
 		} else {
@@ -268,7 +268,7 @@ private:
 		}
 	}
 
-	void onPolyStateChanged(Bit8u partNum) {
+	void onPolyStateChanged(Bit8u partNum) override {
 		if (delegate.v0->onPolyStateChanged == NULL) {
 			ReportHandler::onPolyStateChanged(partNum);
 		} else {
@@ -276,7 +276,7 @@ private:
 		}
 	}
 
-	void onProgramChanged(Bit8u partNum, const char *soundGroupName, const char *patchName) {
+	void onProgramChanged(Bit8u partNum, const char *soundGroupName, const char *patchName) override {
 		if (delegate.v0->onProgramChanged == NULL) {
 			ReportHandler::onProgramChanged(partNum, soundGroupName, patchName);
 		} else {
@@ -284,7 +284,7 @@ private:
 		}
 	}
 
-	void onLCDStateUpdated() {
+	void onLCDStateUpdated() override {
 		if (isVersionLess(MT32EMU_REPORT_HANDLER_VERSION_1) || delegate.v1->onLCDStateUpdated == NULL) {
 			ReportHandler2::onLCDStateUpdated();
 		} else {
@@ -292,7 +292,7 @@ private:
 		}
 	}
 
-	void onMidiMessageLEDStateUpdated(bool ledState) {
+	void onMidiMessageLEDStateUpdated(bool ledState) override {
 		if (isVersionLess(MT32EMU_REPORT_HANDLER_VERSION_1) || delegate.v1->onMidiMessageLEDStateUpdated == NULL) {
 			ReportHandler2::onMidiMessageLEDStateUpdated(ledState);
 		} else {
@@ -300,7 +300,7 @@ private:
 		}
 	}
 
-	void onNoteOnIgnored(Bit32u partialsNeeded, Bit32u partialsFree) {
+	void onNoteOnIgnored(Bit32u partialsNeeded, Bit32u partialsFree) override {
 		if (isVersionLess(MT32EMU_REPORT_HANDLER_VERSION_2) || delegate.v2->onNoteOnIgnored == NULL) {
 			ReportHandler3::onNoteOnIgnored(partialsNeeded, partialsFree);
 		} else {
@@ -308,7 +308,7 @@ private:
 		}
 	}
 
-	void onPlayingPolySilenced(Bit32u partialsNeeded, Bit32u partialsFree) {
+	void onPlayingPolySilenced(Bit32u partialsNeeded, Bit32u partialsFree) override {
 		if (isVersionLess(MT32EMU_REPORT_HANDLER_VERSION_2) || delegate.v2->onPlayingPolySilenced == NULL) {
 			ReportHandler3::onPlayingPolySilenced(partialsNeeded, partialsFree);
 		} else {
@@ -327,7 +327,7 @@ protected:
 	void *instanceData;
 
 private:
-	void handleShortMessage(const Bit32u message) {
+	void handleShortMessage(const Bit32u message) override {
 		if (delegate.v0->handleShortMessage == NULL) {
 			DefaultMidiStreamParser::handleShortMessage(message);
 		} else {
@@ -335,7 +335,7 @@ private:
 		}
 	}
 
-	void handleSysex(const Bit8u *stream, const Bit32u length) {
+	void handleSysex(const Bit8u *stream, const Bit32u length) override {
 		if (delegate.v0->handleSysex == NULL) {
 			DefaultMidiStreamParser::handleSysex(stream, length);
 		} else {
@@ -343,7 +343,7 @@ private:
 		}
 	}
 
-	void handleSystemRealtimeMessage(const Bit8u realtime) {
+	void handleSystemRealtimeMessage(const Bit8u realtime) override {
 		if (delegate.v0->handleSystemRealtimeMessage == NULL) {
 			DefaultMidiStreamParser::handleSystemRealtimeMessage(realtime);
 		} else {
diff --git a/audio/softsynth/mt32/srchelper/InternalResampler.cpp b/audio/softsynth/mt32/srchelper/InternalResampler.cpp
index 4e6a5a7489e..8f384091328 100644
--- a/audio/softsynth/mt32/srchelper/InternalResampler.cpp
+++ b/audio/softsynth/mt32/srchelper/InternalResampler.cpp
@@ -32,7 +32,7 @@ public:
 	SynthWrapper(Synth &useSynth) : synth(useSynth)
 	{}
 
-	void getOutputSamples(FloatSample *outBuffer, unsigned int size) {
+	void getOutputSamples(FloatSample *outBuffer, unsigned int size) override {
 		synth.render(outBuffer, size);
 	}
 };
diff --git a/audio/softsynth/mt32/srchelper/srctools/include/FIRResampler.h b/audio/softsynth/mt32/srchelper/srctools/include/FIRResampler.h
index b8e0be1bb7e..2635f5e15d1 100644
--- a/audio/softsynth/mt32/srchelper/srctools/include/FIRResampler.h
+++ b/audio/softsynth/mt32/srchelper/srctools/include/FIRResampler.h
@@ -30,8 +30,8 @@ public:
 	FIRResampler(const unsigned int upsampleFactor, const double downsampleFactor, const FIRCoefficient kernel[], const unsigned int kernelLength);
 	~FIRResampler();
 
-	void process(const FloatSample *&inSamples, unsigned int &inLength, FloatSample *&outSamples, unsigned int &outLength);
-	unsigned int estimateInLength(const unsigned int outLength) const;
+	void process(const FloatSample *&inSamples, unsigned int &inLength, FloatSample *&outSamples, unsigned int &outLength) override;
+	unsigned int estimateInLength(const unsigned int outLength) const override;
 
 private:
 	const struct Constants {
diff --git a/audio/softsynth/mt32/srchelper/srctools/include/IIR2xResampler.h b/audio/softsynth/mt32/srchelper/srctools/include/IIR2xResampler.h
index 247d575685f..b165cd18976 100644
--- a/audio/softsynth/mt32/srchelper/srctools/include/IIR2xResampler.h
+++ b/audio/softsynth/mt32/srchelper/srctools/include/IIR2xResampler.h
@@ -78,8 +78,8 @@ public:
 	explicit IIR2xInterpolator(const Quality quality);
 	explicit IIR2xInterpolator(const unsigned int useSectionsCount, const IIRCoefficient useFIR, const IIRSection useSections[]);
 
-	void process(const FloatSample *&inSamples, unsigned int &inLength, FloatSample *&outSamples, unsigned int &outLength);
-	unsigned int estimateInLength(const unsigned int outLength) const;
+	void process(const FloatSample *&inSamples, unsigned int &inLength, FloatSample *&outSamples, unsigned int &outLength) override;
+	unsigned int estimateInLength(const unsigned int outLength) const override;
 
 private:
 	FloatSample lastInputSamples[IIR_RESAMPER_CHANNEL_COUNT];
@@ -91,8 +91,8 @@ public:
 	explicit IIR2xDecimator(const Quality quality);
 	explicit IIR2xDecimator(const unsigned int useSectionsCount, const IIRCoefficient useFIR, const IIRSection useSections[]);
 
-	void process(const FloatSample *&inSamples, unsigned int &inLength, FloatSample *&outSamples, unsigned int &outLength);
-	unsigned int estimateInLength(const unsigned int outLength) const;
+	void process(const FloatSample *&inSamples, unsigned int &inLength, FloatSample *&outSamples, unsigned int &outLength) override;
+	unsigned int estimateInLength(const unsigned int outLength) const override;
 };
 
 } // namespace SRCTools
diff --git a/audio/softsynth/mt32/srchelper/srctools/include/LinearResampler.h b/audio/softsynth/mt32/srchelper/srctools/include/LinearResampler.h
index a55f4ae67b3..035f27a45c2 100644
--- a/audio/softsynth/mt32/srchelper/srctools/include/LinearResampler.h
+++ b/audio/softsynth/mt32/srchelper/srctools/include/LinearResampler.h
@@ -28,8 +28,8 @@ public:
 	LinearResampler(double sourceSampleRate, double targetSampleRate);
 	~LinearResampler() {}
 
-	unsigned int estimateInLength(const unsigned int outLength) const;
-	void process(const FloatSample *&inSamples, unsigned int &inLength, FloatSample *&outSamples, unsigned int &outLength);
+	unsigned int estimateInLength(const unsigned int outLength) const override;
+	void process(const FloatSample *&inSamples, unsigned int &inLength, FloatSample *&outSamples, unsigned int &outLength) override;
 
 private:
 	const double inputToOutputRatio;
diff --git a/audio/softsynth/mt32/srchelper/srctools/src/ResamplerModel.cpp b/audio/softsynth/mt32/srchelper/srctools/src/ResamplerModel.cpp
index 504024629e1..eadf6ffc73c 100644
--- a/audio/softsynth/mt32/srchelper/srctools/src/ResamplerModel.cpp
+++ b/audio/softsynth/mt32/srchelper/srctools/src/ResamplerModel.cpp
@@ -36,7 +36,7 @@ friend void freeResamplerModel(FloatSampleProvider &model, FloatSampleProvider &
 public:
 	CascadeStage(FloatSampleProvider &source, ResamplerStage &resamplerStage);
 
-	void getOutputSamples(FloatSample *outBuffer, unsigned int size);
+	void getOutputSamples(FloatSample *outBuffer, unsigned int size) override;
 
 protected:
 	ResamplerStage &resamplerStage;


Commit: 19980dc7c0a7b873a8fba46d3e3c5f6b7acde8e9
    https://github.com/scummvm/scummvm/commit/19980dc7c0a7b873a8fba46d3e3c5f6b7acde8e9
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2026-12-02T20:29:04+02:00

Commit Message:
AUDIO: MT32: Restore disabling of MSVC STL exceptions

Changed paths:
    audio/softsynth/mt32/FileStream.cpp


diff --git a/audio/softsynth/mt32/FileStream.cpp b/audio/softsynth/mt32/FileStream.cpp
index 5e32c10d641..4424c282ff0 100644
--- a/audio/softsynth/mt32/FileStream.cpp
+++ b/audio/softsynth/mt32/FileStream.cpp
@@ -21,6 +21,11 @@
 
 #include "internals.h"
 
+// Disable MSVC STL exceptions
+#ifdef _MSC_VER
+#define _HAS_EXCEPTIONS 0
+#endif
+
 #include "FileStream.h"
 
 namespace MT32Emu {


Commit: e2c992812c973c21d9a315298e3acfeb7fc9e749
    https://github.com/scummvm/scummvm/commit/e2c992812c973c21d9a315298e3acfeb7fc9e749
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2026-12-02T20:29:04+02:00

Commit Message:
AUDIO: MT32: Remove unneeded STL

This was a munt 2.8.4 addition that I missed.

Changed paths:
    audio/softsynth/mt32/mmath.h


diff --git a/audio/softsynth/mt32/mmath.h b/audio/softsynth/mt32/mmath.h
index a4f6f35f7cd..917fd55aa2a 100644
--- a/audio/softsynth/mt32/mmath.h
+++ b/audio/softsynth/mt32/mmath.h
@@ -22,13 +22,6 @@
 
 namespace MT32Emu {
 
-using ::std::fmod;
-using ::std::exp;
-using ::std::log;
-using ::std::log10;
-using ::std::sin;
-using ::std::cos;
-
 // Mathematical constants
 const float FLOAT_PI = 3.1415927f;
 const float FLOAT_2PI = 6.2831853f;


Commit: b97d63c11df4d6fae5d8b593869bac55b415a15c
    https://github.com/scummvm/scummvm/commit/b97d63c11df4d6fae5d8b593869bac55b415a15c
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2026-12-02T20:29:04+02:00

Commit Message:
AUDIO: MT32: Restore typo fix

Changed paths:
    audio/softsynth/mt32/BReverbModel.cpp


diff --git a/audio/softsynth/mt32/BReverbModel.cpp b/audio/softsynth/mt32/BReverbModel.cpp
index 3080db3fe9f..41ec7df6f29 100644
--- a/audio/softsynth/mt32/BReverbModel.cpp
+++ b/audio/softsynth/mt32/BReverbModel.cpp
@@ -588,7 +588,7 @@ public:
 				}
 			} else {
 				DelayWithLowPassFilter<Sample> * const entranceDelay = static_cast<DelayWithLowPassFilter<Sample> *>(combs[0]);
-				// If the output position is equal to the comb size, get it now in order not to loose it
+				// If the output position is equal to the comb size, get it now in order not to lose it
 				Sample link = entranceDelay->getOutputAt(currentSettings.combSizes[0] - 1);
 
 				// Entrance LPF. Note, comb.process() differs a bit here.


Commit: d7fe09f63e569d16c444d627bbbda0610d6bbd9a
    https://github.com/scummvm/scummvm/commit/d7fe09f63e569d16c444d627bbbda0610d6bbd9a
Author: Torbjörn Andersson (eriktorbjorn at users.sourceforge.net)
Date: 2026-12-02T20:29:04+02:00

Commit Message:
AUDIO: MT32: Remove MT32EMU_WITH_TESTING code

Changed paths:
    audio/softsynth/mt32/ROMInfo.cpp
    audio/softsynth/mt32/Synth.cpp
    audio/softsynth/mt32/c_interface/c_interface.cpp


diff --git a/audio/softsynth/mt32/ROMInfo.cpp b/audio/softsynth/mt32/ROMInfo.cpp
index 7f89ad1d44e..5afaecb4af5 100644
--- a/audio/softsynth/mt32/ROMInfo.cpp
+++ b/audio/softsynth/mt32/ROMInfo.cpp
@@ -389,15 +389,3 @@ const ROMInfo * const *MachineConfiguration::getCompatibleROMInfos(Bit32u *itemC
 }
 
 } // namespace MT32Emu
-
-#ifdef MT32EMU_WITH_TESTING
-
-#include "test/TestAccessors.h"
-
-using namespace MT32Emu;
-
-File *Test::mergePartialROMs(const ROMImage *romImage1, const ROMImage *romImage2) {
-	return MT32Emu::mergePartialROMs(romImage1, romImage2);
-}
-
-#endif // #ifdef MT32EMU_WITH_TESTING
diff --git a/audio/softsynth/mt32/Synth.cpp b/audio/softsynth/mt32/Synth.cpp
index 26bb77ab40a..724937f5105 100644
--- a/audio/softsynth/mt32/Synth.cpp
+++ b/audio/softsynth/mt32/Synth.cpp
@@ -2908,15 +2908,3 @@ void MemoryRegion::write(unsigned int entry, unsigned int off, const Bit8u *src,
 }
 
 } // namespace MT32Emu
-
-#ifdef MT32EMU_WITH_TESTING
-
-#include "test/TestAccessors.h"
-
-using namespace MT32Emu;
-
-const ControlROMMap *Test::getControlROMMap(const char *shortName) {
-	return MT32Emu::getControlROMMap(shortName);
-}
-
-#endif // #ifdef MT32EMU_WITH_TESTING
diff --git a/audio/softsynth/mt32/c_interface/c_interface.cpp b/audio/softsynth/mt32/c_interface/c_interface.cpp
index 7792163ee03..56a27de64ee 100644
--- a/audio/softsynth/mt32/c_interface/c_interface.cpp
+++ b/audio/softsynth/mt32/c_interface/c_interface.cpp
@@ -1017,17 +1017,3 @@ mt32emu_boolean MT32EMU_C_CALL mt32emu_is_default_display_old_mt32_compatible(mt
 }
 
 } // extern "C"
-
-#ifdef MT32EMU_WITH_TESTING
-
-#include "../test/TestAccessors.h"
-
-const MachineConfiguration *Test::findMachineConfiguration(const char *machineID) {
-	return MT32Emu::findMachineConfiguration(machineID);
-}
-
-ReportHandler3 *Test::getReportHandlerDelegate(const mt32emu_data *context) {
-	return context->reportHandler;
-}
-
-#endif // #ifdef MT32EMU_WITH_TESTING




More information about the Scummvm-git-logs mailing list