aboutsummaryrefslogtreecommitdiff
path: root/blackman~.c
diff options
context:
space:
mode:
Diffstat (limited to 'blackman~.c')
-rw-r--r--blackman~.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/blackman~.c b/blackman~.c
index 1e48fcd..af4732f 100644
--- a/blackman~.c
+++ b/blackman~.c
@@ -20,14 +20,30 @@
*/
#include "m_pd.h"
-#include "windowFunctions.h"
#include <stdlib.h>
-#ifdef NT
+#include <math.h>
+
+#ifdef _WIN32
+#define M_PI 3.14159265358979323846
+#endif
+
+#ifdef _MSC_VER
#pragma warning( disable : 4244 )
#pragma warning( disable : 4305 )
#endif
+
#define DEFBLOCKSIZE 64
+void fillBlackman(float *vec, int n) {
+ int i;
+ float xShift = (float)n / 2;
+ float x;
+ for (i = 0; i < n; i++) {
+ x = (i - xShift) / xShift;
+ vec[i] = (float)(0.42 + (0.5 * cos(M_PI * x)) + (0.08 * cos (2 * M_PI * x)));
+ }
+}
+
static t_class *blackman_class;
typedef struct _blackman {