Ejemplo n.º 1
0
// static
void LLAudioSource::logSoundPlay(const LLUUID& id, LLAudioSource* audio_source, LLVector3d position, S32 type, const LLUUID& assetid, const LLUUID& ownerid, const LLUUID& sourceid, bool is_trigger, bool is_looped)
{
	// <FS:ND> Corrupt asset, do not bother
	if( gAudiop->isCorruptSound( assetid ) )
		return;
	// </FS:ND>

	// <FS:ND> Do not overflow our log here.
	pruneSoundLog();
	if( gSoundHistory.size() > 2048 )
		return; // Might clear out oldest entries before giving up?
	// </FS:ND>

	LLSoundHistoryItem item;
	item.mID = id;
	item.mAudioSource = audio_source;
	item.mPosition = position;
	item.mType = type;
	item.mAssetID = assetid;
	item.mOwnerID = ownerid;
	item.mSourceID = sourceid;
	item.mPlaying = true;
	item.mTimeStarted = LLTimer::getElapsedSeconds();
	item.mTimeStopped = F64_MAX;
	item.mIsTrigger = is_trigger;
	item.mIsLooped = is_looped;
	
	item.mReviewed = false;
	item.mReviewedCollision = false;
	
	gSoundHistory[id] = item;
}
//static 
void logSoundStop(LLUUID id)
{
	if(gSoundHistory.find(id) != gSoundHistory.end())
	{
		gSoundHistory[id].mPlaying = false;
		gSoundHistory[id].mTimeStopped = LLTimer::getElapsedSeconds();
		gSoundHistory[id].mAudioSource = NULL; // just in case
		pruneSoundLog();
	}
}
//static 
void logSoundStop(LLUUID const& id, bool destructed)
{
	std::map<LLUUID, LLSoundHistoryItem>::iterator iter = gSoundHistory.find(id);
	if(iter != gSoundHistory.end() && iter->second.mAudioSource)
	{
		iter->second.mPlaying = false;
		iter->second.mTimeStopped = LLTimer::getElapsedSeconds();
		if (destructed)
			iter->second.mAudioSource = NULL;
		pruneSoundLog();
	}
}