changeset 179:433e3aac9e52

Add pi.h. Let's stop messing around with platform-specific defines
author Chris Cannam <c.cannam@qmul.ac.uk>
date Mon, 07 Sep 2015 12:01:14 +0100
parents 2420733abeb6
children 6e4de8beb6b2
files src/dsp/KaiserWindow.h src/dsp/MathUtilities.h src/dsp/SincWindow.h src/dsp/Window.h src/dsp/pi.h
diffstat 5 files changed, 20 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/dsp/KaiserWindow.h	Fri Jul 17 15:49:42 2015 +0100
+++ b/src/dsp/KaiserWindow.h	Mon Sep 07 12:01:14 2015 +0100
@@ -35,6 +35,8 @@
 #include <vector>
 #include <cmath>
 
+#include "pi.h"
+
 /**
  * Kaiser window: A windower whose bandwidth and sidelobe height
  * (signal-noise ratio) can be specified. These parameters are traded
--- a/src/dsp/MathUtilities.h	Fri Jul 17 15:49:42 2015 +0100
+++ b/src/dsp/MathUtilities.h	Mon Sep 07 12:01:14 2015 +0100
@@ -35,6 +35,7 @@
 #include <vector>
 
 #include "nan-inf.h"
+#include "pi.h"
 
 /**
  * Static helper functions for simple mathematical calculations.
--- a/src/dsp/SincWindow.h	Fri Jul 17 15:49:42 2015 +0100
+++ b/src/dsp/SincWindow.h	Mon Sep 07 12:01:14 2015 +0100
@@ -34,6 +34,8 @@
 
 #include <vector>
 
+#include "pi.h"
+
 /**
  * A window containing values of the sinc function, i.e. sin(x)/x with
  * sinc(0) == 1, with x == 0 at the centre.
--- a/src/dsp/Window.h	Fri Jul 17 15:49:42 2015 +0100
+++ b/src/dsp/Window.h	Mon Sep 07 12:01:14 2015 +0100
@@ -29,14 +29,16 @@
     authorization.
 */
 
-#ifndef _WINDOW_H_
-#define _WINDOW_H_
+#ifndef WINDOW_H
+#define WINDOW_H
 
 #include <cmath>
 #include <iostream>
 #include <map>
 #include <vector>
 
+#include "pi.h"
+
 enum WindowType {
     RectangularWindow,
     BartlettWindow,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/dsp/pi.h	Mon Sep 07 12:01:14 2015 +0100
@@ -0,0 +1,11 @@
+
+#ifndef PI_H
+#define PI_H
+
+#include <cmath>
+
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+
+#endif