if (opt_realtime_playing != 2 && rate > 20 &&
if (! opt_realtime_playing && rate > 20 &&
static int compute_data(int32 count){  int rc;  if (!count)    {      if (buffered_count)      {	  ctl->cmsg(CMSG_INFO, VERB_DEBUG_SILLY,		    "output data (%d)", buffered_count);#ifdef SUPPORT_SOUNDSPEC	  soundspec_update_wave(common_buffer, buffered_count);#endif /* SUPPORT_SOUNDSPEC */	  if(aq_add(common_buffer, buffered_count) == -1)	      return RC_ERROR;      }      buffer_pointer=common_buffer;      buffered_count=0;      return RC_NONE;    }  while ((count+buffered_count) >= audio_buffer_size)    {      int i;      if((rc = apply_controls()) != RC_NONE)	  return rc;      do_compute_data(audio_buffer_size-buffered_count);      count -= audio_buffer_size-buffered_count;      ctl->cmsg(CMSG_INFO, VERB_DEBUG_SILLY,		"output data (%d)", audio_buffer_size);#ifdef SUPPORT_SOUNDSPEC      soundspec_update_wave(common_buffer, audio_buffer_size);#endif /* SUPPORT_SOUNDSPEC */#if defined(CSPLINE_INTERPOLATION) || defined(LAGRANGE_INTERPOLATION) || defined(NEWTON_INTERPOLATION) || defined(GAUSS_INTERPOLATION)      /* fall back to linear interpolation when queue < 100% */      if (opt_realtime_playing != 2 && (play_mode->flag & PF_CAN_TRACE)) {	  if (!aq_fill_buffer_flag &&	      100 * ((double)(aq_filled() + aq_soft_filled()) /		     aq_get_dev_queuesize()) < 99)	      reduce_quality_flag = 1;	  else	      reduce_quality_flag = no_4point_interpolation;      }#endif#ifdef REDUCE_VOICE_TIME_TUNING      /* Auto voice reduce implementation by Masanao Izumo */      if(reduce_voice_threshold &&	 (play_mode->flag & PF_CAN_TRACE) &&	 !aq_fill_buffer_flag &&	 aq_get_dev_queuesize() > 0)      {	  /* Reduce voices if there is not enough audio device buffer */          int nv, filled, filled_limit, rate, rate_limit;          static int last_filled;	  filled = aq_filled();	  rate_limit = 75;	  if(reduce_voice_threshold >= 0)	  {	      filled_limit = play_mode->rate * reduce_voice_threshold / 1000		  + 1; /* +1 disable zero */	  }	  else /* Use default threshold */	  {	      int32 maxfill;	      maxfill = aq_get_dev_queuesize();	      filled_limit = REDUCE_VOICE_TIME_TUNING;	      if(filled_limit > maxfill / 5) /* too small audio buffer */	      {		  rate_limit -= 100 * audio_buffer_size / maxfill / 5;		  filled_limit = 1;	      }	  }	  /* Calculate rate as it is displayed in ncurs_c.c */	  /* The old method of calculating rate resulted in very low values	     when using the new high order interplation methods on "slow"	     CPUs when the queue was being drained WAY too quickly.  This	     caused premature voice reduction under Linux, even if the queue	     was over 2000%, leading to major voice lossage. */	  rate = (int)(((double)(aq_filled() + aq_soft_filled()) /                  	aq_get_dev_queuesize()) * 100 + 0.5);          for(i = nv = 0; i < upper_voices; i++)	      if(voice[i].status != VOICE_FREE)	          nv++;	  if(opt_realtime_playing != 2)	  {	      /* calculate ok_nv, the "optimum" max polyphony */	      if (auto_reduce_polyphony && rate < 85) {		/* average in current nv */	        if ((rate == old_rate && nv > min_bad_nv) ||	            (rate >= old_rate && rate < 20)) {	        	ok_nv_total += nv;	        	ok_nv_counts++;	        }	        /* increase polyphony when it is too low */	        else if (nv == voices &&	                 (rate > old_rate && filled > last_filled)) {	          		ok_nv_total += nv + 1;	          		ok_nv_counts++;	        }	        /* reduce polyphony when loosing buffer */	        else if (rate < 75 &&	        	 (rate < old_rate && filled < last_filled)) {	        	ok_nv_total += min_bad_nv;	    		ok_nv_counts++;	        }	        else goto NO_RESCALE_NV;		/* rescale ok_nv stuff every 1 seconds */		if (current_sample >= ok_nv_sample && ok_nv_counts > 1) {			ok_nv_total >>= 1;			ok_nv_counts >>= 1;			ok_nv_sample = current_sample + (play_mode->rate);		}		NO_RESCALE_NV:;	      }	  }	  /* EAW -- if buffer is < 75%, start reducing some voices to	     try to let it recover.  This really helps a lot, preserves	     decent sound, and decreases the frequency of lost ON notes */	  if ((opt_realtime_playing != 2 && rate < rate_limit)	      || filled < filled_limit)	  {	      if(filled <= last_filled)	      {	          int v, kill_nv, temp_nv;		  /* set bounds on "good" and "bad" nv */		  if (opt_realtime_playing != 2 && rate > 20 &&		      nv < min_bad_nv) {		  	min_bad_nv = nv;	                if (max_good_nv < min_bad_nv)	                	max_good_nv = min_bad_nv;	          }		  /* EAW -- count number of !ON voices */		  /* treat chorus notes as !ON */		  for(i = kill_nv = 0; i < upper_voices; i++) {		      if(voice[i].status & VOICE_FREE ||		         voice[i].cache != NULL)		      		continue;		      		      if((voice[i].status & ~(VOICE_ON|VOICE_SUSTAINED) &&			  !(voice[i].status & ~(VOICE_DIE) &&			    voice[i].sample->note_to_use)))				kill_nv++;		  }		  /* EAW -- buffer is dangerously low, drasticly reduce		     voices to a hopefully "safe" amount */		  if (filled < filled_limit &&		      (opt_realtime_playing == 2 || rate < 10)) {		      FLOAT_T n;		      /* calculate the drastic voice reduction */		      if(nv > kill_nv) /* Avoid division by zero */		      {			  n = (FLOAT_T) nv / (nv - kill_nv);			  temp_nv = (int)(nv - nv / (n + 1));			  /* reduce by the larger of the estimates */			  if (kill_nv < temp_nv && temp_nv < nv)			      kill_nv = temp_nv;		      }		      else kill_nv = nv - 1; /* do not kill all the voices */		  }		  else {		      /* the buffer is still high enough that we can throw		         fewer voices away; keep the ON voices, use the		         minimum "bad" nv as a floor on voice reductions */		      temp_nv = nv - min_bad_nv;		      if (kill_nv > temp_nv)		          kill_nv = temp_nv;		  }		  for(i = 0; i < kill_nv; i++)		      v = reduce_voice();		  /* lower max # of allowed voices to let the buffer recover */		  if (auto_reduce_polyphony) {		  	temp_nv = nv - kill_nv;		  	ok_nv = ok_nv_total / ok_nv_counts;		  	/* decrease it to current nv left */		  	if (voices > temp_nv && temp_nv > ok_nv)			    voice_decrement_conservative(voices - temp_nv);			/* decrease it to ok_nv */		  	else if (voices > ok_nv && temp_nv <= ok_nv)			    voice_decrement_conservative(voices - ok_nv);		  	/* increase the polyphony */		  	else if (voices < ok_nv)			    voice_increment(ok_nv - voices);		  }		  while(upper_voices > 0 &&			voice[upper_voices - 1].status == VOICE_FREE)		      upper_voices--;	      }	      last_filled = filled;	  }	  else {	      if (opt_realtime_playing != 2 && rate >= rate_limit &&	          filled > last_filled) {		    /* set bounds on "good" and "bad" nv */		    if (rate > 85 && nv > max_good_nv) {		  	max_good_nv = nv;		  	if (min_bad_nv > max_good_nv)		  	    min_bad_nv = max_good_nv;		    }		    if (auto_reduce_polyphony) {		    	/* reset ok_nv stuff when out of danger */		    	ok_nv_total = max_good_nv * ok_nv_counts;			if (ok_nv_counts > 1) {			    ok_nv_total >>= 1;			    ok_nv_counts >>= 1;			}		    	/* restore max # of allowed voices to normal */			restore_voices(0);		    }	      }	      last_filled = filled_limit;          }          old_rate = rate;      }#endif      if(aq_add(common_buffer, audio_buffer_size) == -1)	  return RC_ERROR;      buffer_pointer=common_buffer;      buffered_count=0;      if(current_event->type != ME_EOT)	  ctl_timestamp();      /* check break signals */      VOLATILE_TOUCH(intr);      if(intr)	  return RC_QUIT;      if(upper_voices == 0 && check_eot_flag &&	 (i = check_midi_play_end(current_event, EOT_PRESEARCH_LEN)) > 0)      {	  if(i > 1)	      ctl->cmsg(CMSG_INFO, VERB_VERBOSE,			"Last %d MIDI events are ignored", i - 1);	  return midi_play_end();      }    }  if (count>0)    {      do_compute_data(count);      buffered_count += count;      buffer_pointer += (play_mode->encoding & PE_MONO) ? count : count*2;    }  return RC_NONE;}