Performs the mathematical operation specified by m_operation on the input data. Supports both in-place and out-of-place transformations based on transformer settings.
105 {
107
109 const auto a = get_parameter_or<double>(
"gain_factor", 1.0);
112 });
113 }
114
116 const auto b = get_parameter_or<double>(
"offset_value", 0.0);
119 });
120 }
121
123 const auto exp = get_parameter_or<double>("exponent", 2.0);
126 });
127 }
128
130 const auto a = get_parameter_or<double>(
"scale", 1.0);
131 const auto b = get_parameter_or<double>(
"input_scale", 1.0);
132 const auto c = get_parameter_or<double>("offset", 1.0);
133 const auto base = get_parameter_or<double>("base", std::numbers::e);
136 });
137 }
138
140 const auto a = get_parameter_or<double>(
"scale", 1.0);
141 const auto b = get_parameter_or<double>(
"rate", 1.0);
142 const auto base = get_parameter_or<double>("base", std::numbers::e);
145 });
146 }
147
149 const auto fn = get_parameter_or<std::string>("trig_function", "sin");
150 const auto freq = get_parameter_or<double>("frequency", 1.0);
151 const auto amp = get_parameter_or<double>("amplitude", 1.0);
152 const auto ph = get_parameter_or<double>(
"phase", 0.0);
153 if (fn == "cos")
155 D::apply_trig(ch, [](
double x) {
return std::cos(x); }, freq, amp,
ph);
156 });
157 if (fn == "tan")
159 D::apply_trig(ch, [](
double x) {
return std::tan(x); }, freq, amp,
ph);
160 });
162 D::apply_trig(ch, [](
double x) {
return std::sin(x); }, freq, amp,
ph);
163 });
164 }
165
167 const auto bits = get_parameter_or<uint8_t>("bits", 16);
170 });
171 }
172
174 const auto peak = get_parameter_or<double>(
"target_peak", 1.0);
177 });
178 }
179
181 const auto coeffs = get_parameter_or<std::vector<double>>(
182 "coefficients", std::vector<double> { 0.0, 1.0 });
183 auto poly = std::make_shared<Nodes::Generator::Polynomial>(coeffs);
185 std::ranges::transform(ch, ch.begin(),
186 [&poly](double x) { return poly->process_sample(x); });
187 });
188 }
189
190 default:
192 }
193 }
Core::GlobalInputConfig input
void logarithmic(std::span< double > data, double a, double b, double c, double base) noexcept
Logarithmic map y = a * log_base(b*x + c) applied in-place Values where (b*x + c) <= 0 are mapped to ...
void exponential(std::span< double > data, double a, double b, double base) noexcept
Exponential map y = a * base^(b*x) applied in-place Scalar transcendental — not SIMD hot-path.
void quantize(std::span< double > data, uint8_t bits) noexcept
Quantize to n-bit resolution in-place Input is assumed to be in [-1, 1]; values outside are clamped f...
std::vector< double > power(std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size)
Power (sum of squares) per window.
std::vector< double > peak(std::span< const double > data, size_t n_windows, uint32_t hop_size, uint32_t window_size)
Peak amplitude per window.
void normalize(std::span< double > data, double target_min, double target_max) noexcept
Normalize to [target_min, target_max] in-place Single-pass min/max reduction followed by a single tra...
void linear(std::span< double > data, double a, double b) noexcept
Linear map y = a*x + b applied in-place.
void apply_trig(std::span< double > data, TrigFunc func, double frequency, double amplitude, double phase) noexcept
Trigonometric map y = amplitude * f(frequency*x + phase) applied in-place.
@ GAIN
Linear gain/attenuation.
@ NORMALIZE
Normalization.
@ QUANTIZE
Quantization/bit reduction.
@ TRIGONOMETRIC
Trigonometric functions.
@ LOGARITHMIC
Logarithmic transform.
@ EXPONENTIAL
Exponential transform.
@ POLYNOMIAL
Polynomial transform.