Skip to content

Commit

Permalink
More fun with M_Pi on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
madskjeldgaard committed Mar 25, 2021
1 parent 2ca051d commit afbb05d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 22 deletions.
13 changes: 1 addition & 12 deletions plugins/ChowDSP/iir.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,7 @@
#include <complex>
/* #include <dsp/common.hpp> */
#include <type_traits>

// This is necessary to get M_PI to work on windows
#ifndef M_PI
namespace {
const double M_PI = std::acos(-1.0);
}
#endif

// Fucking Windows bollocks...
#ifndef M_SQRT2
namespace { const double M_SQRT2 = 1.41421356237309504880; }
#endif
#include "../constants.h"

/** Digital IIR filter processor. Using TDF-II structure:
* https://ccrma.stanford.edu/~jos/filters/Transposed_Direct_Forms.html
Expand Down
11 changes: 8 additions & 3 deletions plugins/constants.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
#pragma once

// Fucking Windows bollocks...

#include <cmath>
#ifndef MK_CONSTANTS
#define MK_CONSTANTS

// This is necessary to get M_PI to work on windows
#ifndef M_PI
namespace {
const double M_PI = std::acos(-1.0);
}
#define M_PI 3.14159265358979323846
#endif

#ifndef M_SQRT2
#define M_SQRT2 1.41421356237309504880
#endif

#endif
8 changes: 1 addition & 7 deletions plugins/mutated/mi-resonator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "math.h"
#include "mi-lookuptables.h"
#include <algorithm>
#include "../constants.h"

#pragma once

Expand Down Expand Up @@ -92,13 +93,6 @@ enum FilterMode {
FILTER_MODE_HIGH_PASS
};

// This is necessary to get M_PI to work on windows
#ifndef M_PI
namespace {
const double M_PI = std::acos(-1.0);
}
#endif

#define M_PI_F float(M_PI)
#define M_PI_POW_2 M_PI *M_PI
#define M_PI_POW_3 M_PI_POW_2 *M_PI
Expand Down

0 comments on commit afbb05d

Please sign in to comment.