#if 0 
#if 1 
lookup_voices(snd_emux_t *emu, emu10k1_t *hw, best_voice_t *best, int active_only){	snd_emux_voice_t *vp;	best_voice_t *bp;	int  i;	for (i = 0; i < V_END; i++) {		best[i].time = (unsigned int)-1; /* XXX MAX_?INT really */;		best[i].voice = -1;	}	/*	 * Go through them all and get a best one to use.	 * NOTE: could also look at volume and pick the quietest one.	 */	for (i = 0; i < emu->max_voices; i++) {		int state, val;		vp = &emu->voices[i];		state = vp->state;		if (state == SNDRV_EMUX_ST_OFF) {			if (vp->ch < 0) {				if (active_only)					continue;				bp = best + V_FREE;			} else				bp = best + V_OFF;		}		else if (state == SNDRV_EMUX_ST_RELEASED ||			 state == SNDRV_EMUX_ST_PENDING) {			bp = best + V_RELEASED;#if 0			val = snd_emu10k1_ptr_read(hw, CVCF_CURRENTVOL, vp->ch);			if (! val)				bp = best + V_OFF;#endif		}		else if (state == SNDRV_EMUX_ST_STANDBY)			continue;		else if (state & SNDRV_EMUX_ST_ON)			bp = best + V_PLAYING;		else			continue;		/* check if sample is finished playing (non-looping only) */		if (bp != best + V_OFF && bp != best + V_FREE &&		    (vp->reg.sample_mode & SNDRV_SFNT_SAMPLE_SINGLESHOT)) {			val = snd_emu10k1_ptr_read(hw, CCCA_CURRADDR, vp->ch);			if (val >= vp->reg.loopstart)				bp = best + V_OFF;		}		if (vp->time < bp->time) {			bp->time = vp->time;			bp->voice = i;		}	}}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/fc20773329c993ec7d1b2c65618351f057d9d679/emu10k1_callback.c/clean/sound/pci/emu10k1/emu10k1_callback.c