mirror of
https://github.com/LMMS/lmms.git
synced 2026-04-10 09:08:26 -04:00
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.
149 lines
5.7 KiB
C++
Executable File
149 lines
5.7 KiB
C++
Executable File
/*
|
|
* GranularPitchShifterControls.cpp
|
|
*
|
|
* Copyright (c) 2024 Lost Robot <r94231/at/gmail/dot/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 "GranularPitchShifterControls.h"
|
|
#include "GranularPitchShifterEffect.h"
|
|
|
|
namespace lmms
|
|
{
|
|
|
|
GranularPitchShifterControls::GranularPitchShifterControls(GranularPitchShifterEffect* effect) :
|
|
EffectControls(effect),
|
|
m_effect(effect),
|
|
m_pitchModel(1.f, -48.f, 24.f, 0.01f, this, tr("Pitch")),
|
|
m_sizeModel(10.f, 2.f, 1000.f, 0.001f, this, tr("Grain Size")),
|
|
m_sprayModel(0.005f, 0.f, 0.5f, 0.0001f, this, tr("Spray")),
|
|
m_jitterModel(0.f, 0.f, 1.f, 0.0001f, this, tr("Jitter")),
|
|
m_twitchModel(0.f, 0.f, 1.f, 0.0001f, this, tr("Twitch")),
|
|
m_pitchSpreadModel(0.f, -24.f, 24.f, 0.01f, this, tr("Pitch Stereo Spread")),
|
|
m_spraySpreadModel(0.f, 0.f, 1.f, 0.0001f, this, tr("Spray Stereo")),
|
|
m_shapeModel(2.f, 1.f, 2.f, 0.0001f, this, tr("Shape")),
|
|
m_fadeLengthModel(1.f, 0.001f, 1.f, 0.00001f, this, tr("Fade Length")),
|
|
m_feedbackModel(0.f, 0.f, 1.f, 0.00001f, this, tr("Feedback")),
|
|
m_minLatencyModel(0.01f, 0.f, 1.f, 0.00001f, this, tr("Minimum Allowed Latency")),
|
|
m_prefilterModel(true, this, tr("Prefilter")),
|
|
m_densityModel(1.f, 1.f, 16.f, 0.0001f, this, tr("Density")),
|
|
m_glideModel(0.01f, 0.f, 1.f, 0.0001f, this, tr("Glide")),
|
|
m_rangeModel(this, tr("Ring Buffer Length"))
|
|
{
|
|
m_sizeModel.setScaleLogarithmic(true);
|
|
m_sprayModel.setScaleLogarithmic(true);
|
|
m_spraySpreadModel.setScaleLogarithmic(true);
|
|
m_minLatencyModel.setScaleLogarithmic(true);
|
|
m_densityModel.setScaleLogarithmic(true);
|
|
m_glideModel.setScaleLogarithmic(true);
|
|
|
|
m_rangeModel.addItem(tr("5 Seconds"));
|
|
m_rangeModel.addItem(tr("10 Seconds (Size)"));
|
|
m_rangeModel.addItem(tr("40 Seconds (Size and Pitch)"));
|
|
m_rangeModel.addItem(tr("40 Seconds (Size and Spray and Jitter)"));
|
|
m_rangeModel.addItem(tr("120 Seconds (All of the above)"));
|
|
|
|
connect(&m_rangeModel, &ComboBoxModel::dataChanged, this, &GranularPitchShifterControls::updateRange);
|
|
}
|
|
|
|
void GranularPitchShifterControls::updateRange()
|
|
{
|
|
switch (m_rangeModel.value())
|
|
{
|
|
case 0:// 5 seconds
|
|
m_sizeModel.setRange(4.f, 1000.f, 0.001f);
|
|
m_pitchModel.setRange(-48.f, 24.f, 0.01f);
|
|
m_sprayModel.setRange(0.f, 0.5f, 0.0001f);
|
|
m_jitterModel.setRange(0.f, 1.f, 0.0001f);
|
|
break;
|
|
case 1:// 10 seconds (size)
|
|
m_sizeModel.setRange(2.f, 1000.f, 0.001f);
|
|
m_pitchModel.setRange(-48.f, 24.f, 0.01f);
|
|
m_sprayModel.setRange(0.f, 0.5f, 0.0001f);
|
|
m_jitterModel.setRange(0.f, 1.f, 0.0001f);
|
|
break;
|
|
case 2:// 40 seconds (size and pitch)
|
|
m_sizeModel.setRange(2.f, 1000.f, 0.001f);
|
|
m_pitchModel.setRange(-48.f, 48.f, 0.01f);
|
|
m_sprayModel.setRange(0.f, 0.5f, 0.0001f);
|
|
m_jitterModel.setRange(0.f, 1.f, 0.0001f);
|
|
break;
|
|
case 3:// 40 seconds (size and spray and jitter)
|
|
m_sizeModel.setRange(2.f, 1000.f, 0.001f);
|
|
m_pitchModel.setRange(-48.f, 24.f, 0.01f);
|
|
m_sprayModel.setRange(0.f, 20.f, 0.0001f);
|
|
m_jitterModel.setRange(0.f, 2.f, 0.0001f);
|
|
break;
|
|
case 4:// 120 seconds (all of the above)
|
|
m_sizeModel.setRange(2.f, 1000.f, 0.001f);
|
|
m_pitchModel.setRange(-48.f, 48.f, 0.01f);
|
|
m_sprayModel.setRange(0.f, 40.f, 0.0001f);
|
|
m_jitterModel.setRange(0.f, 2.f, 0.0001f);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
m_effect->sampleRateNeedsUpdate();
|
|
}
|
|
|
|
void GranularPitchShifterControls::loadSettings(const QDomElement& parent)
|
|
{
|
|
// must be loaded first so the ranges are set properly
|
|
m_rangeModel.loadSettings(parent, "range");
|
|
|
|
m_pitchModel.loadSettings(parent, "pitch");
|
|
m_sizeModel.loadSettings(parent, "size");
|
|
m_sprayModel.loadSettings(parent, "spray");
|
|
m_jitterModel.loadSettings(parent, "jitter");
|
|
m_twitchModel.loadSettings(parent, "twitch");
|
|
m_pitchSpreadModel.loadSettings(parent, "pitchSpread");
|
|
m_spraySpreadModel.loadSettings(parent, "spraySpread");
|
|
m_shapeModel.loadSettings(parent, "shape");
|
|
m_fadeLengthModel.loadSettings(parent, "fadeLength");
|
|
m_feedbackModel.loadSettings(parent, "feedback");
|
|
m_minLatencyModel.loadSettings(parent, "minLatency");
|
|
m_prefilterModel.loadSettings(parent, "prefilter");
|
|
m_densityModel.loadSettings(parent, "density");
|
|
m_glideModel.loadSettings(parent, "glide");
|
|
}
|
|
|
|
void GranularPitchShifterControls::saveSettings(QDomDocument& doc, QDomElement& parent)
|
|
{
|
|
m_rangeModel.saveSettings(doc, parent, "range");
|
|
m_pitchModel.saveSettings(doc, parent, "pitch");
|
|
m_sizeModel.saveSettings(doc, parent, "size");
|
|
m_sprayModel.saveSettings(doc, parent, "spray");
|
|
m_jitterModel.saveSettings(doc, parent, "jitter");
|
|
m_twitchModel.saveSettings(doc, parent, "twitch");
|
|
m_pitchSpreadModel.saveSettings(doc, parent, "pitchSpread");
|
|
m_spraySpreadModel.saveSettings(doc, parent, "spraySpread");
|
|
m_shapeModel.saveSettings(doc, parent, "shape");
|
|
m_fadeLengthModel.saveSettings(doc, parent, "fadeLength");
|
|
m_feedbackModel.saveSettings(doc, parent, "feedback");
|
|
m_minLatencyModel.saveSettings(doc, parent, "minLatency");
|
|
m_prefilterModel.saveSettings(doc, parent, "prefilter");
|
|
m_densityModel.saveSettings(doc, parent, "density");
|
|
m_glideModel.saveSettings(doc, parent, "glide");
|
|
}
|
|
|
|
|
|
} // namespace lmms
|