Skip to content

Commit afbb05d

Browse files
More fun with M_Pi on Windows
1 parent 2ca051d commit afbb05d

File tree

3 files changed

+10
-22
lines changed

3 files changed

+10
-22
lines changed

plugins/ChowDSP/iir.hpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,7 @@
33
#include <complex>
44
/* #include <dsp/common.hpp> */
55
#include <type_traits>
6-
7-
// This is necessary to get M_PI to work on windows
8-
#ifndef M_PI
9-
namespace {
10-
const double M_PI = std::acos(-1.0);
11-
}
12-
#endif
13-
14-
// Fucking Windows bollocks...
15-
#ifndef M_SQRT2
16-
namespace { const double M_SQRT2 = 1.41421356237309504880; }
17-
#endif
6+
#include "../constants.h"
187

198
/** Digital IIR filter processor. Using TDF-II structure:
209
* https://ccrma.stanford.edu/~jos/filters/Transposed_Direct_Forms.html

plugins/constants.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
#pragma once
2+
3+
// Fucking Windows bollocks...
4+
25
#include <cmath>
36
#ifndef MK_CONSTANTS
47
#define MK_CONSTANTS
58

69
// This is necessary to get M_PI to work on windows
710
#ifndef M_PI
8-
namespace {
9-
const double M_PI = std::acos(-1.0);
10-
}
11+
#define M_PI 3.14159265358979323846
12+
#endif
13+
14+
#ifndef M_SQRT2
15+
#define M_SQRT2 1.41421356237309504880
1116
#endif
1217

1318
#endif

plugins/mutated/mi-resonator.hpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#include "math.h"
3535
#include "mi-lookuptables.h"
3636
#include <algorithm>
37+
#include "../constants.h"
3738

3839
#pragma once
3940

@@ -92,13 +93,6 @@ enum FilterMode {
9293
FILTER_MODE_HIGH_PASS
9394
};
9495

95-
// This is necessary to get M_PI to work on windows
96-
#ifndef M_PI
97-
namespace {
98-
const double M_PI = std::acos(-1.0);
99-
}
100-
#endif
101-
10296
#define M_PI_F float(M_PI)
10397
#define M_PI_POW_2 M_PI *M_PI
10498
#define M_PI_POW_3 M_PI_POW_2 *M_PI

0 commit comments

Comments
 (0)