#include "../macros/macros.h" #define NPOLE 32 #define FRAMSIZE (NPOLE+4) #define FPREC 22 #define RECSIZE (FPREC*FRAMSIZE) #define BPREC (RECSIZE*FLOAT) #define BPFRAME (FRAMSIZE*FLOAT) int anal; float allpole(x,jcount,npoles,past,c) float x,*past,*c; int *jcount,npoles; { int j,nfint; for(j= *jcount, nfint=0; nfint= 1024.) *phs -= 1024.; return(q); } /* * ugens.h: define unit generator structure */ #define UG_NSIZ 7 /* Max len of UG name */ #define UG_NULL (struct ug_item *)0 #define NAMESIZE 128 /* Max size of file name */ #define FLOAT (sizeof(float)) /* nbytes in floating point word*/ #define INT (sizeof(short)) /* nbytes in integer word */ #define SHORT (sizeof(short)) #define LONG (sizeof(long)) #define NFILES 4 /* maximum number of opened files */ struct ug_item { struct ug_item *ug_next; int (*ug_ptr)(); /* Pointer to the function */ char *ug_name; }; typedef struct ug_item ug_t; extern ug_t *ug_list; extern addfunc(); #define UG_INTRO(flabel,func) \ { extern func(); \ static ug_t this_ug = { UG_NULL, func, flabel }; \ if (addfunc(&this_ug) == -1) merror(flabel); } #define PI2 6.2831853 #define PI 3.141592654 extern float SR; #ifndef MAIN extern int aargc; extern char *aargv[]; /* to pass commandline args to subroutines */ #endif /* structure to pass to gen routines */ struct gen { int size; /* size of array to load up */ int nargs; /* number of arguments passed in p array */ float *pvals; /* address of array of p values */ float *array; /* address of array to be loaded up */ }; #ifndef SOUND extern int (*addoutpointer[NFILES])(); extern int (*layoutpointer[NFILES])(); extern int (*wipeoutpointer[NFILES])(); extern int (*getinpointer[NFILES])(); extern int (*bwipeoutpointer[NFILES])(); #define ADDOUT(x,y) (*addoutpointer[y])(x,y) #define LAYOUT(x,l,y) (*layoutpointer[y])(x,l,y) #define WIPEOUT(x,y) (*wipeoutpointer[y])(x,y) #define GETIN(x,y) (*getinpointer[y])(x,y) #define BWIPEOUT(x,y,z) (*bwipeoutpointer[y])(x,y,z) #endif SOUND /* declarations of units */ long setnot(); float reson(),oscil(),oscili(),osciln(),oscilni(),evp(),table(),tablei(); float cpspch(),pchcps(),cpsoct(),octcps(),pchoct(); float delget(),dliget(),boost(),rrand(); float octpch(),*floc(); play(p,n_args) float *p; { float buzzamp,ramp,xamp,amp,si,hn,phs,*f,out[4],srd2,magic; float c[FRAMSIZE],past[NPOLE*2],val,frames,frame1,frameno,ampmlt,errno; float *ballpole(),*bbuzz(),*brandf(),alpvals[2048],buzvals[2048]; float buzz(),allpole(); int jcount = 0; long seed,i,nsamps; int counter,flag; float thresh,randamp,randoff; float *cpoint; for(i=0; i thresh) ? 0 : 1; ramp = ampmlt * randamp; si = c[3] * magic; hn = (int)(srd2/c[3]); counter = (float)(SR/c[3]); counter = (counter > i) ? i : counter; } if(errno) val = buzz(ampmlt,si,hn,f,&phs); /* {BUZZ(val,ampmlt,si,hn,f,phs);} */ else val = (float)(rand()-randoff) * ramp; val = allpole(val,&jcount,NPOLE,past,cpoint); /* ALLPOLE(val,jcount,NPOLE,past,cpoint); */ WIPEOUT(&val,0); } endnote(0); } getfr(frameno,c) float frameno,*c; { int frame,i,j; static float array[RECSIZE]; float fraction; static int oldframe = 0; static int endframe = 0; frame = (int)frameno; fraction = frameno - (float)frame; if(!((frame >= oldframe) && (frame < endframe))) { lseek(anal,((long)frame*(long)BPFRAME),0); read(anal,(char *)array,BPREC); oldframe = frame; endframe = oldframe + FPREC - 1; } for(i=(frame-oldframe)*FRAMSIZE,j=0; j