Files
lmms/plugins/Compressor/CompressorControls.cpp
Johannes Lorenz 71ce49d7ba Remove lots of useless/misplaced includes (#7999)
Follow-Up of 7db3fa94a1 .

This was done by setting `CMAKE_C_INCLUDE_WHAT_YOU_USE` and
`CMAKE_CXX_INCLUDE_WHAT_YOU_USE` to (broken down into multiple lines here,
note, all below `FL/x.h` is not required for C):

```
include-what-you-use;
    -Xiwyu;--mapping_file=/usr/share/include-what-you-use/qt5_11.imp;
    -Xiwyu;--keep=*/xmmintrin.h;
    -Xiwyu;--keep=*/lmmsconfig.h;
    -Xiwyu;--keep=*/weak_libjack.h;
    -Xiwyu;--keep=*/sys/*;
    -Xiwyu;--keep=*/debug.h;
    -Xiwyu;--keep=*/SDL/*;
    -Xiwyu;--keep=*/alsa/*;
    -Xiwyu;--keep=*/FL/x.h;
    -Xiwyu;--keep=*/MidiApple.h;
    -Xiwyu;--keep=*/MidiWinMM.h;
    -Xiwyu;--keep=*/AudioSoundIo.h;
    -Xiwyu;--keep=*/OpulenZ/adplug/*;
    -Xiwyu;--keep=QPainterPath;
    -Xiwyu;--keep=QtTest
```

FAQ:

* Q: Does this speed-up a completely fresh compile?
* A: No, I measured it.

* Q: Does it speed up anything else?
* A: Yes. If you change one header, it can reduce the number of CPP files
     that your compiler needs to recompile, or your IDE has to re-scan.

* Q: What other reasons are for this PR?
* A: It's idiomatic to only include headers if you need them. Also, it will
     reduce output for those who want to use IWYU for new PRs.

Background:

This is just a remainder PR of what I planned. My original idea was to setup
a CI which warns you of useless includes (but not of all issues that IWYU
complains about). However, I could not see that this was favored on Discord.
A full IWYU CI also has the problem that it (possibly??) needs to compile
with `make -j 1`, which would make CI really slow.

However, for that plan, I had to fix the whole code base to be IWYU
compliant - which it now is.
2025-07-21 23:39:17 +02:00

147 lines
6.2 KiB
C++
Executable File

/*
* CompressorControls.cpp
*
* Copyright (c) 2020 Lost Robot <r94231@gmail.com>
*
* This file is part of LMMS - https://lmms.io
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation; either
* version 2 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
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program (see COPYING); if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
*/
#include "CompressorControls.h"
#include "Compressor.h"
namespace lmms
{
CompressorControls::CompressorControls(CompressorEffect* effect) :
EffectControls(effect),
m_effect(effect),
m_thresholdModel(-8.0f, -60.0f, 0.0f, 0.001f, this, tr("Threshold")),
m_ratioModel(1.8f, 1.0f, 20.0f, 0.001f, this, tr("Ratio")),
m_attackModel(10.0f, 0.005f, 250.f, 0.001f, this, tr("Attack")),
m_releaseModel(100.0f, 1.f, 2500.f, 0.001f, this, tr("Release")),
m_kneeModel(12.0f, 0.0f, 96.0f, 0.01f, this, tr("Knee")),
m_holdModel(0.0f, 0.0f, 500.0f, 0.01f, this, tr("Hold")),
m_rangeModel(-240.0f, -240.0f, 0.0f, 0.01f, this, tr("Range")),
m_rmsModel(1.0f, 0.0f, 250.0f, 0.01f, this, tr("RMS Size")),
m_midsideModel(0.0f, 0.0f, 1.0f, this, tr("Mid/Side")),
m_peakmodeModel(0.0f, 0.0f, 1.0f, this, tr("Peak Mode")),
m_lookaheadLengthModel(0.0f, 0.0f, 20.0f, 0.0001f, this, tr("Lookahead Length")),
m_inBalanceModel(0.0f, -1.0f, 1.0f, 0.0001f, this, tr("Input Balance")),
m_outBalanceModel(0.0f, -1.0f, 1.0f, 0.0001f, this, tr("Output Balance")),
m_limiterModel(0.f, 0.f, 1.0f, this, tr("Limiter")),
m_outGainModel(0.f, -60.f, 30.f, 0.01f, this, tr("Output Gain")),
m_inGainModel(0.f, -60.f, 30.f, 0.01f, this, tr("Input Gain")),
m_blendModel(1.f, 0.f, 3.f, 0.0001f, this, tr("Blend")),
m_stereoBalanceModel(0.0f, -1.0f, 1.0f, 0.0001f, this, tr("Stereo Balance")),
m_autoMakeupModel(false, this, tr("Auto Makeup Gain")),
m_auditionModel(false, this, tr("Audition")),
m_feedbackModel(false, this, tr("Feedback")),
m_autoAttackModel(0.0f, 0.f, 100.0f, 0.01f, this, tr("Auto Attack")),
m_autoReleaseModel(0.0f, 0.f, 100.0f, 0.01f, this, tr("Auto Release")),
m_lookaheadModel(false, this, tr("Lookahead")),
m_tiltModel(0.0f, -6.0f, 6.0f, 0.0001f, this, tr("Tilt")),
m_tiltFreqModel(150.0f, 20.0f, 20000.0f, 0.1f, this, tr("Tilt Frequency")),
m_stereoLinkModel(1.0f, 0.0f, 4.0f, this, tr("Stereo Link")),
m_mixModel(100.0f, 0.f, 100.0f, 0.01f, this, tr("Mix"))
{
m_ratioModel.setScaleLogarithmic(true);
m_holdModel.setScaleLogarithmic(true);
m_attackModel.setScaleLogarithmic(true);
m_releaseModel.setScaleLogarithmic(true);
m_thresholdModel.setScaleLogarithmic(true);
m_rangeModel.setScaleLogarithmic(true);
m_lookaheadLengthModel.setScaleLogarithmic(true);
m_rmsModel.setScaleLogarithmic(true);
m_kneeModel.setScaleLogarithmic(true);
m_tiltFreqModel.setScaleLogarithmic(true);
m_rangeModel.setScaleLogarithmic(true);
}
void CompressorControls::saveSettings(QDomDocument& doc, QDomElement& _this)
{
m_thresholdModel.saveSettings(doc, _this, "threshold");
m_ratioModel.saveSettings(doc, _this, "ratio");
m_attackModel.saveSettings(doc, _this, "attack");
m_releaseModel.saveSettings(doc, _this, "release");
m_kneeModel.saveSettings(doc, _this, "knee");
m_holdModel.saveSettings(doc, _this, "hold");
m_rangeModel.saveSettings(doc, _this, "range");
m_rmsModel.saveSettings(doc, _this, "rms");
m_midsideModel.saveSettings(doc, _this, "midside");
m_peakmodeModel.saveSettings(doc, _this, "peakmode");
m_lookaheadLengthModel.saveSettings(doc, _this, "lookaheadLength");
m_inBalanceModel.saveSettings(doc, _this, "inBalance");
m_outBalanceModel.saveSettings(doc, _this, "outBalance");
m_limiterModel.saveSettings(doc, _this, "limiter");
m_outGainModel.saveSettings(doc, _this, "outGain");
m_inGainModel.saveSettings(doc, _this, "inGain");
m_blendModel.saveSettings(doc, _this, "blend");
m_stereoBalanceModel.saveSettings(doc, _this, "stereoBalance");
m_autoMakeupModel.saveSettings(doc, _this, "autoMakeup");
m_auditionModel.saveSettings(doc, _this, "audition");
m_feedbackModel.saveSettings(doc, _this, "feedback");
m_autoAttackModel.saveSettings(doc, _this, "autoAttack");
m_autoReleaseModel.saveSettings(doc, _this, "autoRelease");
m_lookaheadModel.saveSettings(doc, _this, "lookahead");
m_tiltModel.saveSettings(doc, _this, "tilt");
m_tiltFreqModel.saveSettings(doc, _this, "tiltFreq");
m_stereoLinkModel.saveSettings(doc, _this, "stereoLink");
m_mixModel.saveSettings(doc, _this, "mix");
}
void CompressorControls::loadSettings(const QDomElement& _this)
{
m_thresholdModel.loadSettings(_this, "threshold");
m_ratioModel.loadSettings(_this, "ratio");
m_attackModel.loadSettings(_this, "attack");
m_releaseModel.loadSettings(_this, "release");
m_kneeModel.loadSettings(_this, "knee");
m_holdModel.loadSettings(_this, "hold");
m_rangeModel.loadSettings(_this, "range");
m_rmsModel.loadSettings(_this, "rms");
m_midsideModel.loadSettings(_this, "midside");
m_peakmodeModel.loadSettings(_this, "peakmode");
m_lookaheadLengthModel.loadSettings(_this, "lookaheadLength");
m_inBalanceModel.loadSettings(_this, "inBalance");
m_outBalanceModel.loadSettings(_this, "outBalance");
m_limiterModel.loadSettings(_this, "limiter");
m_outGainModel.loadSettings(_this, "outGain");
m_inGainModel.loadSettings(_this, "inGain");
m_blendModel.loadSettings(_this, "blend");
m_stereoBalanceModel.loadSettings(_this, "stereoBalance");
m_autoMakeupModel.loadSettings(_this, "autoMakeup");
m_auditionModel.loadSettings(_this, "audition");
m_feedbackModel.loadSettings(_this, "feedback");
m_autoAttackModel.loadSettings(_this, "autoAttack");
m_autoReleaseModel.loadSettings(_this, "autoRelease");
m_lookaheadModel.loadSettings(_this, "lookahead");
m_tiltModel.loadSettings(_this, "tilt");
m_tiltFreqModel.loadSettings(_this, "tiltFreq");
m_stereoLinkModel.loadSettings(_this, "stereoLink");
m_mixModel.loadSettings(_this, "mix");
}
} // namespace lmms