From 7f40fa9ed5d69b6b214de02263fce53354c5aa3b Mon Sep 17 00:00:00 2001 From: Steve Russell Date: Sat, 15 Mar 2025 02:22:54 +0000 Subject: [PATCH] Add PR https://github.com/VCVRack/Rack/pull/1938 --- include/app/common.hpp | 4 ++-- include/dsp/common.hpp | 6 +++--- include/engine/Port.hpp | 2 +- include/window/Svg.hpp | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/app/common.hpp b/include/app/common.hpp index df20dc27..85b215e3 100644 --- a/include/app/common.hpp +++ b/include/app/common.hpp @@ -15,8 +15,8 @@ namespace app { // A 1HPx3U module should be 15x380 pixels. Thus the width of a module should be a factor of 15. -static const float RACK_GRID_WIDTH = 15; -static const float RACK_GRID_HEIGHT = 380; +static constexpr const float RACK_GRID_WIDTH = 15; +static constexpr const float RACK_GRID_HEIGHT = 380; static const math::Vec RACK_GRID_SIZE = math::Vec(RACK_GRID_WIDTH, RACK_GRID_HEIGHT); static const math::Vec RACK_OFFSET = RACK_GRID_SIZE.mult(math::Vec(2000, 100)); diff --git a/include/dsp/common.hpp b/include/dsp/common.hpp index f2b3a621..1fe12e5e 100644 --- a/include/dsp/common.hpp +++ b/include/dsp/common.hpp @@ -14,9 +14,9 @@ namespace dsp { // Constants -static const float FREQ_C4 = 261.6256f; -static const float FREQ_A4 = 440.0000f; -static const float FREQ_SEMITONE = 1.0594630943592953f; +static constexpr const float FREQ_C4 = 261.6256f; +static constexpr const float FREQ_A4 = 440.0000f; +static constexpr const float FREQ_SEMITONE = 1.0594630943592953f; // Mathematical functions diff --git a/include/engine/Port.hpp b/include/engine/Port.hpp index cc521fe3..62fe52d2 100644 --- a/include/engine/Port.hpp +++ b/include/engine/Port.hpp @@ -8,7 +8,7 @@ namespace engine { /** This is inspired by the number of MIDI channels. */ -static const int PORT_MAX_CHANNELS = 16; +static constexpr const int PORT_MAX_CHANNELS = 16; struct Port { diff --git a/include/window/Svg.hpp b/include/window/Svg.hpp index 4df1646b..012b549a 100644 --- a/include/window/Svg.hpp +++ b/include/window/Svg.hpp @@ -13,8 +13,8 @@ namespace window { /** Arbitrary DPI, standardized for Rack. */ -static const float SVG_DPI = 75.f; -static const float MM_PER_IN = 25.4f; +static constexpr const float SVG_DPI = 75.f; +static constexpr const float MM_PER_IN = 25.4f; /** Converts inch measurements to pixels */