From 6345b01dd800175bb3fa601af29ac4ae22c9d8c7 Mon Sep 17 00:00:00 2001 From: Michael Dewberry Date: Fri, 5 Jan 2024 23:28:39 -0500 Subject: [PATCH] Allow CV outputs to hit precisely zero (fix #187) --- src/common/core/LibAVR32Module.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/common/core/LibAVR32Module.hpp b/src/common/core/LibAVR32Module.hpp index 28688b6..7263a82 100644 --- a/src/common/core/LibAVR32Module.hpp +++ b/src/common/core/LibAVR32Module.hpp @@ -93,6 +93,11 @@ struct LibAVR32Module : rack::engine::Module, GridConsumerBase inline float LibAVR32Module::dacToVolts(uint16_t dac) { + // special case 0 so CV outs used as gates hit true zero (see issue #187) + if (dac == 0) { + return 0; + } + // 12 bits of information left aligned in a 16-bit word, add a small offset to get the 12-bit data closer to true return (10.0 * dac / (0xFFFF * 1.0)) + dacOffsetVolts; }