summaryrefslogtreecommitdiffstats
path: root/src/effects
diff options
context:
space:
mode:
authorFerran Pujol Camins <ferranpujolcamins@gmail.com>2022-10-08 11:36:46 +0200
committerFerran Pujol Camins <ferranpujolcamins@gmail.com>2022-10-08 11:40:34 +0200
commit35890cbf8e182566ab6b4e0e72ac15066a02d6b7 (patch)
tree02dccd8fb0f85129e19305bf0758c3ce41895304 /src/effects
parent77e77409f8a4811ec7bfa283e588e590c55208cf (diff)
Remove folding algorithms
Diffstat (limited to 'src/effects')
-rw-r--r--src/effects/backends/builtin/distortioneffect.cpp49
-rw-r--r--src/effects/backends/builtin/distortioneffect.h4
2 files changed, 4 insertions, 49 deletions
diff --git a/src/effects/backends/builtin/distortioneffect.cpp b/src/effects/backends/builtin/distortioneffect.cpp
index b9b196b1bd..2e7f45dce4 100644
--- a/src/effects/backends/builtin/distortioneffect.cpp
+++ b/src/effects/backends/builtin/distortioneffect.cpp
@@ -27,17 +27,14 @@ EffectManifestPointer DistortionEffect::getManifest() {
EffectManifestParameterPointer mode = pManifest->addParameter();
mode->setId("mode");
- mode->setName(QObject::tr("Mode"));
- mode->setShortName(QObject::tr("Mode"));
+ mode->setName(QObject::tr("Hard Clip"));
+ mode->setShortName(QObject::tr("Hard"));
mode->setDescription(QObject::tr(
- "The type of distortion to apply. Each type will sound different, "
- "ranging from soft saturation to hard clipping."));
+ "Switches between soft saturation and hard clipping."));
mode->setValueScaler(EffectManifestParameter::ValueScaler::Toggle);
- mode->setRange(0, 0, 4);
+ mode->setRange(0, 0, 2);
mode->appendStep(qMakePair(QObject::tr("Soft Clipping"), Mode::SoftClipping));
mode->appendStep(qMakePair(QObject::tr("Hard Clipping"), Mode::HardClipping));
- mode->appendStep(qMakePair(QObject::tr("Soft Folding"), Mode::SoftFolding));
- mode->appendStep(qMakePair(QObject::tr("Hard Folding"), Mode::HardFolding));
EffectManifestParameterPointer drive = pManifest->addParameter();
drive->setId("drive");
@@ -83,34 +80,6 @@ struct DistortionEffect::HardClippingParameters {
}
};
-struct DistortionEffect::SoftFoldingParameters {
- static constexpr const CSAMPLE normalizationLevel = 0.3f;
- static constexpr const CSAMPLE crossfadeEndParam = 0.2f;
- static constexpr const CSAMPLE_GAIN maxDriveGain = 20.f;
-
- static CSAMPLE process(CSAMPLE sample) {
- return std::sin(sample);
- }
-};
-
-struct DistortionEffect::HardFoldingParameters {
- static constexpr const CSAMPLE normalizationLevel = 0.8f;
- static constexpr const CSAMPLE crossfadeEndParam = 0.2f;
- static constexpr const CSAMPLE_GAIN maxDriveGain = 15.f;
-
- static CSAMPLE process(CSAMPLE sample) {
- while (true) {
- if (sample > 1.0) {
- sample = 2.f - sample; // equivalent to 1 - (newSample - 1.0)
- } else if (sample < -1.0) {
- sample = -2.f - sample; // equivalent to -1 + (-newSample - 1.0)
- } else {
- return sample;
- }
- }
- }
-};
-
void DistortionEffect::loadEngineEffectParameters(
const QMap<QString, EngineEffectParameterPointer>& parameters) {
m_pMode = parameters.value("mode");
@@ -148,16 +117,6 @@ void DistortionEffect::processChannel(
driveParam, pState, pOutput, pInput, engineParameters);
break;
- case SoftFolding:
- processDistortion<SoftFoldingParameters>(
- driveParam, pState, pOutput, pInput, engineParameters);
- break;
-
- case HardFolding:
- processDistortion<HardFoldingParameters>(
- driveParam, pState, pOutput, pInput, engineParameters);
- break;
-
default:
// We should never enter here, but we act as a noop effect just in case.
SampleUtil::copy(pOutput, pInput, numSamples);
diff --git a/src/effects/backends/builtin/distortioneffect.h b/src/effects/backends/builtin/distortioneffect.h
index b0a415df1b..f7a74d7046 100644
--- a/src/effects/backends/builtin/distortioneffect.h
+++ b/src/effects/backends/builtin/distortioneffect.h
@@ -42,14 +42,10 @@ class DistortionEffect : public EffectProcessorImpl<DistortionGroupState> {
enum Mode {
SoftClipping = 0,
HardClipping = 1,
- SoftFolding = 2,
- HardFolding = 3
};
struct SoftClippingParameters;
struct HardClippingParameters;
- struct SoftFoldingParameters;
- struct HardFoldingParameters;
template<typename ModeParams>
void processDistortion(CSAMPLE driveParam,