src/sgp/SoundMan.cc
/* Removes the least-used sound from the cache to make room.
 *
 * Returns: TRUE if a sample was freed, FALSE if none */
Removes the least-used sound from the cache to make room.
Returns: TRUE if a sample was freed, FALSE if none
Removes the least - used sound from the cache to make room . Returns : TRUE if a sample was freed FALSE if none
static BOOLEAN SoundCleanCache(void)
{
	SAMPLETAG* candidate = NULL;
	FOR_EACH(SAMPLETAG, i, pSampleList)
	{
		if (i->uiFlags & SAMPLE_ALLOCATED &&
				!(i->uiFlags & SAMPLE_LOCKED) &&
				(candidate == NULL || candidate->uiCacheHits > i->uiCacheHits))
		{
			if (!SoundSampleIsPlaying(i)) candidate = i;
		}
	}
	if (candidate != NULL)
	{
		SLOGD("freeing sample %u \"%s\" with %u hits", candidate - pSampleList, candidate->pName, candidate->uiCacheHits);
		SoundFreeSample(candidate);
		return TRUE;
	}
	return FALSE;
}
static BOOLEAN SoundCleanCache ( void ) { SAMPLETAG * candidate = NULL ; FOR_EACH ( SAMPLETAG , i , pSampleList ) { if ( i -> uiFlags & SAMPLE_ALLOCATED && ! ( i -> uiFlags & SAMPLE_LOCKED ) && ( candidate == NULL || candidate -> uiCacheHits > i -> uiCacheHits ) ) { if ( ! SoundSampleIsPlaying ( i ) ) candidate = i ; } } if ( candidate != NULL ) { SLOGD ( " \" \" " , candidate - pSampleList , candidate -> pName , candidate -> uiCacheHits ) ; SoundFreeSample ( candidate ) ; return TRUE ; } return FALSE ; }
Removes the least-used sound from the cache to make room.
Removes the least - used sound from the cache to make room .