From 54e1e399ee8079a8b9d9f9093dd8330e27ccbdc9 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Tue, 5 Sep 2023 16:38:13 -0400 Subject: [PATCH] add attenuation example --- gui/examples/8_attenuation.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 gui/examples/8_attenuation.cpp diff --git a/gui/examples/8_attenuation.cpp b/gui/examples/8_attenuation.cpp new file mode 100644 index 0000000..d35c69e --- /dev/null +++ b/gui/examples/8_attenuation.cpp @@ -0,0 +1,12 @@ +Sample* process_data(Samples samples) +{ + const auto p = param1(); + const float scale = p / 4095.f; + const auto offset = (4095 - p) / 2; + + for (int i = 0; i < SIZE; ++i) + samples[i] = samples[i] * scale + offset; + + return samples; +} +