diff --git a/src/pcm/Normalizer.cxx b/src/pcm/Normalizer.cxx index 982e52a69..de1cf893d 100644 --- a/src/pcm/Normalizer.cxx +++ b/src/pcm/Normalizer.cxx @@ -42,7 +42,7 @@ PcmNormalizer::ProcessS16(int16_t *gcc_restrict dest, int newGain = (1 << 10)*target/peakVal; //! Adjust the gain with inertia from the previous gain value - int curGain = gain[pos]; + int curGain = prev_gain; newGain = (curGain*((1 << smooth) - 1) + newGain) >> smooth; //! Make sure it's no more than the maximum gain value @@ -63,7 +63,7 @@ PcmNormalizer::ProcessS16(int16_t *gcc_restrict dest, } //! Record the new gain - gain[slot] = newGain; + prev_gain = newGain; if (!ramp) ramp = 1; diff --git a/src/pcm/Normalizer.hxx b/src/pcm/Normalizer.hxx index 93dff4f81..155f16d18 100644 --- a/src/pcm/Normalizer.hxx +++ b/src/pcm/Normalizer.hxx @@ -21,8 +21,7 @@ class PcmNormalizer { //! History of the peak values int *const peaks; - //! History of the gain values - int *const gain; + int prev_gain = 0; std::size_t pos = 0; const std::size_t bufsz; @@ -30,14 +29,12 @@ class PcmNormalizer { public: PcmNormalizer(std::size_t history=400) noexcept :peaks(new int[history]{}), - gain(new int[history]{}), bufsz(history) { } ~PcmNormalizer() noexcept { delete[] peaks; - delete[] gain; } //! Process 16-bit signed data @@ -45,5 +42,3 @@ public: }; //! TODO: Compressor_Process_int32, Compressor_Process_float, others as needed - -//! TODO: functions for getting at the peak/gain/clip history buffers (for monitoring)