This is setline.c in view mode; [Download] [Up]
#include "/musr/H/ugens.h" #include "/musr/H/sfheader.h" #include <stdio.h> #include <sys/file.h> #include <sys/types.h> extern SFHEADER sfdesc[NFILES]; #define SIZE 512 float array[SIZE],tabs[2]; /* setline array for envelope */ int lineset; setline(p,n_args) float *p; { double increm; int i,j,k,points; extern int lineset; if((n_args % 2) != 0) { fprintf(stderr,"Something wrong with phrase, check args\n"); closesf(); } lineset = 1; /* initialized array */ increm = (double)(p[n_args - 2] - p[0])/(double)SIZE; for(j=0,i=0; j < (n_args-2); j += 2) { points = (int)((double)(p[j+2] - p[j]) / increm +.5); if(p[j+2] != p[j]) { if(points <= 0) points = 1; if((p[j+2] < p[j]) || (points > SIZE)) { fprintf(stderr," confusion on phrase card\n"); closesf(); } for(k=0; k < points; k++) { array[i++] = ((float)k/(float)points) * (p[j+3] - p[j+1]) + p[j+1]; if(i == SIZE) return; } } } i--; while(++i < SIZE) array[i] = array[i-1]; }
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.