aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClyne Sullivan <clyne@bitgloo.com>2023-09-05 16:38:13 -0400
committerClyne Sullivan <clyne@bitgloo.com>2023-09-05 16:38:13 -0400
commit54e1e399ee8079a8b9d9f9093dd8330e27ccbdc9 (patch)
treefc96a389afd1f10e7e89a4d5cf6dcfff19cadb71
parent3dcfa5b7fd40edc804bff928a64c41d25d7e7a50 (diff)
add attenuation example
-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;
+}
+