예제 #1
0
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;
	}

	// 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);
	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()->setSource(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;
}
예제 #3
0
BOOL LLAudioSource::play(const LLUUID &audio_uuid)
{
	if (audio_uuid.isNull())
	{
		if (getChannel())
		{
			getChannel()->setSource(NULL);
			setChannel(NULL);
			addAudioData(NULL, TRUE);
		}
	}
	// Reset our age timeout if someone attempts to play the source.
	mAgeTimer.reset();

	LLAudioData *adp = gAudiop->getAudioData(audio_uuid);

	BOOL has_buffer = gAudiop->updateBufferForData(adp, audio_uuid);


	addAudioData(adp);

	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;
}
예제 #4
0
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;
}