bool LLAudioSource::isDone() const { static const F32 MAX_AGE = 60.f; static const F32 MAX_UNPLAYED_AGE = 15.f; static const F32 MAX_MUTED_AGE = 11.f; if(mCorrupted) { // If we decode bad data then just kill this source entirely. return true; } else if (isLoop()) { // Looped sources never die on their own. return false; } else if (hasPendingPreloads()) { // If there are pending preload requests then keep it alive. return false; } else if (mQueuedDatap) { // Don't kill this sound if we've got something queued up to play. return false; } else if(mPlayedOnce && (!mChannelp || !mChannelp->isPlaying())) { // This is a single-play source and it already did its thing. return true; } F32 elapsed = mAgeTimer.getElapsedTimeF32(); if (!mChannelp) { LLAudioData* adp = mCurrentDatap; //Still decoding. if(adp && adp->isInPreload()) return false; // We don't have a channel assigned, and it's been // over 15 seconds since we tried to play it. Don't bother. return (elapsed > (mSourceMuted ? MAX_MUTED_AGE : MAX_UNPLAYED_AGE)); } else if (mChannelp->isPlaying()) { // Arbitarily cut off non-looped sounds when they're old. return elapsed > MAX_AGE; } else if(!isSyncSlave()) { // The sound isn't playing back after 15 seconds, kill it. // This might happen if all channels are in use and this source is low-priority return elapsed > MAX_UNPLAYED_AGE; } return false; }
bool LLAudioSource::isDone() const { const F32 MAX_AGE = 60.f; const F32 MAX_UNPLAYED_AGE = 15.f; const F32 MAX_MUTED_AGE = 11.f; if (isLoop()) { // Looped sources never die on their own. return false; } if (hasPendingPreloads()) { return false; } if (mQueuedDatap) { // Don't kill this sound if we've got something queued up to play. return false; } F32 elapsed = mAgeTimer.getElapsedTimeF32(); // This is a single-play source if (!mChannelp) { if ((elapsed > (mSourceMuted ? MAX_MUTED_AGE : MAX_UNPLAYED_AGE)) || mPlayedOnce) { // We don't have a channel assigned, and it's been // over 15 seconds since we tried to play it. Don't bother. //llinfos << "No channel assigned, source is done" << llendl; return true; } else { return false; } } if (mChannelp->isPlaying()) { if (elapsed > MAX_AGE) { // Arbitarily cut off non-looped sounds when they're old. return true; } else { // Sound is still playing and we haven't timed out, don't kill it. return false; } } if ((elapsed > MAX_UNPLAYED_AGE) || mPlayedOnce) { // The sound isn't playing back after 15 seconds or we're already done playing it, kill it. return true; } return false; }