summaryrefslogtreecommitdiff
path: root/indra/llaudio/llaudioengine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llaudio/llaudioengine.cpp')
-rwxr-xr-x[-rw-r--r--]indra/llaudio/llaudioengine.cpp303
1 files changed, 202 insertions, 101 deletions
diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp
index a28c94d00d..f49028aad5 100644..100755
--- a/indra/llaudio/llaudioengine.cpp
+++ b/indra/llaudio/llaudioengine.cpp
@@ -3,31 +3,25 @@
* @brief implementation of LLAudioEngine class abstracting the Open
* AL audio support
*
- * $LicenseInfo:firstyear=2000&license=viewergpl$
- *
- * Copyright (c) 2000-2009, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2000&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
@@ -103,6 +97,11 @@ void LLAudioEngine::setDefaults()
}
mMasterGain = 1.f;
+ // Setting mInternalGain to an out of range value fixes the issue reported in STORM-830.
+ // There is an edge case in setMasterGain during startup which prevents setInternalGain from
+ // being called if the master volume setting and mInternalGain both equal 0, so using -1 forces
+ // the if statement in setMasterGain to execute when the viewer starts up.
+ mInternalGain = -1.f;
mNextWindUpdate = 0.f;
mStreamingAudioImpl = NULL;
@@ -124,7 +123,7 @@ bool LLAudioEngine::init(const S32 num_channels, void* userdata)
// Initialize the decode manager
gAudioDecodeMgrp = new LLAudioDecodeMgr;
- llinfos << "LLAudioEngine::init() AudioEngine successfully initialized" << llendl;
+ LL_INFOS("AudioEngine") << "LLAudioEngine::init() AudioEngine successfully initialized" << LL_ENDL;
return true;
}
@@ -188,7 +187,7 @@ void LLAudioEngine::stopInternetStream()
}
// virtual
-void LLAudioEngine::pauseInternetStream(int pause)
+void LLAudioEngine::pauseInternetStream(S32 pause)
{
if (mStreamingAudioImpl)
mStreamingAudioImpl->pause(pause);
@@ -202,12 +201,12 @@ void LLAudioEngine::updateInternetStream()
}
// virtual
-int LLAudioEngine::isInternetStreamPlaying()
+LLAudioEngine::LLAudioPlayState LLAudioEngine::isInternetStreamPlaying()
{
if (mStreamingAudioImpl)
- return mStreamingAudioImpl->isPlaying();
+ return (LLAudioEngine::LLAudioPlayState) mStreamingAudioImpl->isPlaying();
- return 0; // Stopped
+ return LLAudioEngine::AUDIO_STOPPED; // Stopped
}
@@ -253,15 +252,6 @@ void LLAudioEngine::idle(F32 max_decode_time)
// Primarily does position updating, cleanup of unused audio sources.
// Also does regeneration of the current priority of each audio source.
- if (getMuted())
- {
- setInternalGain(0.f);
- }
- else
- {
- setInternalGain(getMasterGain());
- }
-
S32 i;
for (i = 0; i < MAX_BUFFERS; i++)
{
@@ -290,6 +280,12 @@ void LLAudioEngine::idle(F32 max_decode_time)
continue;
}
+ if (sourcep->isMuted())
+ {
+ ++iter;
+ continue;
+ }
+
if (!sourcep->getChannel() && sourcep->getCurrentBuffer())
{
// We could potentially play this sound if its priority is high enough.
@@ -312,7 +308,7 @@ void LLAudioEngine::idle(F32 max_decode_time)
LLAudioChannel *channelp = getFreeChannel(max_priority);
if (channelp)
{
- //llinfos << "Replacing source in channel due to priority!" << llendl;
+ //LL_INFOS() << "Replacing source in channel due to priority!" << LL_ENDL;
max_sourcep->setChannel(channelp);
channelp->setSource(max_sourcep);
if (max_sourcep->isSyncSlave())
@@ -342,9 +338,9 @@ void LLAudioEngine::idle(F32 max_decode_time)
// attached to each channel, since only those with active channels
// can have anything interesting happen with their queue? (Maybe not true)
LLAudioSource *sourcep = iter->second;
- if (!sourcep->mQueuedDatap)
+ if (!sourcep->mQueuedDatap || sourcep->isMuted())
{
- // Nothing queued, so we don't care.
+ // Muted, or nothing queued, so we don't care.
continue;
}
@@ -424,6 +420,10 @@ void LLAudioEngine::idle(F32 max_decode_time)
for (iter = mAllSources.begin(); iter != mAllSources.end(); ++iter)
{
LLAudioSource *sourcep = iter->second;
+ if (sourcep->isMuted())
+ {
+ continue;
+ }
if (sourcep->isSyncMaster())
{
if (sourcep->getPriority() > max_sm_priority)
@@ -479,7 +479,7 @@ void LLAudioEngine::idle(F32 max_decode_time)
{
if (!mBuffers[i]->mInUse && mBuffers[i]->mLastUseTimer.getElapsedTimeF32() > 30.f)
{
- //llinfos << "Flushing unused buffer!" << llendl;
+ //LL_INFOS() << "Flushing unused buffer!" << LL_ENDL;
mBuffers[i]->mAudioDatap->mBufferp = NULL;
delete mBuffers[i];
mBuffers[i] = NULL;
@@ -548,12 +548,11 @@ void LLAudioEngine::enableWind(bool enable)
{
if (enable && (!mEnableWind))
{
- initWind();
- mEnableWind = enable;
+ mEnableWind = initWind();
}
else if (mEnableWind && (!enable))
{
- mEnableWind = enable;
+ mEnableWind = false;
cleanupWind();
}
}
@@ -592,8 +591,8 @@ LLAudioBuffer * LLAudioEngine::getFreeBuffer()
if (buffer_id >= 0)
{
- llinfos << "Taking over unused buffer " << buffer_id << llendl;
- //llinfos << "Flushing unused buffer!" << llendl;
+ LL_DEBUGS() << "Taking over unused buffer " << buffer_id << LL_ENDL;
+ //LL_INFOS() << "Flushing unused buffer!" << LL_ENDL;
mBuffers[buffer_id]->mAudioDatap->mBufferp = NULL;
delete mBuffers[buffer_id];
mBuffers[buffer_id] = createBuffer();
@@ -674,7 +673,9 @@ void LLAudioEngine::cleanupBuffer(LLAudioBuffer *bufferp)
bool LLAudioEngine::preloadSound(const LLUUID &uuid)
{
- gAudiop->getAudioData(uuid); // We don't care about the return value, this is just to make sure
+ LL_DEBUGS("AudioEngine")<<"( "<<uuid<<" )"<<LL_ENDL;
+
+ 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))
@@ -685,7 +686,7 @@ bool LLAudioEngine::preloadSound(const LLUUID &uuid)
// At some point we need to have the audio/asset system check the static VFS
// before it goes off and fetches stuff from the server.
- //llwarns << "Used internal preload for non-local sound" << llendl;
+ //LL_WARNS() << "Used internal preload for non-local sound" << LL_ENDL;
return false;
}
@@ -698,15 +699,23 @@ bool LLAudioEngine::isWindEnabled()
void LLAudioEngine::setMuted(bool muted)
{
- mMuted = muted;
+ if (muted != mMuted)
+ {
+ mMuted = muted;
+ setMasterGain(mMasterGain);
+ }
enableWind(!mMuted);
}
-
void LLAudioEngine::setMasterGain(const F32 gain)
{
mMasterGain = gain;
- setInternalGain(gain);
+ F32 internal_gain = getMuted() ? 0.f : gain;
+ if (internal_gain != mInternalGain)
+ {
+ mInternalGain = internal_gain;
+ setInternalGain(mInternalGain);
+ }
}
F32 LLAudioEngine::getMasterGain()
@@ -808,7 +817,7 @@ void LLAudioEngine::triggerSound(const LLUUID &audio_uuid, const LLUUID& owner_i
const S32 type, const LLVector3d &pos_global)
{
// Create a new source (since this can't be associated with an existing source.
- //llinfos << "Localized: " << audio_uuid << llendl;
+ //LL_INFOS() << "Localized: " << audio_uuid << LL_ENDL;
if (mMuted)
{
@@ -819,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);
@@ -832,6 +841,10 @@ void LLAudioEngine::triggerSound(const LLUUID &audio_uuid, const LLUUID& owner_i
asp->play(audio_uuid);
}
+void LLAudioEngine::triggerSound(SoundData& soundData)
+{
+ triggerSound(soundData.audio_uuid, soundData.owner_id, soundData.gain, soundData.type, soundData.pos_global);
+}
void LLAudioEngine::setListenerPos(LLVector3 aVec)
{
@@ -971,12 +984,16 @@ void LLAudioEngine::cleanupAudioSource(LLAudioSource *asp)
iter = mAllSources.find(asp->getID());
if (iter == mAllSources.end())
{
- llwarns << "Cleaning up unknown audio source!" << llendl;
+ LL_WARNS() << "Cleaning up unknown audio source!" << LL_ENDL;
return;
}
+ else
+ {
+ LL_DEBUGS("AudioEngine") << "Cleaning up audio sources for "<< asp->getID() <<LL_ENDL;
delete asp;
mAllSources.erase(iter);
}
+}
bool LLAudioEngine::hasDecodedFile(const LLUUID &uuid)
@@ -1002,16 +1019,18 @@ bool LLAudioEngine::hasDecodedFile(const LLUUID &uuid)
bool LLAudioEngine::hasLocalFile(const LLUUID &uuid)
{
// See if it's in the VFS.
- return gVFS->getExists(uuid, LLAssetType::AT_SOUND);
+ bool have_local = gVFS->getExists(uuid, LLAssetType::AT_SOUND);
+ LL_DEBUGS("AudioEngine") << "sound uuid "<<uuid<<" exists in VFS"<<LL_ENDL;
+ return have_local;
}
void LLAudioEngine::startNextTransfer()
{
- //llinfos << "LLAudioEngine::startNextTransfer()" << llendl;
+ //LL_INFOS() << "LLAudioEngine::startNextTransfer()" << LL_ENDL;
if (mCurrentTransfer.notNull() || getMuted())
{
- //llinfos << "Transfer in progress, aborting" << llendl;
+ //LL_INFOS() << "Transfer in progress, aborting" << LL_ENDL;
return;
}
@@ -1192,15 +1211,15 @@ void LLAudioEngine::startNextTransfer()
if (asset_id.notNull())
{
- llinfos << "Getting asset data for: " << asset_id << llendl;
- gAudiop->mCurrentTransfer = asset_id;
- gAudiop->mCurrentTransferTimer.reset();
+ LL_INFOS() << "Getting asset data for: " << asset_id << LL_ENDL;
+ mCurrentTransfer = asset_id;
+ mCurrentTransferTimer.reset();
gAssetStorage->getAssetData(asset_id, LLAssetType::AT_SOUND,
assetCallback, NULL);
}
else
{
- //llinfos << "No pending transfers?" << llendl;
+ //LL_INFOS() << "No pending transfers?" << LL_ENDL;
}
}
@@ -1208,16 +1227,23 @@ 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)
{
- llinfos << "Boom, error in audio file transfer: " << LLAssetStorage::getErrorString( result_code ) << " (" << result_code << ")" << llendl;
+ LL_INFOS() << "Boom, error in audio file transfer: " << LLAssetStorage::getErrorString( result_code ) << " (" << result_code << ")" << LL_ENDL;
// Need to mark data as bad to avoid constant rerequests.
LLAudioData *adp = gAudiop->getAudioData(uuid);
if (adp)
- {
+ { // Make sure everything is cleared
adp->setHasValidData(false);
adp->setHasLocalData(false);
adp->setHasDecodedData(false);
+ adp->setHasCompletedDecode(true);
}
}
else
@@ -1226,10 +1252,11 @@ void LLAudioEngine::assetCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::E
if (!adp)
{
// Should never happen
- llwarns << "Got asset callback without audio data for " << uuid << llendl;
+ LL_WARNS() << "Got asset callback without audio data for " << uuid << LL_ENDL;
}
else
{
+ // LL_INFOS() << "Got asset callback with good audio data for " << uuid << ", making decode request" << LL_ENDL;
adp->setHasValidData(true);
adp->setHasLocalData(true);
gAudioDecodeMgrp->addDecodeRequest(uuid);
@@ -1250,13 +1277,15 @@ LLAudioSource::LLAudioSource(const LLUUID& id, const LLUUID& owner_id, const F32
mOwnerID(owner_id),
mPriority(0.f),
mGain(gain),
- mType(type),
+ mSourceMuted(false),
mAmbient(false),
mLoop(false),
mSyncMaster(false),
mSyncSlave(false),
mQueueSounds(false),
mPlayedOnce(false),
+ mCorrupted(false),
+ mType(type),
mChannelp(NULL),
mCurrentDatap(NULL),
mQueuedDatap(NULL)
@@ -1288,16 +1317,27 @@ void LLAudioSource::setChannel(LLAudioChannel *channelp)
void LLAudioSource::update()
{
+ if(mCorrupted)
+ {
+ return ; //no need to update
+ }
+
if (!getCurrentBuffer())
{
- if (getCurrentData())
+ LLAudioData *adp = getCurrentData();
+ if (adp)
{
// Hack - try and load the sound. Will do this as a callback
// on decode later.
- if (getCurrentData()->load())
+ if (adp->load() && adp->getBuffer())
+ {
+ play(adp->getID());
+ }
+ else if (adp->hasCompletedDecode()) // Only mark corrupted after decode is done
{
- play(getCurrentData()->getID());
- }
+ LL_WARNS() << "Marking LLAudioSource corrupted for " << adp->getID() << LL_ENDL;
+ mCorrupted = true ;
+ }
}
}
}
@@ -1308,12 +1348,21 @@ void LLAudioSource::updatePriority()
{
mPriority = 1.f;
}
+ else if (isMuted())
+ {
+ mPriority = 0.f;
+ }
else
{
// 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;
@@ -1327,10 +1376,15 @@ bool LLAudioSource::setupChannel()
if (!adp->getBuffer())
{
// We're not ready to play back the sound yet, so don't try and allocate a channel for it.
- //llwarns << "Aborting, no buffer" << llendl;
+ //LL_WARNS() << "Aborting, no buffer" << LL_ENDL;
return false;
}
+ if (!gAudiop)
+ {
+ LL_WARNS("AudioEngine") << "LLAudioEngine instance doesn't exist!" << LL_ENDL;
+ return false;
+ }
if (!mChannelp)
{
@@ -1345,7 +1399,7 @@ bool LLAudioSource::setupChannel()
// Ugh, we don't have any free channels.
// Now we have to reprioritize.
// For now, just don't play the sound.
- //llwarns << "Aborting, no free channels" << llendl;
+ //LL_WARNS() << "Aborting, no free channels" << LL_ENDL;
return false;
}
@@ -1356,25 +1410,39 @@ bool LLAudioSource::setupChannel()
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);
- addAudioData(NULL, true);
+ if (!isMuted())
+ {
+ mCurrentDatap = NULL;
+ }
}
+ return false;
}
+
// 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);
-
+ 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.
@@ -1399,10 +1467,16 @@ bool LLAudioSource::play(const LLUUID &audio_uuid)
}
-bool LLAudioSource::isDone()
+bool LLAudioSource::isDone() const
{
+ if(mCorrupted)
+ {
+ return true ;
+ }
+
const F32 MAX_AGE = 60.f;
const F32 MAX_UNPLAYED_AGE = 15.f;
+ const F32 MAX_MUTED_AGE = 11.f;
if (isLoop())
{
@@ -1410,7 +1484,6 @@ bool LLAudioSource::isDone()
return false;
}
-
if (hasPendingPreloads())
{
return false;
@@ -1427,11 +1500,11 @@ bool LLAudioSource::isDone()
// This is a single-play source
if (!mChannelp)
{
- if ((elapsed > MAX_UNPLAYED_AGE) || mPlayedOnce)
+ if ((elapsed > (mSourceMuted ? MAX_MUTED_AGE : MAX_UNPLAYED_AGE)) || mPlayedOnce)
{
// We don't have a channel assigned, and it's been
- // over 5 seconds since we tried to play it. Don't bother.
- //llinfos << "No channel assigned, source is done" << llendl;
+ // over 15 seconds since we tried to play it. Don't bother.
+ //LL_INFOS() << "No channel assigned, source is done" << LL_ENDL;
return true;
}
else
@@ -1456,7 +1529,7 @@ bool LLAudioSource::isDone()
if ((elapsed > MAX_UNPLAYED_AGE) || mPlayedOnce)
{
- // The sound isn't playing back after 5 seconds or we're already done playing it, kill it.
+ // The sound isn't playing back after 15 seconds or we're already done playing it, kill it.
return true;
}
@@ -1468,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)
@@ -1541,6 +1621,10 @@ bool LLAudioSource::hasPendingPreloads() const
LLAudioData *adp = iter->second;
// note: a bad UUID will forever be !hasDecodedData()
// but also !hasValidData(), hence the check for hasValidData()
+ if (!adp)
+ {
+ continue;
+ }
if (!adp->hasDecodedData() && adp->hasValidData())
{
// This source is still waiting for a preload
@@ -1593,7 +1677,7 @@ LLAudioChannel::LLAudioChannel() :
LLAudioChannel::~LLAudioChannel()
{
// Need to disconnect any sources which are using this channel.
- //llinfos << "Cleaning up audio channel" << llendl;
+ //LL_INFOS() << "Cleaning up audio channel" << LL_ENDL;
if (mCurrentSourcep)
{
mCurrentSourcep->setChannel(NULL);
@@ -1604,34 +1688,42 @@ LLAudioChannel::~LLAudioChannel()
void LLAudioChannel::setSource(LLAudioSource *sourcep)
{
- //llinfos << this << ": setSource(" << sourcep << ")" << llendl;
+ //LL_INFOS() << this << ": setSource(" << sourcep << ")" << LL_ENDL;
if (!sourcep)
{
// Clearing the source for this channel, don't need to do anything.
- //llinfos << "Clearing source for channel" << llendl;
+ //LL_INFOS() << "Clearing source for channel" << LL_ENDL;
cleanup();
mCurrentSourcep = NULL;
mWaiting = false;
- return;
}
+ else
+ {
+ LL_DEBUGS("AudioEngine") << "( id: " << sourcep->getID() << ")" << LL_ENDL;
if (sourcep == mCurrentSourcep)
{
// Don't reallocate the channel, this will make FMOD goofy.
- //llinfos << "Calling setSource with same source!" << llendl;
+ //LL_INFOS() << "Calling setSource with same source!" << LL_ENDL;
}
mCurrentSourcep = sourcep;
-
updateBuffer();
update3DPosition();
}
+}
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
@@ -1640,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)
@@ -1692,6 +1781,7 @@ LLAudioData::LLAudioData(const LLUUID &uuid) :
mBufferp(NULL),
mHasLocalData(false),
mHasDecodedData(false),
+ mHasCompletedDecode(false),
mHasValidData(true)
{
if (uuid.isNull())
@@ -1699,36 +1789,49 @@ 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.
- mHasLocalData = true;
- mHasDecodedData = true;
+ setHasLocalData(true);
+ setHasDecodedData(true);
+ setHasCompletedDecode(true);
}
else if (gAssetStorage && gAssetStorage->hasLocalAsset(uuid, LLAssetType::AT_SOUND))
{
- mHasLocalData = true;
+ setHasLocalData(true);
}
}
-
+//return false when the audio file is corrupted.
bool LLAudioData::load()
{
// For now, just assume we're going to use one buffer per audiodata.
if (mBufferp)
{
// We already have this sound in a buffer, don't do anything.
- llinfos << "Already have a buffer for this sound, don't bother loading!" << llendl;
+ 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)
{
// No free buffers, abort.
- llinfos << "Not able to allocate a new audio buffer, aborting." << llendl;
- return false;
+ LL_INFOS() << "Not able to allocate a new audio buffer, aborting." << LL_ENDL;
+ return true;
}
std::string uuid_str;
@@ -1747,5 +1850,3 @@ bool LLAudioData::load()
mBufferp->mAudioDatap = this;
return true;
}
-
-