Ejemplo n.º 1
0
void vrSleep(long useconds) {

	if (useconds <= 0) {
#if defined(SGINAP)
		/* only use sginap() on IRIX 5.x where usleep is not available */
		sginap(0);
#else
		usleep(0);	/* often just calling usleep() is important to release the CPU */
#endif
		return;
	}

#if defined(SGINAP)
	/* only use sginap() on IRIX 5.x where usleep is not available */
	sginap(useconds / 10000);
#else
	/* handles delays longer than one second */
	while (useconds >= 1000000) {
		usleep(999999);
		useconds -= 999999;
	}
#  if !defined(__linux) /* on systems that produce higher-res waits with calls less than 10000ms, this can improve resolution */
	while (useconds >= 5000) {
		usleep(5000);
		useconds -= 5000;
	}
#  endif
	usleep(useconds);
#endif
}
Ejemplo n.º 2
0
/*
 * System statistics collection routine
 */
void ComputeStatistics(void)
{
    memcpy(&LastSysInfo, &SysInfo, sizeof(SysInfo));
    sysmp(MP_SAGET, MPSA_SINFO, &SysInfo, sizeof(SysInfo));
    sginap(nPeriod);
    glutPostRedisplay();
}
Ejemplo n.º 3
0
/* Pause for the given portion of a second after the initial time "then".
   Return immediately if interrupted. */
STATIC int framePause(double delay, struct timeval *then)
{
   int retvalue = 0;
   struct timeval now;
   double delta;

   /* XXX FIXME XXX gettimeofday has resolution of 1 s. on some sysV */
   gettimeofday(&now, NULL);
   delta = (double) (now.tv_sec - then->tv_sec) +
           (double) (now.tv_usec - then->tv_usec) * 1.e-6;

   if (delta > delay)
      retvalue = 1;
   else {
#if defined(SGI)
      /* Note: on some systems usleep returns immediately after SIGINT
         is handled even if the full delay hasn't expired, but others
         do not, so we have to sleep for short intervals */
      while (delta < delay) {
         if (sginap(NAPTIME)) {
            retvalue = -1;
            break;
         }
         gettimeofday(&now, NULL);
         delta = (double) (now.tv_sec - then->tv_sec) +
                 (double) (now.tv_usec - then->tv_usec) * 1.e-6;
      }
#else
      usleep((unsigned long)(1e6*(delay-delta)));
#endif
   }

   return retvalue;
}
Ejemplo n.º 4
0
void Cilk_yield(CilkWorkerState *const UNUSED(ws))
{
    usleep(1);  /* This seems simpler and better than all the code below.
		 * The problem is that even with sched_yield() I can incur a significant
                 * slowdown on serial code with lots of spawns.  E.g., if you writen
		 *    for (i=0; i<10; i++) {spawn f(x); sync;}
		 * why would you want to do that?  If f is a cilk procedure, you cannot call
                 * f without using spawn.  Canary runs into this.
                 */ 
    return;
#if 0
#if CILK_WITH_POSIX_THREADS
#  if HAVE_SCHED_YIELD
     sched_yield();
#  elif HAVE_SGINAP
     sginap(1);
#  endif
#else
#  if HAVE_SCHED_YIELD
     sched_yield();
#  elif HAVE_YIELD
     yield();
#  endif
#endif
#endif
}
Ejemplo n.º 5
0
/* this "calibrates" the buzz loop to determine buzzmax */
void initbuzz()
{
	long t0, t1;

	buzzmax = 1000000;
	sginap(10);	/* sleep for 10/100 of a second */
	t0 = getltime();
	buzz();
	t1 = getltime();
	buzzmax = TIMESLICE*(100.0*1000000.0)/(t1-t0);
}
Ejemplo n.º 6
0
void I_WaitVBL(int count)
{
#ifdef SGI
    sginap(1);
#else
#ifdef SUN
    sleep(0);
#else
    usleep (count * (1000000/70) );
#endif
#endif
}
Ejemplo n.º 7
0
static PyObject *
sgi_nap(PyObject *self, PyObject *args)
{
	long ticks;
	if (!PyArg_Parse(args, "l", &ticks))
		return NULL;
	Py_BEGIN_ALLOW_THREADS
	sginap(ticks);
	Py_END_ALLOW_THREADS
	Py_INCREF(Py_None);
	return Py_None;
}
Ejemplo n.º 8
0
void 
RNSleep(RNScalar seconds)
{
#if (RN_OS == RN_IRIX)
    sginap((long) (seconds * CLK_TCK));
#elif (RN_OS == RN_WINDOWSNT)
    Sleep((unsigned long) (1000 * seconds));
#elif (RN_OS == RN_LINUX)
    usleep((unsigned long) (1000000 * seconds));
#else
    RNAbort("Not implemented");
#endif
}
Ejemplo n.º 9
0
void I_WaitVBL(int count)
{
#ifdef SGI
    sginap(1);                                           
#else
#ifdef SUN
    sleep(0);
#else
    //JONNY//usleep (count * (1000000/70) );  
	std::this_thread::sleep_for(std::chrono::microseconds(count*(1000000 / 70)));
#endif
#endif
}
Ejemplo n.º 10
0
void
oneFrame(void)
{
  int i;

  /**
  if((random() & 0xff) == 0x34){
    glClear(GL_COLOR_BUFFER_BIT);
  }

  if((tko & 0x1f) == 0x1f){
    glEnable(GL_BLEND);
    glColor4f(0.0, 0.0, 0.0, 0.09);
    glRectf(0.0, 0.0, wd, ht);
    glDisable(GL_BLEND);
#ifdef __sgi
    sginap(0);
#endif
  }
  */
  gravity(-2.0);
  for (i = 0; i < N_SHAPES; i++) {
    motionUpdate(i);
#ifdef __sgi
    sginap(0);
#endif
    colorUpdate(i);
#ifdef __sgi
    sginap(0);
#endif
    drawleaf(i);
#ifdef __sgi
    sginap(0);
#endif

  }
  glFlush();
}
Ejemplo n.º 11
0
/*
 * Clean up sound routines.
 */
void sfxEnd(int waitForSounds) {
	int idx;

	endingOnPurpose = 1;

	if (waitForSounds) {		/* wait for sounds to complete */
		for (idx=0; idx < nAudioPorts; idx++) {
			while (ALgetfilled(audioPort[idx]) > 0)
				sginap(1);

			ALcloseport(audioPort[idx]);
		}
	} else if (soundChild > 0)	/* kill childs playing sounds */
		kill(soundChild, SIGKILL);

	if (nAudioPorts > 0)		/* reset audio subsystem */
		sfxResetAudioHw();
}
Ejemplo n.º 12
0
// close audio device
static void uninit(int immed) {

  /* TODO: samplerate should be set back to the value before mplayer was started! */

  mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_SGI_Uninit);

  if (ao_config) {
    alFreeConfig(ao_config);
    ao_config = NULL;
  }

  if (ao_port) {
    if (!immed)
    while(alGetFilled(ao_port) > 0) sginap(1);
    alClosePort(ao_port);
    ao_port = NULL;
  }

}
Ejemplo n.º 13
0
f_open_com (olist *a, ftnint *mask, char **mode_, char **buf_, unit **fu)
#endif
{
   unit           *b;
   ino_t           inod;
   int             n, org;
   char           *mode = "r";
   char           *abuf, c, *cbuf, errstr[80];
   char    	  buf[PATH_MAX];		/* temp buffer */
   char    	  ubuf[PATH_MAX];		/* temp buffer */
   unsigned int   need;
#if 00
   cllist64          x;
#else
   cllist          x;
#endif
   struct stat     sbuf;
   static char     seed[] = "aa";
   char		   *q = seed;
   char            ch;
   unit		  *dupunit;
   int 	  	   dupopen;
   int             istty = 0;	/* Flag to indicate whether file
				 * being opened is /dev/tty */

   /*
   extern	FILE *debugfile;
   */
   struct stat     stat_struct;
   unit           *ftnunit;

   /* bug fix 12787 : need to initialize to zero */

   /* sjc #1827: The cretin who coded this originally assumed that an
    * 80-byte temporary string would always be enough. We dynamically
    * allocate it to be 80 bytes plus whatever we can easily find out
    * about the length of the filename being passed to us. That may
    * not be enough (the string gets passed all over creation, so
    * it's hard to know) but it's better than before. Note that this
    * relies on f_open continuing not to be recursive. */

   if (a->ofnm)
      istty = !strncmp ("/dev/tty", a->ofnm, 8);
   need = a->odfnm ? a->odfnmlen : 0;
   need += a->ofnm ? a->ofnmlen : 0;
   need += 40;
   if ((*fu = ftnunit = b = map_luno (a->ounit)) == NULL)
      err(a->oerr, 101, "open");
   while (fu != &f77curunit && test_and_set( &ftnunit->lock_unit, 1L )) {
      sginap(0);
   }
   /* obtain exclusive lock for special I/O operation, this should always
   be done after the lock onthe unit has been done to avoid deadlock */
   while (test_and_set( &io_lock, 1L ))
      sginap(0);
   * buf_ = buf;

/* Fix BN 9310 . If the the terminal is being opened do not test to see if this
 * file is already connected to a fortran unit since the terminal should be
 * able to be connected to various fortran units simultaneously
 * ---ravi---1/7/91
 */

 /* From the ANSI standard: to make this clear once and for all:
 ** 	If a unit is connnected to a file that exists, execution of an OPEN
 ** statement for that unit is permitted.   If the FILE= specifier is not
 ** included in the OPEN statement, the file to be connected to the unit is
 ** the same as the file to which the unit is connected.
 ** 	If the file to be connected to the unit does not exist, but is the
 ** same as the file to which the unit is preconnected, the properties
 ** specifies by the OPEN statement become a part of the connection.
 **	If the file to be connected to the unit is not the same as the
 ** file to which the unit is conencted, the effect is as if a CLOSE
 ** statement without a STATUS= specifier had been executed for the unit
 ** immediately to the execution of the OPEN statement.
 **	If the file to be connected to the unit is the same as the file
 ** to which the unit is connected, only the BLANK= specifier may have a
 ** value different from the one currently in effect.  The position of
 ** the file is unaffected.
 **	If a file is connected to a unit, execution of an OPEN statement
 ** on that file and a different unit is not permitted
 */

   if (!istty) {
      if (dupopen = f_duped (a, ftnunit, &dupunit))
         if (!a->oshared)
            return(dupopen);
   }
   else
       dupopen = 0;

   if (a->odfnm) {
      g_char (a->odfnm, a->odfnmlen, buf);
      abuf = &buf[strlen(buf)];
   } else
      abuf = buf;
   if (b->uconn > 0 && (!a->osta || up_low (*a->osta) != 's')) {
      if (a->ofnm == 0) {
same:if (a->oblnk != 0)
	 b->ublnk = up_low (*a->oblnk) == 'z' ? 1 : 0;
	 /* Ignore this open statement if it is not a preconnected unit
	 ** otherwise redefine the unit characteristics
	 */
	 if ((b->ufd == stdin || b->ufd == stdout || b->ufd == stderr)
	   && b->ufnm == NULL)
	   dupopen = 1;
	 else
           return (0);
      }
      if (a->ofnm) {
         g_char (a->ofnm, a->ofnmlen, abuf);
         if (b->uacc == KEYED)
            mkidxname (buf, buf);
         f77inode (buf, &inod);
         if ((inod == b->uinode) && inod)
            goto same;
         buf[a->ofnmlen] = '\0';
      }
      x.cunit = a->ounit;
      x.csta = 0;
      x.cerr = a->oerr;
/* fix bug 6084 */
   /* BN-8077 */
   /* Leave the stdin, stdout, stderr alone without closing them,
    * since if that is done a normal file will be opened which will
    * have the ufd value of stdin, stdout, or stderr and mess up all
    * the conditional testing for stdin, stdout, and stderr */
      if (b->ufd == stdin || b->ufd == stdout || b->ufd == stderr) {
	 if (!dupopen) {
            b->uconn = 0;
            b->ufd = NULL;
	 }
#if 00
#define NAMEf_clos	f_clos64
#else
#define NAMEf_clos	f_clos
#endif
      } else if ((n = NAMEf_clos (&x)) != 0)
         return (n);
      b->luno = a->ounit;
#undef NAMEf_clos
   }

   org = a->oorg ? up_low (*a->oorg) : 0;
   b->umask = *mask;
   if (a->oacc == 0)
      switch (org) {
      case 'r':
	 b->uacc = DIRECT;
	 break;
      case 'i':
         if (dupopen)
           err(a->oerr, 186, "open")
	 b->uacc = KEYED;
	 break;
      default:
	 b->uacc = SEQUENTIAL;
      }
   else
      switch (up_low (*a->oacc)) {
      case 'd':
	 b->uacc = DIRECT;
	 if (org == 'i')
	    err(a->oerr, 149, "open")
	       break;
      case 'k':
	 b->uacc = KEYED;
	 if (org == 's')
	    err(a->oerr, 150, "open")
	       if (org == 'r')
	       err(a->oerr, 151, "open")
		  break;
      case 'a':
	 b->uacc = APPEND;
	 if (org == 'i')
	    err(a->oerr, 152, "open")
	       break;
/* Fix BN 11769 
 * Currently if the access parameter is not a keywords, it
 * sets it to the default ,sequential. Generate error instead.
 * ---ravi---2/21/92
 *
	      case 's':
	      default:  b->uacc = org == 'i' ? KEYED : SEQUENTIAL;
*/
      case 's':
	 b->uacc = org == 'i' ? KEYED : SEQUENTIAL;
	 break;
      default:
	 err(a->oerr, 130, "open");
      }
   if (a->oassocv && b->uacc == DIRECT)
      set_var ((ftnintu *)(b->uassocv = a->oassocv), b->umask, ASSOCV, 1);
   else
      b->uassocv = NULL;
   if (a->omaxrec && b->uacc == DIRECT)
      b->umaxrec = a->omaxrec;
   else
      b->umaxrec = 0;
   if (cbuf = a->odisp)
      switch (up_low (*cbuf++)) {
      case 'd':
	 b->udisp = DELETE;
	 break;
      case 'p':
	 b->udisp = PRINT;
	 goto checkdelete;
      case 's':
	 if (up_low (*cbuf) == 'a')
	    goto keep;
	 b->udisp = SUBMIT;
   checkdelete:
	 while (c = (*cbuf++))
	    if ((c == '/') && (c = (*cbuf)) && (up_low (c) == 'd'))
	       b->udisp |= DELETE;
	 break;
   keep:
      default:
	 b->udisp = KEEP;
      }
   else
      b->udisp = KEEP;

   b->ushared = a->oshared;
   b->ureadonly = a->oreadonly;
   if (a->oblnk && up_low (*a->oblnk) == 'z')
      b->ublnk = 1;
   else
      b->ublnk = 0;
#ifdef I90
	b->uaction = b->ureadonly ? READONLY : READWRITE;
	b->unpad = 0;
	b->udelim = DELIM_NONE;
#endif
   b->url = a->orl;
   if (a->ofm == 0) {
      if (b->uacc == DIRECT || b->uacc == KEYED) {
	 b->ufmt = 0;
	 if (!f77vms_flag_[OLD_RL])
	    b->url *= sizeof (int);
      } else
	 b->ufmt = 1;
   } else if (up_low (*a->ofm) == 'f')
      b->ufmt = 1;
   else if (up_low (*a->ofm) == 'b')
      b->ufmt = 2;
   else if (up_low (*a->ofm) == 's') {
      /* system file = direct unformatted file with record length = 1 */
      b->ufmt = 0;
      b->url = 1;
      b->uacc = DIRECT;
   } else {
      b->ufmt = 0;
      if (!f77vms_flag_[OLD_RL])
	 b->url *= sizeof (int);
      /* all sequential unformatted must need a minimum of 1K buffer to
	 avoid fseek() operations when reading which causes data to be
	 read from the disk each time and cause a 12X performance loss.
      */ 
      check_buflen( b, 1024 );
   }
   if (a->orectype)
      switch (up_low (*a->orectype)) {
      case 'f':
	 if (b->uacc != DIRECT && b->uacc != KEYED)
	    err(a->oerr, 156, "open")
	       break;
      case 'v':
	 if (b->uacc == DIRECT || b->uacc == KEYED ||
	     b->ufmt == 1)
	    err(a->oerr, 157, "open")
	       break;
      case 's':
	 if (b->uacc == DIRECT || b->uacc == KEYED ||
	     b->ufmt != 1)
	    err(a->oerr, 158, "open")
      default:
	    break;
      }
   if (a->occ == 0)
	b->ucc = (char) (b->ufmt ? ((b->luno == 6 && f77vms_flag_[VMS_CC]) ?
		CC_FORTRAN : CC_LIST) : CC_NONE);
   else
   switch (up_low (*a->occ)) {
   case 'l':
      b->ucc = CC_LIST;
      break;
   case 'f':
      b->ucc = CC_FORTRAN;
      b->ucchar = '\0';
      break;
   case 'n':
      b->ucc = CC_NONE;
      break;
   default:
      b->ucc = (char) (b->ufmt ? ((b->luno == 6 && f77vms_flag_[VMS_CC]) ?
			  CC_FORTRAN : CC_LIST) : CC_NONE);
   }

   if (!b->ufmt && b->ucc != CC_NONE)
      err(a->oerr, 162, "open");

   if (a->ofnm == 0)
#ifdef SIZEOF_LUNO_IS_64
      (void) sprintf (abuf, "fort.%lld", a->ounit);
#else
      (void) sprintf (abuf, "fort.%d", a->ounit);
#endif
   else
Ejemplo n.º 14
0
static void
drain_audio_port (AudioContext ac)
{
  while (ALgetfilled (ac->ac_port) > 0)
    sginap(1);
}
Ejemplo n.º 15
0
void milli_wait(unsigned wait_time)
{
  sginap(wait_time*sysconf(3)/1000);
}
Ejemplo n.º 16
0
static void
sit_and_spin(int child_index)

{
  long *my_counter_ptr;

 /* only use C stuff if we are not WIN32 unless and until we */
 /* switch from CreateThread to _beginthread. raj 1/96 */
#ifndef WIN32
  /* we are the child. we could decide to exec some separate */
  /* program, but that doesn't really seem worthwhile - raj 4/95 */
  if (debug > 1) {
    fprintf(where,
            "Looper child %d is born, pid %d\n",
            child_index,
            getpid());
    fflush(where);
  }
  
#endif /* WIN32 */

  /* reset our base pointer to be at the appropriate offset */
  my_counter_ptr = (long *) ((char *)lib_base_pointer + 
                             (netlib_get_page_size() * 
                              PAGES_PER_CHILD * child_index));
  
  /* in the event we are running on an MP system, it would */
  /* probably be good to bind the soaker processes to specific */
  /* processors. I *think* this is the most reasonable thing to */
  /* do, and would be closes to simulating the information we get */
  /* on HP-UX with pstat. I could put all the system-specific code */
  /* here, but will "abstract it into another routine to keep this */
  /* area more readable. I'll probably do the same thine with the */
  /* "low pri code" raj 10/95 */
  
  /* NOTE. I do *NOT* think it would be appropriate for the actual */
  /* test processes to be bound to a  particular processor - that */
  /* is something that should be left up to the operating system. */
  
  bind_to_processor(child_index);
  
  for (*my_counter_ptr = 0L;
       ;
       (*my_counter_ptr)++) {
    if (!(*lib_base_pointer % 1)) {
      /* every once and again, make sure that our process priority is */
      /* nice and low. also, by making system calls, it may be easier */
      /* for us to be pre-empted by something that needs to do useful */
      /* work - like the thread of execution actually sending and */
      /* receiving data across the network :) */
#ifdef _AIX
      int pid,prio;

      prio = PRIORITY;
      pid = getpid();
      /* if you are not root, this call will return EPERM - why one */
      /* cannot change one's own priority to  lower value is beyond */
      /* me. raj 2/26/96 */  
      setpri(pid, prio);
#else /* _AIX */
#ifdef __sgi
      int pid,prio;

      prio = PRIORITY;
      pid = getpid();
      schedctl(NDPRI, pid, prio);
      sginap(0);
#else /* __sgi */
#ifdef WIN32
      SetThreadPriority(GetCurrentThread(),THREAD_PRIORITY_IDLE);
#else /* WIN32 */
#if defined(__sun) && defined(__SVR4)
#include <sys/types.h>
#include <sys/priocntl.h>
#include <sys/rtpriocntl.h>
#include <sys/tspriocntl.h>
      /* I would *really* like to know how to use priocntl to make the */
      /* priority low for this looper process. however, either my mind */
      /* is addled, or the manpage in section two for priocntl is not */
      /* terribly helpful - for one, it has no examples :( so, if you */
      /* can help, I'd love to hear from you. in the meantime, we will */
      /* rely on nice(39). raj 2/26/96 */
      nice(39);
#else /* __sun && __SVR4 */
      nice(39);
#endif /* __sun && _SVR4 */
#endif /* WIN32 */
#endif /* __sgi */
#endif /* _AIX */
    }
  }
}
Ejemplo n.º 17
0
/*
 * Sound handler.
 */
static void sfxSoundHandler(void *arg) {
	ALport *ap = (ALport *)arg;
	Sample samp[MAX_AUDIO_PORTS];

	int idx, nap;
	int treated;
	int nSounds = 1;
	int nextPort = 0;
	long maxSampsPerPass;
	long sampCount;
	long pvbuf[2];
	struct _sfx ss;
	struct pollfd pf;

	prctl(PR_TERMCHILD, 0);

	(void) signal(SIGHUP, sfxDieGracefully);

	maxSampsPerPass = 1600;

	for (idx=0; idx < nAudioPorts; idx++) {
		samp[idx].id = -1;
		samp[idx].sample = NULL;
		samp[idx].sampsToPlay = 0;
		samp[idx].repeat = 0;
	}

	/*
	 * Set sample rate for output device.
	 */
	pvbuf[0] = AL_OUTPUT_RATE;
	pvbuf[1] = AL_RATE_16000;

	(void) ALsetparams(AL_DEFAULT_DEVICE, pvbuf, 2L);

	/*
	 * Prepare to read from pipe.
	 */
	pf.fd = spigot[0];
	pf.events = POLLIN | POLLRDNORM | POLLRDBAND;

#define EVER ;;
	for (EVER) {
		if (nSounds == 0 || (idx=poll(&pf, 1, 0)) > 0) {
			(void) read(spigot[0], &ss, sizeof(ss));
			treated = 0;
			if (ss.loop == 1 && ss.repeat == 0) {
				treated = 1;
				for (idx=0; idx < nAudioPorts; idx++) {
					if (samp[idx].id == ss.id) {
						samp[idx].id = -1;
						samp[idx].repeat = 0;
						samp[idx].sampsToPlay = 0;
						samp[idx].sample = NULL;
					}
				}
			} else if (ss.loop == 1 && ss.count > 1) {
				for (idx=0; idx < nAudioPorts; idx++) {
					if (samp[idx].id == ss.id) {
						treated = 1;
						samp[idx].repeat = ss.repeat;
						samp[idx].sampsToPlay = (long)ss.soundSize[ss.pitch];
						samp[idx].sampsPlayed = 0;
						samp[idx].sample = ss.soundData[ss.pitch];
					}
				}
			}
			if (!treated) {
				for (idx=0; idx < nAudioPorts; idx++) {
					nextPort = (nextPort+1) % nAudioPorts;
					if (samp[nextPort].repeat == 0)
						break;
				}
				samp[nextPort].sample = ss.soundData[ss.pitch];
				samp[nextPort].sampsToPlay = (long)ss.soundSize[ss.pitch];
				samp[nextPort].sampsPlayed = 0;
				samp[nextPort].repeat = ss.repeat;
				samp[nextPort].id = ss.id;
			}
		} else if (idx < 0)
			(void) fprintf(stderr, "panic: input poll failed: %s\n", strerror(errno));

		nSounds = 0;
		nap = 0;

		for (idx=0; idx < nAudioPorts; idx++) {
			if (samp[idx].sampsToPlay > 0) {
				nSounds++;
				if (ALgetfilled(ap[idx]) > 4000) {
					nap++;
					continue;
				}
			}
			if (samp[idx].sampsToPlay >= maxSampsPerPass) {
				(void) ALwritesamps(ap[idx],
						    samp[idx].sample + samp[idx].sampsPlayed, maxSampsPerPass);
				samp[idx].sampsPlayed += maxSampsPerPass;
				samp[idx].sampsToPlay -= maxSampsPerPass;

			} else if (samp[idx].sampsToPlay > 0) {
				if ((samp[idx].sampsToPlay%2) == 1) {
					samp[idx].sampsToPlay -= 1;
					samp[idx].sampsPlayed += 1;
				}
				if (samp[idx].sampsToPlay > 0)
				    (void) ALwritesamps(ap[idx],
							samp[idx].sample+samp[idx].sampsPlayed, samp[idx].sampsToPlay);

				if (samp[idx].repeat) {
					sampCount = maxSampsPerPass - samp[idx].sampsToPlay;
					samp[idx].sampsToPlay += samp[idx].sampsPlayed - sampCount;
					samp[idx].sampsPlayed = sampCount;
					(void) ALwritesamps(ap[idx], samp[idx].sample, sampCount);
				} else
					samp[idx].sampsToPlay = 0;
			}
		}
		if (nap == nSounds)
			sginap(1);
	}
	return;
}
Ejemplo n.º 18
0
/*
	Wait until the audio port has no more samples to play.
*/
void waitport (ALport port)
{
	while (alGetFilled(port) > 0)
		sginap(1);
}