summaryrefslogtreecommitdiff
path: root/indra/llaudio
diff options
context:
space:
mode:
authorChris Baker <baker@lindenlab.com>2014-06-16 21:15:41 +0000
committerChris Baker <baker@lindenlab.com>2014-06-16 21:15:41 +0000
commitee14005a2aea89b2988fa0a5060f38b669e45389 (patch)
tree3b9930089be344a9c25172f3ca4be0fbf412ba17 /indra/llaudio
parenta92dbb592b338f48f7b75b68a9da511dc95279f9 (diff)
parent977476171ddcc057d7c28b6c14ae988b8189ed75 (diff)
viewer-release merge
Diffstat (limited to 'indra/llaudio')
-rwxr-xr-xindra/llaudio/llaudiodecodemgr.cpp17
-rwxr-xr-xindra/llaudio/llaudioengine.cpp66
2 files changed, 66 insertions, 17 deletions
diff --git a/indra/llaudio/llaudiodecodemgr.cpp b/indra/llaudio/llaudiodecodemgr.cpp
index 27add74b26..20a7afc748 100755
--- a/indra/llaudio/llaudiodecodemgr.cpp
+++ b/indra/llaudio/llaudiodecodemgr.cpp
@@ -572,9 +572,14 @@ void LLAudioDecodeMgr::Impl::processQueue(const F32 num_secs)
// We had an error when decoding, abort.
LL_WARNS("AudioEngine") << mCurrentDecodep->getUUID() << " has invalid vorbis data, aborting decode" << LL_ENDL;
mCurrentDecodep->flushBadFile();
- LLAudioData *adp = gAudiop->getAudioData(mCurrentDecodep->getUUID());
- adp->setHasValidData(false);
- adp->setHasCompletedDecode(true);
+
+ if (gAudiop)
+ {
+ LLAudioData *adp = gAudiop->getAudioData(mCurrentDecodep->getUUID());
+ adp->setHasValidData(false);
+ adp->setHasCompletedDecode(true);
+ }
+
mCurrentDecodep = NULL;
done = TRUE;
}
@@ -586,7 +591,7 @@ void LLAudioDecodeMgr::Impl::processQueue(const F32 num_secs)
}
else if (mCurrentDecodep)
{
- if (mCurrentDecodep->finishDecode())
+ if (gAudiop && mCurrentDecodep->finishDecode())
{
// We finished!
LLAudioData *adp = gAudiop->getAudioData(mCurrentDecodep->getUUID());
@@ -628,7 +633,7 @@ void LLAudioDecodeMgr::Impl::processQueue(const F32 num_secs)
LLUUID uuid;
uuid = mDecodeQueue.front();
mDecodeQueue.pop_front();
- if (gAudiop->hasDecodedFile(uuid))
+ if (!gAudiop || gAudiop->hasDecodedFile(uuid))
{
// This file has already been decoded, don't decode it again.
continue;
@@ -674,7 +679,7 @@ void LLAudioDecodeMgr::processQueue(const F32 num_secs)
BOOL LLAudioDecodeMgr::addDecodeRequest(const LLUUID &uuid)
{
- if (gAudiop->hasDecodedFile(uuid))
+ if (gAudiop && gAudiop->hasDecodedFile(uuid))
{
// Already have a decoded version, don't need to decode it.
LL_DEBUGS("AudioEngine") << "addDecodeRequest for " << uuid << " has decoded file already" << LL_ENDL;
diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp
index 5fc5e2ac46..f49028aad5 100755
--- a/indra/llaudio/llaudioengine.cpp
+++ b/indra/llaudio/llaudioengine.cpp
@@ -674,8 +674,8 @@ void LLAudioEngine::cleanupBuffer(LLAudioBuffer *bufferp)
bool LLAudioEngine::preloadSound(const LLUUID &uuid)
{
LL_DEBUGS("AudioEngine")<<"( "<<uuid<<" )"<<LL_ENDL;
-
- gAudiop->getAudioData(uuid); // We don't care about the return value, this is just to make sure
+
+ getAudioData(uuid); // We don't care about the return value, this is just to make sure
// that we have an entry, which will mean that the audio engine knows about this
if (gAudioDecodeMgrp->addDecodeRequest(uuid))
@@ -828,7 +828,7 @@ void LLAudioEngine::triggerSound(const LLUUID &audio_uuid, const LLUUID& owner_i
source_id.generate();
LLAudioSource *asp = new LLAudioSource(source_id, owner_id, gain, type);
- gAudiop->addAudioSource(asp);
+ addAudioSource(asp);
if (pos_global.isExactlyZero())
{
asp->setAmbient(true);
@@ -1212,8 +1212,8 @@ void LLAudioEngine::startNextTransfer()
if (asset_id.notNull())
{
LL_INFOS() << "Getting asset data for: " << asset_id << LL_ENDL;
- gAudiop->mCurrentTransfer = asset_id;
- gAudiop->mCurrentTransferTimer.reset();
+ mCurrentTransfer = asset_id;
+ mCurrentTransferTimer.reset();
gAssetStorage->getAssetData(asset_id, LLAssetType::AT_SOUND,
assetCallback, NULL);
}
@@ -1227,6 +1227,12 @@ void LLAudioEngine::startNextTransfer()
// static
void LLAudioEngine::assetCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::EType type, void *user_data, S32 result_code, LLExtStat ext_status)
{
+ if (!gAudiop)
+ {
+ LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL;
+ return;
+ }
+
if (result_code)
{
LL_INFOS() << "Boom, error in audio file transfer: " << LLAssetStorage::getErrorString( result_code ) << " (" << result_code << ")" << LL_ENDL;
@@ -1351,7 +1357,12 @@ void LLAudioSource::updatePriority()
// Priority is based on distance
LLVector3 dist_vec;
dist_vec.setVec(getPositionGlobal());
- dist_vec -= gAudiop->getListenerPos();
+
+ if (gAudiop)
+ {
+ dist_vec -= gAudiop->getListenerPos();
+ }
+
F32 dist_squared = llmax(1.f, dist_vec.magVecSquared());
mPriority = mGain / dist_squared;
@@ -1369,6 +1380,11 @@ bool LLAudioSource::setupChannel()
return false;
}
+ if (!gAudiop)
+ {
+ LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL;
+ return false;
+ }
if (!mChannelp)
{
@@ -1412,6 +1428,12 @@ bool LLAudioSource::play(const LLUUID &audio_uuid)
// 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);
@@ -1519,6 +1541,13 @@ void LLAudioSource::addAudioData(LLAudioData *adp, const bool set_current)
{
// Only handle a single piece of audio data associated with a source right now,
// until I implement prefetch.
+
+ if (!gAudiop)
+ {
+ LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL;
+ return;
+ }
+
if (set_current)
{
if (!mCurrentDatap)
@@ -1689,6 +1718,12 @@ void LLAudioChannel::setSource(LLAudioSource *sourcep)
bool LLAudioChannel::updateBuffer()
{
+ if (!gAudiop)
+ {
+ LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL;
+ return false;
+ }
+
if (!mCurrentSourcep)
{
// This channel isn't associated with any source, nothing
@@ -1697,10 +1732,7 @@ bool LLAudioChannel::updateBuffer()
}
// Initialize the channel's gain setting for this sound.
- if(gAudiop)
- {
- setSecondaryGain(gAudiop->getSecondaryGain(mCurrentSourcep->getType()));
- }
+ setSecondaryGain(gAudiop->getSecondaryGain(mCurrentSourcep->getType()));
LLAudioBuffer *bufferp = mCurrentSourcep->getCurrentBuffer();
if (bufferp == mCurrentBufferp)
@@ -1757,8 +1789,14 @@ LLAudioData::LLAudioData(const LLUUID &uuid) :
// This is a null sound.
return;
}
+
+ if (!gAudiop)
+ {
+ LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL;
+ return;
+ }
- if (gAudiop && gAudiop->hasDecodedFile(uuid))
+ if (gAudiop->hasDecodedFile(uuid))
{
// Already have a decoded version, don't need to decode it.
setHasLocalData(true);
@@ -1781,6 +1819,12 @@ bool LLAudioData::load()
LL_INFOS() << "Already have a buffer for this sound, don't bother loading!" << LL_ENDL;
return true;
}
+
+ if (!gAudiop)
+ {
+ LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL;
+ return false;
+ }
mBufferp = gAudiop->getFreeBuffer();
if (!mBufferp)