From 7bd26deefc2b8fb65118ea3a204ac5e170a6fe81 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Fri, 12 Nov 2021 20:42:20 -0500 Subject: [PATCH] Don't display negative meter measurements. --- src/app/ModuleWidget.cpp | 1 + src/engine/Module.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/ModuleWidget.cpp b/src/app/ModuleWidget.cpp index 63dbf89f..819b3f59 100644 --- a/src/app/ModuleWidget.cpp +++ b/src/app/ModuleWidget.cpp @@ -239,6 +239,7 @@ void ModuleWidget::draw(const DrawArgs& args) { for (int i = 0; i < meterLength; i++) { int index = math::eucMod(meterIndex + i + 1, meterLength); float meter = math::clamp(meterBuffer[index] * sampleRate, 0.f, 1.f); + meter = std::max(0.f, meter); math::Vec p; p.x = (float) i / (meterLength - 1) * box.size.x; p.y = (1.f - meter) * plotHeight; diff --git a/src/engine/Module.cpp b/src/engine/Module.cpp index 1bc3cf39..2f601aa5 100644 --- a/src/engine/Module.cpp +++ b/src/engine/Module.cpp @@ -16,7 +16,7 @@ namespace engine { // Arbitrary prime number so it doesn't over- or under-estimate time of buffered processors. static const int METER_DIVIDER = 37; static const int METER_BUFFER_LEN = 32; -static const float METER_TIME = 0.5f; +static const float METER_TIME = 1.f; struct Module::Internal {