aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gui/examples/8_attenuation.cpp12
1 files changed, 12 insertions, 0 deletions
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;
+}
+