summaryrefslogtreecommitdiff
path: root/indra/llaudio/llaudioengine.cpp
diff options
context:
space:
mode:
authorobscurestar <none@none>2014-02-24 15:12:04 -0800
committerobscurestar <none@none>2014-02-24 15:12:04 -0800
commit8fd270af1cb7ee2cad7c47909b308ef31caf4cd3 (patch)
tree0908629d1ae5173098bb204ab2447c6d351d894e /indra/llaudio/llaudioengine.cpp
parent57d7cbb8375ca59bcb3d3643e4013b88e8883822 (diff)
parentde8fea13627cc5978b8a6135802a52864a11c39a (diff)
Pulled from release.
Diffstat (limited to 'indra/llaudio/llaudioengine.cpp')
-rwxr-xr-xindra/llaudio/llaudioengine.cpp84
1 files changed, 45 insertions, 39 deletions
diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp
index 06e752cf34..ca614f5395 100755
--- a/indra/llaudio/llaudioengine.cpp
+++ b/indra/llaudio/llaudioengine.cpp
@@ -123,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;
}
@@ -308,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_DEBUGS("AudioEngine") << "Replacing source in channel due to priority!" << LL_ENDL;
max_sourcep->setChannel(channelp);
channelp->setSource(max_sourcep);
if (max_sourcep->isSyncSlave())
@@ -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_DEBUGS("AudioEngine") << "Flushing unused buffer!" << LL_ENDL;
mBuffers[i]->mAudioDatap->mBufferp = NULL;
delete mBuffers[i];
mBuffers[i] = NULL;
@@ -591,8 +591,8 @@ LLAudioBuffer * LLAudioEngine::getFreeBuffer()
if (buffer_id >= 0)
{
- lldebugs << "Taking over unused buffer " << buffer_id << llendl;
- //llinfos << "Flushing unused buffer!" << llendl;
+ lldebugs << "Taking over unused buffer " << buffer_id << LL_ENDL;
+ LL_DEBUGS("AudioEngine") << "Flushing unused buffer!" << LL_ENDL;
mBuffers[buffer_id]->mAudioDatap->mBufferp = NULL;
delete mBuffers[buffer_id];
mBuffers[buffer_id] = createBuffer();
@@ -673,6 +673,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
// that we have an entry, which will mean that the audio engine knows about this
@@ -684,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_DEBUGS("AudioEngine") << "Used internal preload for non-local sound "<< uuid << LL_ENDL;
return false;
}
@@ -815,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_DEBUGS("AudioEngine") << "Localized: " << audio_uuid << LL_ENDL;
if (mMuted)
{
@@ -982,11 +984,14 @@ void LLAudioEngine::cleanupAudioSource(LLAudioSource *asp)
iter = mAllSources.find(asp->getID());
if (iter == mAllSources.end())
{
- llwarns << "Cleaning up unknown audio source!" << llendl;
- return;
+ LL_WARNS("AudioEngine") << "Cleaning up unknown audio source!" << LL_ENDL;
+ }
+ else
+ {
+ LL_DEBUGS("AudioEngine") << "Cleaning up audio sources for "<< asp->getID() <<LL_ENDL;
+ delete asp;
+ mAllSources.erase(iter);
}
- delete asp;
- mAllSources.erase(iter);
}
@@ -1013,16 +1018,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_DEBUGS("AudioEngine") << "LLAudioEngine::startNextTransfer()" << LL_ENDL;
if (mCurrentTransfer.notNull() || getMuted())
{
- //llinfos << "Transfer in progress, aborting" << llendl;
+ //LL_DEBUGS("AudioEngine") << "Transfer in progress, aborting" << LL_ENDL;
return;
}
@@ -1203,7 +1210,7 @@ void LLAudioEngine::startNextTransfer()
if (asset_id.notNull())
{
- llinfos << "Getting asset data for: " << asset_id << llendl;
+ LL_INFOS("AudioEngine") << "Getting audio asset data for: " << asset_id << LL_ENDL;
gAudiop->mCurrentTransfer = asset_id;
gAudiop->mCurrentTransferTimer.reset();
gAssetStorage->getAssetData(asset_id, LLAssetType::AT_SOUND,
@@ -1211,7 +1218,7 @@ void LLAudioEngine::startNextTransfer()
}
else
{
- //llinfos << "No pending transfers?" << llendl;
+ //LL_DEBUGS("AudioEngine") << "No pending transfers?" << LL_ENDL;
}
}
@@ -1221,7 +1228,7 @@ void LLAudioEngine::assetCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::E
{
if (result_code)
{
- llinfos << "Boom, error in audio file transfer: " << LLAssetStorage::getErrorString( result_code ) << " (" << result_code << ")" << llendl;
+ LL_INFOS("AudioEngine") << "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)
@@ -1238,11 +1245,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("AudioEngine") << "Got asset callback without audio data for " << uuid << LL_ENDL;
}
else
{
- // llinfos << "Got asset callback with good audio data for " << uuid << ", making decode request" << llendl;
+ LL_DEBUGS("AudioEngine") << "Got asset callback with good audio data for " << uuid << ", making decode request" << LL_ENDL;
adp->setHasValidData(true);
adp->setHasLocalData(true);
gAudioDecodeMgrp->addDecodeRequest(uuid);
@@ -1321,7 +1328,7 @@ void LLAudioSource::update()
}
else if (adp->hasCompletedDecode()) // Only mark corrupted after decode is done
{
- llwarns << "Marking LLAudioSource corrupted for " << adp->getID() << llendl;
+ LL_WARNS("AudioEngine") << "Marking LLAudioSource corrupted for " << adp->getID() << LL_ENDL;
mCorrupted = true ;
}
}
@@ -1357,7 +1364,6 @@ 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;
return false;
}
@@ -1375,7 +1381,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;
+ //llwarns << "Aborting, no free channels" << LL_ENDL;
return false;
}
@@ -1474,7 +1480,7 @@ bool LLAudioSource::isDone() const
{
// 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;
+ LL_DEBUGS("AudioEngine") << "No channel assigned, source is done" << LL_ENDL;
return true;
}
else
@@ -1640,7 +1646,7 @@ LLAudioChannel::LLAudioChannel() :
LLAudioChannel::~LLAudioChannel()
{
// Need to disconnect any sources which are using this channel.
- //llinfos << "Cleaning up audio channel" << llendl;
+ LL_DEBUGS("AudioEngine") << "Cleaning up audio channel" << LL_ENDL;
if (mCurrentSourcep)
{
mCurrentSourcep->setChannel(NULL);
@@ -1651,29 +1657,29 @@ LLAudioChannel::~LLAudioChannel()
void LLAudioChannel::setSource(LLAudioSource *sourcep)
{
- //llinfos << this << ": setSource(" << sourcep << ")" << llendl;
-
if (!sourcep)
{
// Clearing the source for this channel, don't need to do anything.
- //llinfos << "Clearing source for channel" << llendl;
+ LL_DEBUGS("AudioEngine") << "Clearing source" << ( mCurrentSourcep ? mCurrentSourcep->getID() : LLUUID::null ) << LL_ENDL;
cleanup();
mCurrentSourcep = NULL;
mWaiting = false;
- return;
}
-
- if (sourcep == mCurrentSourcep)
+ else
{
- // Don't reallocate the channel, this will make FMOD goofy.
- //llinfos << "Calling setSource with same source!" << llendl;
- }
-
- mCurrentSourcep = sourcep;
+ LL_DEBUGS("AudioEngine") << "( id: " << sourcep->getID() << ")" << LL_ENDL;
+ if (sourcep == mCurrentSourcep)
+ {
+ // Don't reallocate the channel, this will make FMOD goofy.
+ //LL_DEBUGS("AudioEngine") << "Calling setSource with same source!" << LL_ENDL;
+ }
- updateBuffer();
- update3DPosition();
+ mCurrentSourcep = sourcep;
+
+ updateBuffer();
+ update3DPosition();
+ }
}
@@ -1768,7 +1774,7 @@ bool LLAudioData::load()
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("AudioEngine") << "Already have a buffer for this sound, don't bother loading!" << LL_ENDL;
return true;
}
@@ -1776,7 +1782,7 @@ bool LLAudioData::load()
if (!mBufferp)
{
// No free buffers, abort.
- llinfos << "Not able to allocate a new audio buffer, aborting." << llendl;
+ LL_INFOS("AudioEngine") << "Not able to allocate a new audio buffer, aborting." << LL_ENDL;
return true;
}