Round 1 findings and fixes, all previously uncommitted: - FXProcessor per-slot DSP history repair (HEAD does not compile without it) - SynthVoice::getModulationValue, editor control-lock guard - ExactCompare.h naming the deliberate exact float comparisons - KnobLookAndFeel replacing the never-installed SerumLookAndFeel - 55 first-party compiler warnings to 0 - AGENT.md renamed to AGENTS.md across Source/ - graft repository context graph and its hooks - JANITOR_TASKS.md and UI_UX_AUDIT.md records
43 lines
1.5 KiB
C++
43 lines
1.5 KiB
C++
#pragma once
|
|
|
|
// Exact floating-point comparison helpers.
|
|
//
|
|
// The engine caches derived state - filter coefficients, per-voice parameter
|
|
// snapshots, GUI preview values - and re-derives it only when a stored value
|
|
// changes. Those checks must stay bit-exact: an epsilon compare would either
|
|
// keep stale cached state or skip a needed rebuild near the threshold, so the
|
|
// intent is named here instead of weakened at each call site.
|
|
//
|
|
// Every first-party use of == / != on floating point goes through one of these
|
|
// helpers, and the single -Wfloat-equal suppression lives here rather than
|
|
// being repeated across the call sites.
|
|
|
|
#include <cmath>
|
|
|
|
#if defined(__GNUC__) || defined(__clang__)
|
|
#pragma GCC diagnostic push
|
|
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
|
#endif
|
|
|
|
namespace serum
|
|
{
|
|
|
|
// Exact equality, no epsilon. Used where the exact value carries meaning, such
|
|
// as "the output level is exactly unity" or "the untouched tail is the zero
|
|
// default".
|
|
inline bool exactly (float a, float b) noexcept { return a == b; }
|
|
inline bool exactly (double a, double b) noexcept { return a == b; }
|
|
|
|
// Exact inequality, for "the cached value changed" tests.
|
|
inline bool changed (float a, float b) noexcept { return a != b; }
|
|
inline bool changed (double a, double b) noexcept { return a != b; }
|
|
|
|
// True when a stored double that should hold a whole number really does.
|
|
inline bool isWholeNumber (double v) noexcept { return std::floor (v) == v; }
|
|
|
|
} // namespace serum
|
|
|
|
#if defined(__GNUC__) || defined(__clang__)
|
|
#pragma GCC diagnostic pop
|
|
#endif
|