Run in Linux

- Define Pi to avoid running into too many feature test macros
- Define _DEFAULT_SOURCE if not in OpenBSD
- Add a play target that works in Linux
This commit is contained in:
Lucas 2020-05-14 00:54:51 +00:00
parent afbe512452
commit 06f6a4881c
4 changed files with 25 additions and 2 deletions

View file

@ -15,6 +15,13 @@
#include <math.h>
/*
* Apparently, it's too hard for OSes to expose M_PI in a portable way.
* Definition taken from
* $OpenBSD: math.h,v 1.36 2018/03/10 20:52:58 kettenis Exp $
*/
#define JUST_PI ((double)3.14159265358979323846)
#define CLAMP(x, a, b) ((x) < (a) ? (a) : (x) > (b) ? (b) : (x))
double
@ -27,7 +34,7 @@ synth_distortion(double gain, double x)
double
synth_sinewave(double t, double a)
{
return sin(2.0 * M_PI * t * a);
return sin(2.0 * JUST_PI * t * a);
}
double