Skip to content

Commit

Permalink
Allow CV outputs to hit precisely zero (fix #187)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dewb committed Jan 6, 2024
1 parent 48d8ebf commit 450d9f5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/common/core/LibAVR32Module.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 450d9f5

Please sign in to comment.