aboutsummaryrefslogtreecommitdiff
path: root/lanczos~.c
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2007-12-13 05:28:54 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2007-12-13 05:28:54 +0000
commitc70554786db3e32ce5601b11d29d25db08cb2b37 (patch)
tree9ef0d1b4f7a54797ae8b8198910ab08c4858326d /lanczos~.c
parent1979f4b826560ec32ebb77c3c2c0e8506498b162 (diff)
- reorganized files to build easy with Pd-extended.
- updated NT macro to _MSC_VER since those pragmas are for MSVC only - put each object's "fill" function into that object's .c file, - added i0.c to the end of kaiser~.c since that's the only one that needs it - added #define powf pow for _WIN32 and Mac OS X for gaussian~.c since those platforms don't have single precision pow() by default svn path=/trunk/externals/windowing/; revision=9092
Diffstat (limited to 'lanczos~.c')
-rw-r--r--lanczos~.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/lanczos~.c b/lanczos~.c
index 422b020..b14f676 100644
--- a/lanczos~.c
+++ b/lanczos~.c
@@ -20,14 +20,35 @@
*/
#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 fillLanczos(float *vec, int n) {
+ int i;
+ float xShift = (float)n / 2;
+ float x;
+ for (i = 0; i < n; i++) {
+ x = (i - xShift) / xShift;
+ if (x == 0) {
+ vec[i] = 1;
+ }
+ else {
+ vec[i] = (float)(sin(M_PI * x) / (M_PI * x));
+ }
+ }
+}
+
static t_class *lanczos_class;
typedef struct _lanczos {