]> code.bitgloo.com Git - bitgloo/dsp-paw.git/commitdiff
add attenuation example
authorClyne Sullivan <clyne@bitgloo.com>
Tue, 5 Sep 2023 20:38:13 +0000 (16:38 -0400)
committerClyne Sullivan <clyne@bitgloo.com>
Tue, 5 Sep 2023 20:38:13 +0000 (16:38 -0400)
gui/examples/8_attenuation.cpp [new file with mode: 0644]

diff --git a/gui/examples/8_attenuation.cpp b/gui/examples/8_attenuation.cpp
new file mode 100644 (file)
index 0000000..d35c69e
--- /dev/null
@@ -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;
+}
+