fsh::stk
fantastic spatial holophonic synthesis toolkit
Loading...
Searching...
No Matches
Distortion.h
1/***************************************************************************************************
2 ██████ █████ █████ █████
3 ███░░███ ░░███ ░░███ ░░███
4 ░███ ░░░ █████ ░███████ ██ ██ █████ ███████ ░███ █████
5 ███████ ███░░ ░███░░███ ░░ ░░ ███░░ ░░░███░ ░███░░███
6 ░░░███░ ░░█████ ░███ ░███ ░░█████ ░███ ░██████░
7 ░███ ░░░░███ ░███ ░███ ░░░░███ ░███ ███ ░███░░███
8 █████ ██████ ████ █████ ██ ██ ██████ ░░█████ ████ █████
9 ░░░░░ ░░░░░░ ░░░░ ░░░░░ ░░ ░░ ░░░░░░ ░░░░░ ░░░░ ░░░░░
10
11 fantastic spatial holophonic synthesis tool kit
12
13 copyright (c) fabian hummel
14 www.github.com/fshstk
15 www.fshstk.com
16
17 this file is part of the fantastic spatial holophonic software toolkit (fsh::stk)
18 fsh::stk is free software: it is provided under the terms of the gnu general public license v3.0
19 www.gnu.org/licenses/gpl-3.0
20***************************************************************************************************/
21
22#pragma once
23#include <cmath>
24#include <functional>
25
26namespace fsh::fx
27{
36{
37public:
39 struct Params
40 {
42 float preGain = 0.0f;
43
45 std::function<float(float)> function = [](float x) { return std::tanh(x); };
46 };
47
49 void setParams(const Params&);
50
52 auto processSample(float) const -> float;
53
54private:
55 Params _params;
56};
57} // namespace fsh::fx
Distortion/modulation effect class.
Definition Distortion.h:36
auto processSample(float) const -> float
Processes a single sample through the distortion effect.
Definition Distortion.cpp:32
void setParams(const Params &)
Sets the parameters for the distortion effect.
Definition Distortion.cpp:27
The parameters for the distortion effect.
Definition Distortion.h:40
std::function< float(float)> function
Distortion function which is applied to the signal.
Definition Distortion.h:45
float preGain
Gain (dB), which is applied to the input signal.
Definition Distortion.h:42