diff options
author | Clyne Sullivan <clyne@bitgloo.com> | 2023-09-05 16:38:13 -0400 |
---|---|---|
committer | Clyne Sullivan <clyne@bitgloo.com> | 2023-09-05 16:38:13 -0400 |
commit | 54e1e399ee8079a8b9d9f9093dd8330e27ccbdc9 (patch) | |
tree | fc96a389afd1f10e7e89a4d5cf6dcfff19cadb71 | |
parent | 3dcfa5b7fd40edc804bff928a64c41d25d7e7a50 (diff) |
add attenuation example
-rw-r--r-- | gui/examples/8_attenuation.cpp | 12 |
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; +} + |