comparison 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
comparison
equal deleted inserted replaced
84:7c8edb20f740 85:89b516adb5df
24 24
25 #include "xtract/libxtract.h" 25 #include "xtract/libxtract.h"
26 26
27 #define BLOCKSIZE 1024 /* FIX: this should be dynamic - somehow */ 27 #define BLOCKSIZE 1024 /* FIX: this should be dynamic - somehow */
28 #define NYQUIST 22050.0f 28 #define NYQUIST 22050.0f
29
30 #ifndef isnan
31 /* FIX: should probably try to handle signalling NaNs */
32 int isnan(x){ if(x == x) return 0; else return 1;}
33 #endif
34
35 #ifndef isinf
36 int isinf(x) {if(x == 1.0 / 0. || x == -1.0 / 0.) return 1; else return 0;}
37 #endif
29 38
30 static t_class *xtract_class; 39 static t_class *xtract_class;
31 40
32 /* Struct for keeping track of memory allocations */ 41 /* Struct for keeping track of memory allocations */
33 typedef struct _tracked_memory { 42 typedef struct _tracked_memory {
141 type = fd[f].argv.type; 150 type = fd[f].argv.type;
142 151
143 if(n_args){ 152 if(n_args){
144 for(n = 0; n < n_args; n++){ 153 for(n = 0; n < n_args; n++){
145 argv_max = &fd[f].argv.max[n]; 154 argv_max = &fd[f].argv.max[n];
146 //post("Argument %d, max: %.2f", n, *argv_max); 155 /*post("Argument %d, max: %.2f", n, *argv_max); */
147 } 156 }
148 if(type == XTRACT_MEL_FILTER){ 157 if(type == XTRACT_MEL_FILTER){
149 x->memory.argv = (size_t)(n_args * sizeof(xtract_mel_filter)); 158 x->memory.argv = (size_t)(n_args * sizeof(xtract_mel_filter));
150 x->argv = (xtract_mel_filter *)getbytes(x->memory.argv); 159 x->argv = (xtract_mel_filter *)getbytes(x->memory.argv);
151 } 160 }
247 256
248 static void xtract_tilde_show_help(t_xtract_tilde *x, t_symbol *s){ 257 static void xtract_tilde_show_help(t_xtract_tilde *x, t_symbol *s){
249 258
250 int i; 259 int i;
251 260
261 xtract_function_descriptor_t *fd, *d;
262
252 i = XTRACT_FEATURES; 263 i = XTRACT_FEATURES;
253 xtract_function_descriptor_t *fd, *d;
254 264
255 fd = (xtract_function_descriptor_t *)xtract_make_descriptors(); 265 fd = (xtract_function_descriptor_t *)xtract_make_descriptors();
256 post("\nxtract~: Feature List\n"); 266 post("\nxtract~: Feature List\n");
257 267
258 while(i--){ 268 while(i--){