/* This is file: main.c */ #include #include #include #include #define PI 3.1415926535 extern void sayhello_(float *, float *); extern int initwav(char *,int); extern int writewav(short *, int); extern void closewav(); unsigned char *im; int w,h; unsigned char * createim(w,h) int w,h; { unsigned char *d; int x,y; d = (unsigned char *) malloc(3*w*h); for (x=0; x(250-sin(((double) k)*x*4)*250); j--) point_trans((int) (0.5 + (x*1000.0)/(2.0*PI)), j, 0, 250, 250, max); } } int main(argc, argv) int argc; char *argv[]; { float in, out; float x, start, stop, incr; short s; int i, j; if (argc == 1) { start = 0.0; stop = 3.0; incr = 1.0/44100.0; if (initwav("/dev/shm/math.wav",3*44100) != 0) return((int) -1); h = 500; w = 1000; im = createim(w,h); if (im == NULL) { printf("Malloc error: quiting.\n"); return( (int) -1); } i = 0; for (x=start; x<(stop-incr/2); x+=incr) { in = x; sayhello_(&in,&out); /* printf("%f %f\n", x, (float) out); */ s = (short) (32000*out); writewav(&s,1); /* if (x<0.1) { for (j=h; j>(250-250*out); j--) point_trans((int) (x*10*1000), j, 0, 250, 250, 1); } */ i++; } closewav(); } for (x=0.0+0.00001; x<0.1; x+=0.1/1000) { in = x; sayhello_(&in,&out); if (1) { for (j=h-1; j>(250-(int) ((float) 250*out)); j--) point_trans((int) (x*1000*10), j, 0, 250, 250, 1); } } /* drawsine(); */ grid(); writeppm("/dev/shm/sine.ppm", w,h); return((int) 0); }