#include "/musr/H/ugens.h" #include "/musr/H/sfheader.h" #include #include extern SFHEADER sfdesc[NFILES]; extern int sfd[NFILES]; extern int bufsize[NFILES]; extern char *sndbuf[NFILES]; int (*getsample)(); int getfsample(); int getisample(); getsetnote(start,dur,filenum) float start,dur; int filenum; { int nsamples = setnote(start,dur,filenum); _backup(filenum); if(sfclass(&sfdesc[filenum]) == SF_FLOAT) getsample = getfsample; else getsample = getisample; return(nsamples); } getisample(sampleno,c,input) float *c; double sampleno; { int RECSIZE = bufsize[input]; int BPREC = RECSIZE * sizeof(short); int BPFRAME = sfchans(&sfdesc[input]) * sizeof(short); int FPREC = RECSIZE/sfchans(&sfdesc[input]); int sample,i,j; short *array = (short *)sndbuf[input]; float fraction; static int oldsample = 0; static int endsample = 0; sample = (int)sampleno; fraction = sampleno - (double)sample; if(!((sample >= oldsample) && (sample < endsample))) { if(sflseek(sfd[input], sample * BPFRAME, 0) <=0) { fprintf(stderr,"badlseek on inputfile\n"); closesf(); } if(read(sfd[input],(char *)array,BPREC) <= 0) { fprintf(stderr,"reached eof on input file \n"); return(0); } oldsample = sample; endsample = oldsample + FPREC - 1; } for(i=(sample-oldsample)*sfchans(&sfdesc[input]),j=0; j= oldsample) && (sample < endsample))) { if(sflseek(sfd[input], sample * BPFRAME, 0) <=0) { fprintf(stderr,"badlseek on inputfile\n"); closesf(); } if(read(sfd[input],(char *)array,BPREC) <= 0) { fprintf(stderr,"reached eof on input file \n"); return(0); } oldsample = sample; endsample = oldsample + FPREC - 1; } for(i = (sample-oldsample)*sfchans(&sfdesc[input]),j=0; j