bool LLAudioSource::play(const LLUUID &audio_uuid) { // Special abuse of play(); don't play a sound, but kill it. if (audio_uuid.isNull()) { if (getChannel()) { getChannel()->setSource(NULL); setChannel(NULL); if (!isMuted()) { mCurrentDatap = NULL; } } return false; } // <edit> if(mType != LLAudioEngine::AUDIO_TYPE_UI) //&& mSourceID.notNull()) logSoundPlay(this, audio_uuid); // </edit> // Reset our age timeout if someone attempts to play the source. mAgeTimer.reset(); LLAudioData *adp = gAudiop->getAudioData(audio_uuid); addAudioData(adp); if (isMuted()) { return false; } bool has_buffer = gAudiop->updateBufferForData(adp, audio_uuid); if (!has_buffer) { // Don't bother trying to set up a channel or anything, we don't have an audio buffer. return false; } if (!setupChannel()) { return false; } if (isSyncSlave()) { // A sync slave, it doesn't start playing until it's synced up with the master. // Flag this channel as waiting for sync, and return true. getChannel()->setWaiting(true); return true; } getChannel()->play(); return true; }
bool LLAudioSource::play(const LLUUID &audio_uuid) { // NaCl - Sound Explorer if(mType != LLAudioEngine::AUDIO_TYPE_UI) //&& mSourceID.notNull()) { logSoundPlay(mLogID, this, mPositionGlobal, mType, audio_uuid, mOwnerID, mSourceID, mIsTrigger, mLoop); } // NaCl End // Special abuse of play(); don't play a sound, but kill it. if (audio_uuid.isNull()) { if (getChannel()) { // NaCl - Sound Explorer if(getChannel()->getSource()) // NaCl End getChannel()->setSource(NULL); setChannel(NULL); if (!isMuted()) { mCurrentDatap = NULL; } } return false; } // Reset our age timeout if someone attempts to play the source. mAgeTimer.reset(); if (!gAudiop) { LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL; return false; } LLAudioData *adp = gAudiop->getAudioData(audio_uuid); if( !adp ) return false; addAudioData(adp); if (isMuted()) { return false; } bool has_buffer = gAudiop->updateBufferForData(adp, audio_uuid); if (!has_buffer) { // Don't bother trying to set up a channel or anything, we don't have an audio buffer. return false; } if (!setupChannel()) { return false; } if (isSyncSlave()) { // A sync slave, it doesn't start playing until it's synced up with the master. // Flag this channel as waiting for sync, and return true. getChannel()->setWaiting(true); return true; } getChannel()->play(); return true; }
bool LLAudioSource::play(const LLUUID &audio_uuid) { // Special abuse of play(); don't play a sound, but kill it. if (audio_uuid.isNull()) { if (getChannel()) { llassert(this == getChannel()->getSource()); getChannel()->cleanup(); if (!isMuted()) { mCurrentDatap = NULL; } } return false; } if(mType != LLAudioEngine::AUDIO_TYPE_UI) //&& mSourceID.notNull()) logSoundPlay(this, audio_uuid); // Reset our age timeout if someone attempts to play the source. mAgeTimer.reset(); LLAudioData *adp = gAudiop->getAudioData(audio_uuid); if (isQueueSounds()) { if(mQueuedDatap) { // We already have a sound queued up. Ignore new request. return false; } else if (adp == mCurrentDatap && isLoop()) { // No point in queuing the same sound if // we're looping. return true; } else if(mCurrentDatap) { mQueuedDatap = adp; return true; } } else if(mCurrentDatap == adp) //Desired sound did not change. Just re-play it. { if(getChannel() && getChannel()->isPlaying()) getChannel()->play(); return true; } else //Desired sound did change. Release the old channel if set. { if(getChannel()) getChannel()->cleanup(); mPlayedOnce = false; //Reset the played flag so the new sound is actually started up. } mCurrentDatap = adp; return true; }