diff examples/puredata/xtract~.c @ 85:89b516adb5df

Checked ANSI C89 compliance (basically a few ifndefs for the C99 math functions: powf, roundf etc). Added a few PD examples/tests.
author Jamie Bullock <jamie@postlude.co.uk>
date Mon, 03 Sep 2007 14:31:58 +0000
parents 1222cd753029
children ca40a0dc29d6
line wrap: on
line diff
--- a/examples/puredata/xtract~.c	Sun Sep 02 14:28:00 2007 +0000
+++ b/examples/puredata/xtract~.c	Mon Sep 03 14:31:58 2007 +0000
@@ -27,6 +27,15 @@
 #define BLOCKSIZE 1024 /* FIX: this should be dynamic - somehow */
 #define NYQUIST 22050.0f
 
+#ifndef isnan
+    /* FIX: should probably try to handle signalling NaNs */
+    int isnan(x){ if(x == x) return 0; else return 1;}
+#endif
+
+#ifndef isinf
+    int isinf(x) {if(x == 1.0 / 0. || x == -1.0 / 0.) return 1; else return 0;}
+#endif
+
 static t_class *xtract_class;
 
 /* Struct for keeping track of memory allocations */
@@ -143,7 +152,7 @@
     if(n_args){
 	for(n = 0; n < n_args; n++){
 		    argv_max = &fd[f].argv.max[n]; 
-		    //post("Argument %d, max: %.2f", n, *argv_max);
+		    /*post("Argument %d, max: %.2f", n, *argv_max); */
 	}
 	if(type == XTRACT_MEL_FILTER){
 	    x->memory.argv = (size_t)(n_args * sizeof(xtract_mel_filter));
@@ -249,8 +258,9 @@
     
     int i;
 
+    xtract_function_descriptor_t *fd, *d;
+
     i = XTRACT_FEATURES;
-    xtract_function_descriptor_t *fd, *d;
 
     fd = (xtract_function_descriptor_t *)xtract_make_descriptors();
     post("\nxtract~: Feature List\n");