diff options
author | Colin Snover | 2016-11-25 12:24:08 -0600 |
---|---|---|
committer | Colin Snover | 2016-11-25 12:24:08 -0600 |
commit | df4a503622a524ad8ef47e1c325ac4a711549921 (patch) | |
tree | 29ac9e6d51fd4cd17e4ebe9d1f66ff93abd0cd9d /audio/softsynth/mt32/Analog.cpp | |
parent | b4dbd6d3c275097b4be964b7da4478ff930cbaa7 (diff) | |
download | scummvm-rg350-df4a503622a524ad8ef47e1c325ac4a711549921.tar.gz scummvm-rg350-df4a503622a524ad8ef47e1c325ac4a711549921.tar.bz2 scummvm-rg350-df4a503622a524ad8ef47e1c325ac4a711549921.zip |
Revert "MT32: Update Munt to 2.0.0"
This reverts commit b4dbd6d3c275097b4be964b7da4478ff930cbaa7.
Diffstat (limited to 'audio/softsynth/mt32/Analog.cpp')
-rw-r--r-- | audio/softsynth/mt32/Analog.cpp | 44 |
1 files changed, 29 insertions, 15 deletions
diff --git a/audio/softsynth/mt32/Analog.cpp b/audio/softsynth/mt32/Analog.cpp index a345c77656..8ac28e401a 100644 --- a/audio/softsynth/mt32/Analog.cpp +++ b/audio/softsynth/mt32/Analog.cpp @@ -1,5 +1,5 @@ /* Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009 Dean Beeler, Jerome Fisher - * Copyright (C) 2011-2016 Dean Beeler, Jerome Fisher, Sergey V. Mikayev + * Copyright (C) 2011, 2012, 2013, 2014 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 @@ -15,12 +15,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include <cstring> - -#include "internals.h" - +//#include <cstring> #include "Analog.h" -#include "Synth.h" namespace MT32Emu { @@ -110,6 +106,7 @@ static const Bit32u ACCURATE_LPF_DELTAS_OVERSAMPLED[][ACCURATE_LPF_NUMBER_OF_PHA class AbstractLowPassFilter { public: static AbstractLowPassFilter &createLowPassFilter(AnalogOutputMode mode, bool oldMT32AnalogLPF); + static void muteRingBuffer(SampleEx *ringBuffer, unsigned int length); virtual ~AbstractLowPassFilter() {} virtual SampleEx process(SampleEx sample) = 0; @@ -155,9 +152,9 @@ public: void addPositionIncrement(unsigned int positionIncrement); }; -Analog::Analog(const AnalogOutputMode mode, const bool oldMT32AnalogLPF) : - leftChannelLPF(AbstractLowPassFilter::createLowPassFilter(mode, oldMT32AnalogLPF)), - rightChannelLPF(AbstractLowPassFilter::createLowPassFilter(mode, oldMT32AnalogLPF)), +Analog::Analog(const AnalogOutputMode mode, const ControlROMFeatureSet *controlROMFeatures) : + leftChannelLPF(AbstractLowPassFilter::createLowPassFilter(mode, controlROMFeatures->isOldMT32AnalogLPF())), + rightChannelLPF(AbstractLowPassFilter::createLowPassFilter(mode, controlROMFeatures->isOldMT32AnalogLPF())), synthGain(0), reverbGain(0) {} @@ -167,7 +164,7 @@ Analog::~Analog() { delete &rightChannelLPF; } -void Analog::process(Sample *outStream, const Sample *nonReverbLeft, const Sample *nonReverbRight, const Sample *reverbDryLeft, const Sample *reverbDryRight, const Sample *reverbWetLeft, const Sample *reverbWetRight, Bit32u outLength) { +void Analog::process(Sample **outStream, const Sample *nonReverbLeft, const Sample *nonReverbRight, const Sample *reverbDryLeft, const Sample *reverbDryRight, const Sample *reverbWetLeft, const Sample *reverbWetRight, Bit32u outLength) { if (outStream == NULL) { leftChannelLPF.addPositionIncrement(outLength); rightChannelLPF.addPositionIncrement(outLength); @@ -194,8 +191,8 @@ void Analog::process(Sample *outStream, const Sample *nonReverbLeft, const Sampl outSampleR = rightChannelLPF.process(inSampleR); } - *(outStream++) = Synth::clipSampleEx(outSampleL); - *(outStream++) = Synth::clipSampleEx(outSampleR); + *((*outStream)++) = Synth::clipSampleEx(outSampleL); + *((*outStream)++) = Synth::clipSampleEx(outSampleR); } } @@ -239,6 +236,23 @@ AbstractLowPassFilter &AbstractLowPassFilter::createLowPassFilter(AnalogOutputMo } } +void AbstractLowPassFilter::muteRingBuffer(SampleEx *ringBuffer, unsigned int length) { + +#if MT32EMU_USE_FLOAT_SAMPLES + + SampleEx *p = ringBuffer; + while (length--) { + *(p++) = 0.0f; + } + +#else + + memset(ringBuffer, 0, length * sizeof(SampleEx)); + +#endif + +} + bool AbstractLowPassFilter::hasNextSample() const { return false; } @@ -259,7 +273,7 @@ CoarseLowPassFilter::CoarseLowPassFilter(bool oldMT32AnalogLPF) : LPF_TAPS(oldMT32AnalogLPF ? COARSE_LPF_TAPS_MT32 : COARSE_LPF_TAPS_CM32L), ringBufferPosition(0) { - Synth::muteSampleBuffer(ringBuffer, COARSE_LPF_DELAY_LINE_LENGTH); + muteRingBuffer(ringBuffer, COARSE_LPF_DELAY_LINE_LENGTH); } SampleEx CoarseLowPassFilter::process(const SampleEx inSample) { @@ -289,7 +303,7 @@ AccurateLowPassFilter::AccurateLowPassFilter(const bool oldMT32AnalogLPF, const ringBufferPosition(0), phase(0) { - Synth::muteSampleBuffer(ringBuffer, ACCURATE_LPF_DELAY_LINE_LENGTH); + muteRingBuffer(ringBuffer, ACCURATE_LPF_DELAY_LINE_LENGTH); } SampleEx AccurateLowPassFilter::process(const SampleEx inSample) { @@ -331,4 +345,4 @@ void AccurateLowPassFilter::addPositionIncrement(const unsigned int positionIncr phase = (phase + positionIncrement * phaseIncrement) % ACCURATE_LPF_NUMBER_OF_PHASES; } -} // namespace MT32Emu +} |