Browse Source

Use constexpr for static const values whenever possible

Signed-off-by: falkTX <falktx@falktx.com>
pull/1938/head
falkTX 3 years ago
parent
commit
e3f8f16c12
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
4 changed files with 8 additions and 8 deletions
  1. +2
    -2
      include/app/common.hpp
  2. +3
    -3
      include/dsp/common.hpp
  3. +1
    -1
      include/engine/Port.hpp
  4. +2
    -2
      include/window/Svg.hpp

+ 2
- 2
include/app/common.hpp View File

@@ -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));



+ 3
- 3
include/dsp/common.hpp View File

@@ -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



+ 1
- 1
include/engine/Port.hpp View File

@@ -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 {


+ 2
- 2
include/window/Svg.hpp View File

@@ -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 */


Loading…
Cancel
Save