ftp.nice.ch/pub/next/unix/audio/Cmix.N.s.tar.gz#/cmix/sys/setnote.c

This is setnote.c in view mode; [Download] [Up]


setnote(start,dur,fno)
float start,dur;
int fno;
{
	int nsamps,offset;
	int i;

	if(fno >= fnums) {
		fprintf(stderr,"You haven't opened file %d yet!\n",fno);
		closesf();
	}
	if(start > 0.) /* if start < 0 it indicates number of samples to skip*/
		offset = start * SR * sfchans(&sfdesc[fno])
	    		* sfclass(&sfdesc[fno]);
	else    offset = -start * sfchans(&sfdesc[fno]) * sfclass(&sfdesc[fno]);
		       /* if dur < 0, it indicates number of samples to play*/
	offset = (offset % 2) ? offset+1 : offset; /*make sure its even*/
	nsamps = (dur > 0.) ? (int)(dur * SR) : (int)-dur;

	if(!istape[fno]) {
		if((filepointer[fno] = 
		   sflseek(sfd[fno],offset,0)) == -1) {
			fprintf(stderr,"CMIX: bad lseek in setnot\n");
			closesf();
		}
	}
	pointer[fno] = 0;

	_readit(fno);   /* read in first buffer */

	for(i=0; i<(sfchans(&sfdesc[fno]) * FLOAT); i++)
		*(peak[fno] + i) = 0;

	wipe_is_off[fno] = 1;          /* for wipeout */

	starttime[fno] = (start<0) ? -start/SR : start;

	times(&clockin[fno]);       /* read in starting time */

	return(nsamps);
}

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.