diff options
Diffstat (limited to 'indra/llaudio')
-rwxr-xr-x | indra/llaudio/llaudiodecodemgr.cpp | 36 | ||||
-rwxr-xr-x | indra/llaudio/llaudiodecodemgr.h | 1 | ||||
-rwxr-xr-x | indra/llaudio/llaudioengine.cpp | 140 | ||||
-rwxr-xr-x | indra/llaudio/llaudioengine.h | 4 | ||||
-rw-r--r-- | indra/llaudio/llaudioengine_fmodex.cpp | 30 | ||||
-rwxr-xr-x | indra/llaudio/llaudioengine_openal.cpp | 74 | ||||
-rwxr-xr-x | indra/llaudio/lllistener_openal.cpp | 10 | ||||
-rw-r--r-- | indra/llaudio/llstreamingaudio_fmodex.cpp | 26 | ||||
-rw-r--r-- | indra/llaudio/llstreamingaudio_fmodex.h | 4 | ||||
-rwxr-xr-x | indra/llaudio/llvorbisencode.cpp | 20 |
10 files changed, 200 insertions, 145 deletions
diff --git a/indra/llaudio/llaudiodecodemgr.cpp b/indra/llaudio/llaudiodecodemgr.cpp index 8c31f8b4de..20a7afc748 100755 --- a/indra/llaudio/llaudiodecodemgr.cpp +++ b/indra/llaudio/llaudiodecodemgr.cpp @@ -40,6 +40,8 @@ #include "vorbis/codec.h" #include "vorbis/vorbisfile.h" +#include <iterator> +#include <deque> extern LLAudioEngine *gAudiop; @@ -113,7 +115,7 @@ size_t vfs_read(void *ptr, size_t size, size_t nmemb, void *datasource) } } -int vfs_seek(void *datasource, ogg_int64_t offset, int whence) +S32 vfs_seek(void *datasource, ogg_int64_t offset, S32 whence) { LLVFile *file = (LLVFile *)datasource; @@ -149,7 +151,7 @@ int vfs_seek(void *datasource, ogg_int64_t offset, int whence) } } -int vfs_close (void *datasource) +S32 vfs_close (void *datasource) { LLVFile *file = (LLVFile *)datasource; delete file; @@ -208,7 +210,7 @@ BOOL LLVorbisDecodeState::initDecode() return FALSE; } - int r = ov_open_callbacks(mInFilep, &mVF, NULL, 0, vfs_callbacks); + S32 r = ov_open_callbacks(mInFilep, &mVF, NULL, 0, vfs_callbacks); if(r < 0) { LL_WARNS("AudioEngine") << r << " Input to vorbis decode does not appear to be an Ogg bitstream: " << mUUID << LL_ENDL; @@ -541,7 +543,7 @@ public: void processQueue(const F32 num_secs = 0.005); protected: - LLLinkedQueue<LLUUID> mDecodeQueue; + std::deque<LLUUID> mDecodeQueue; LLPointer<LLVorbisDecodeState> mCurrentDecodep; }; @@ -570,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; } @@ -584,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()); @@ -616,7 +623,7 @@ void LLAudioDecodeMgr::Impl::processQueue(const F32 num_secs) if (!done) { - if (!mDecodeQueue.getLength()) + if (mDecodeQueue.empty()) { // Nothing else on the queue. done = TRUE; @@ -624,14 +631,15 @@ void LLAudioDecodeMgr::Impl::processQueue(const F32 num_secs) else { LLUUID uuid; - mDecodeQueue.pop(uuid); - if (gAudiop->hasDecodedFile(uuid)) + uuid = mDecodeQueue.front(); + mDecodeQueue.pop_front(); + if (!gAudiop || gAudiop->hasDecodedFile(uuid)) { // This file has already been decoded, don't decode it again. continue; } - lldebugs << "Decoding " << uuid << " from audio queue!" << LL_ENDL; + LL_DEBUGS() << "Decoding " << uuid << " from audio queue!" << LL_ENDL; std::string uuid_str; std::string d_path; @@ -671,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; @@ -682,7 +690,7 @@ BOOL LLAudioDecodeMgr::addDecodeRequest(const LLUUID &uuid) { // Just put it on the decode queue. LL_DEBUGS("AudioEngine") << "addDecodeRequest for " << uuid << " has local asset file already" << LL_ENDL; - mImpl->mDecodeQueue.push(uuid); + mImpl->mDecodeQueue.push_back(uuid); return TRUE; } diff --git a/indra/llaudio/llaudiodecodemgr.h b/indra/llaudio/llaudiodecodemgr.h index 1207638f15..8228e20e8c 100755 --- a/indra/llaudio/llaudiodecodemgr.h +++ b/indra/llaudio/llaudiodecodemgr.h @@ -28,7 +28,6 @@ #include "stdtypes.h" -#include "lllinkedqueue.h" #include "lluuid.h" #include "llassettype.h" diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp index ca614f5395..f49028aad5 100755 --- a/indra/llaudio/llaudioengine.cpp +++ b/indra/llaudio/llaudioengine.cpp @@ -187,7 +187,7 @@ void LLAudioEngine::stopInternetStream() } // virtual -void LLAudioEngine::pauseInternetStream(int pause) +void LLAudioEngine::pauseInternetStream(S32 pause) { if (mStreamingAudioImpl) mStreamingAudioImpl->pause(pause); @@ -308,7 +308,7 @@ void LLAudioEngine::idle(F32 max_decode_time) LLAudioChannel *channelp = getFreeChannel(max_priority); if (channelp) { - LL_DEBUGS("AudioEngine") << "Replacing source in channel due to priority!" << LL_ENDL; + //LL_INFOS() << "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) { - LL_DEBUGS("AudioEngine") << "Flushing unused buffer!" << LL_ENDL; + //LL_INFOS() << "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 << LL_ENDL; - LL_DEBUGS("AudioEngine") << "Flushing unused buffer!" << LL_ENDL; + 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,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)) @@ -686,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. - LL_DEBUGS("AudioEngine") << "Used internal preload for non-local sound "<< uuid << LL_ENDL; + //LL_WARNS() << "Used internal preload for non-local sound" << LL_ENDL; return false; } @@ -817,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. - LL_DEBUGS("AudioEngine") << "Localized: " << audio_uuid << LL_ENDL; + //LL_INFOS() << "Localized: " << audio_uuid << LL_ENDL; if (mMuted) { @@ -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); @@ -984,14 +984,15 @@ void LLAudioEngine::cleanupAudioSource(LLAudioSource *asp) iter = mAllSources.find(asp->getID()); if (iter == mAllSources.end()) { - LL_WARNS("AudioEngine") << "Cleaning up unknown audio source!" << LL_ENDL; + 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); - } + delete asp; + mAllSources.erase(iter); +} } @@ -1026,10 +1027,10 @@ bool LLAudioEngine::hasLocalFile(const LLUUID &uuid) void LLAudioEngine::startNextTransfer() { - //LL_DEBUGS("AudioEngine") << "LLAudioEngine::startNextTransfer()" << LL_ENDL; + //LL_INFOS() << "LLAudioEngine::startNextTransfer()" << LL_ENDL; if (mCurrentTransfer.notNull() || getMuted()) { - //LL_DEBUGS("AudioEngine") << "Transfer in progress, aborting" << LL_ENDL; + //LL_INFOS() << "Transfer in progress, aborting" << LL_ENDL; return; } @@ -1210,15 +1211,15 @@ void LLAudioEngine::startNextTransfer() if (asset_id.notNull()) { - LL_INFOS("AudioEngine") << "Getting audio asset data for: " << asset_id << LL_ENDL; - 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 { - //LL_DEBUGS("AudioEngine") << "No pending transfers?" << LL_ENDL; + //LL_INFOS() << "No pending transfers?" << LL_ENDL; } } @@ -1226,9 +1227,15 @@ 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("AudioEngine") << "Boom, error in audio file transfer: " << LLAssetStorage::getErrorString( result_code ) << " (" << result_code << ")" << LL_ENDL; + 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) @@ -1245,11 +1252,11 @@ void LLAudioEngine::assetCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::E if (!adp) { // Should never happen - LL_WARNS("AudioEngine") << "Got asset callback without audio data for " << uuid << LL_ENDL; + LL_WARNS() << "Got asset callback without audio data for " << uuid << LL_ENDL; } else { - LL_DEBUGS("AudioEngine") << "Got asset callback with good audio data for " << uuid << ", making decode request" << LL_ENDL; + // 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); @@ -1328,7 +1335,7 @@ void LLAudioSource::update() } else if (adp->hasCompletedDecode()) // Only mark corrupted after decode is done { - LL_WARNS("AudioEngine") << "Marking LLAudioSource corrupted for " << adp->getID() << LL_ENDL; + LL_WARNS() << "Marking LLAudioSource corrupted for " << adp->getID() << LL_ENDL; mCorrupted = true ; } } @@ -1350,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; @@ -1364,9 +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. + //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) { @@ -1381,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" << LL_ENDL; + //LL_WARNS() << "Aborting, no free channels" << LL_ENDL; return false; } @@ -1410,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); @@ -1480,7 +1504,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. - LL_DEBUGS("AudioEngine") << "No channel assigned, source is done" << LL_ENDL; + //LL_INFOS() << "No channel assigned, source is done" << LL_ENDL; return true; } else @@ -1517,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) @@ -1646,7 +1677,7 @@ LLAudioChannel::LLAudioChannel() : LLAudioChannel::~LLAudioChannel() { // Need to disconnect any sources which are using this channel. - LL_DEBUGS("AudioEngine") << "Cleaning up audio channel" << LL_ENDL; + //LL_INFOS() << "Cleaning up audio channel" << LL_ENDL; if (mCurrentSourcep) { mCurrentSourcep->setChannel(NULL); @@ -1657,10 +1688,12 @@ LLAudioChannel::~LLAudioChannel() void LLAudioChannel::setSource(LLAudioSource *sourcep) { + //LL_INFOS() << this << ": setSource(" << sourcep << ")" << LL_ENDL; + if (!sourcep) { // Clearing the source for this channel, don't need to do anything. - LL_DEBUGS("AudioEngine") << "Clearing source" << ( mCurrentSourcep ? mCurrentSourcep->getID() : LLUUID::null ) << LL_ENDL; + //LL_INFOS() << "Clearing source for channel" << LL_ENDL; cleanup(); mCurrentSourcep = NULL; mWaiting = false; @@ -1669,22 +1702,28 @@ void LLAudioChannel::setSource(LLAudioSource *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; - } - - mCurrentSourcep = sourcep; - - updateBuffer(); - update3DPosition(); + if (sourcep == mCurrentSourcep) + { + // Don't reallocate the channel, this will make FMOD goofy. + //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 @@ -1693,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) @@ -1753,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); @@ -1774,15 +1816,21 @@ bool LLAudioData::load() if (mBufferp) { // We already have this sound in a buffer, don't do anything. - LL_INFOS("AudioEngine") << "Already have a buffer for this sound, don't bother loading!" << LL_ENDL; + 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. - LL_INFOS("AudioEngine") << "Not able to allocate a new audio buffer, aborting." << LL_ENDL; + LL_INFOS() << "Not able to allocate a new audio buffer, aborting." << LL_ENDL; return true; } diff --git a/indra/llaudio/llaudioengine.h b/indra/llaudio/llaudioengine.h index da1629a1db..f1e1b4e308 100755 --- a/indra/llaudio/llaudioengine.h +++ b/indra/llaudio/llaudioengine.h @@ -88,7 +88,7 @@ public: enum LLAudioPlayState { - // isInternetStreamPlaying() returns an *int*, with + // isInternetStreamPlaying() returns an *S32*, with // 0 = stopped, 1 = playing, 2 = paused. AUDIO_STOPPED = 0, AUDIO_PLAYING = 1, @@ -160,7 +160,7 @@ public: // Internet stream methods - these will call down into the *mStreamingAudioImpl if it exists void startInternetStream(const std::string& url); void stopInternetStream(); - void pauseInternetStream(int pause); + void pauseInternetStream(S32 pause); void updateInternetStream(); // expected to be called often LLAudioPlayState isInternetStreamPlaying(); // use a value from 0.0 to 1.0, inclusive diff --git a/indra/llaudio/llaudioengine_fmodex.cpp b/indra/llaudio/llaudioengine_fmodex.cpp index 36e8044a25..7e65a05e48 100644 --- a/indra/llaudio/llaudioengine_fmodex.cpp +++ b/indra/llaudio/llaudioengine_fmodex.cpp @@ -69,7 +69,7 @@ inline bool Check_FMOD_Error(FMOD_RESULT result, const char *string) { if(result == FMOD_OK) return false; - lldebugs << string << " Error: " << FMOD_ErrorString(result) << llendl; + LL_DEBUGS() << string << " Error: " << FMOD_ErrorString(result) << LL_ENDL; return true; } @@ -77,11 +77,11 @@ void* F_STDCALL decode_alloc(unsigned int size, FMOD_MEMORY_TYPE type, const cha { if(type & FMOD_MEMORY_STREAM_DECODE) { - llinfos << "Decode buffer size: " << size << llendl; + LL_INFOS() << "Decode buffer size: " << size << LL_ENDL; } else if(type & FMOD_MEMORY_STREAM_FILE) { - llinfos << "Strean buffer size: " << size << llendl; + LL_INFOS() << "Strean buffer size: " << size << LL_ENDL; } return new char[size]; } @@ -307,7 +307,7 @@ void LLAudioEngine_FMODEX::allocateListener(void) mListenerp = (LLListener *) new LLListener_FMODEX(mSystem); if (!mListenerp) { - llwarns << "Listener creation failed" << llendl; + LL_WARNS() << "Listener creation failed" << LL_ENDL; } } @@ -316,16 +316,16 @@ void LLAudioEngine_FMODEX::shutdown() { stopInternetStream(); - llinfos << "About to LLAudioEngine::shutdown()" << llendl; + LL_INFOS() << "About to LLAudioEngine::shutdown()" << LL_ENDL; LLAudioEngine::shutdown(); - llinfos << "LLAudioEngine_FMODEX::shutdown() closing FMOD Ex" << llendl; + LL_INFOS() << "LLAudioEngine_FMODEX::shutdown() closing FMOD Ex" << LL_ENDL; if ( mSystem ) // speculative fix for MAINT-2657 { mSystem->close(); mSystem->release(); } - llinfos << "LLAudioEngine_FMODEX::shutdown() done closing FMOD Ex" << llendl; + LL_INFOS() << "LLAudioEngine_FMODEX::shutdown() done closing FMOD Ex" << LL_ENDL; delete mListenerp; mListenerp = NULL; @@ -474,7 +474,7 @@ bool LLAudioChannelFMODEX::updateBuffer() { // This is bad, there should ALWAYS be a sound associated with a legit // buffer. - llerrs << "No FMOD sound!" << llendl; + LL_ERRS() << "No FMOD sound!" << LL_ENDL; return false; } @@ -487,7 +487,7 @@ bool LLAudioChannelFMODEX::updateBuffer() Check_FMOD_Error(result, "FMOD::System::playSound"); } - //llinfos << "Setting up channel " << std::hex << mChannelID << std::dec << llendl; + //LL_INFOS() << "Setting up channel " << std::hex << mChannelID << std::dec << LL_ENDL; } // If we have a source for the channel, we need to update its gain. @@ -504,8 +504,8 @@ bool LLAudioChannelFMODEX::updateBuffer() { S32 index; mChannelp->getIndex(&index); - llwarns << "Channel " << index << "Source ID: " << mCurrentSourcep->getID() - << " at " << mCurrentSourcep->getPositionGlobal() << llendl; + LL_WARNS() << "Channel " << index << "Source ID: " << mCurrentSourcep->getID() + << " at " << mCurrentSourcep->getPositionGlobal() << LL_ENDL; }*/ } @@ -575,11 +575,11 @@ void LLAudioChannelFMODEX::cleanup() { if (!mChannelp) { - //llinfos << "Aborting cleanup with no channel handle." << llendl; + //LL_INFOS() << "Aborting cleanup with no channel handle." << LL_ENDL; return; } - //llinfos << "Cleaning up channel: " << mChannelID << llendl; + //LL_INFOS() << "Cleaning up channel: " << mChannelID << LL_ENDL; Check_FMOD_Error(mChannelp->stop(),"FMOD::Channel::stop"); mCurrentBufferp = NULL; @@ -591,7 +591,7 @@ void LLAudioChannelFMODEX::play() { if (!mChannelp) { - llwarns << "Playing without a channel handle, aborting" << llendl; + LL_WARNS() << "Playing without a channel handle, aborting" << LL_ENDL; return; } @@ -699,7 +699,7 @@ bool LLAudioBufferFMODEX::loadWAV(const std::string& filename) if (result != FMOD_OK) { // We failed to load the file for some reason. - llwarns << "Could not load data '" << filename << "': " << FMOD_ErrorString(result) << llendl; + LL_WARNS() << "Could not load data '" << filename << "': " << FMOD_ErrorString(result) << LL_ENDL; // // If we EVER want to load wav files provided by end users, we need diff --git a/indra/llaudio/llaudioengine_openal.cpp b/indra/llaudio/llaudioengine_openal.cpp index 34a057dcc0..e6ac586618 100755 --- a/indra/llaudio/llaudioengine_openal.cpp +++ b/indra/llaudio/llaudioengine_openal.cpp @@ -59,33 +59,33 @@ bool LLAudioEngine_OpenAL::init(const S32 num_channels, void* userdata) if(!alutInit(NULL, NULL)) { - llwarns << "LLAudioEngine_OpenAL::init() ALUT initialization failed: " << alutGetErrorString (alutGetError ()) << llendl; + LL_WARNS() << "LLAudioEngine_OpenAL::init() ALUT initialization failed: " << alutGetErrorString (alutGetError ()) << LL_ENDL; return false; } - llinfos << "LLAudioEngine_OpenAL::init() OpenAL successfully initialized" << llendl; + LL_INFOS() << "LLAudioEngine_OpenAL::init() OpenAL successfully initialized" << LL_ENDL; - llinfos << "OpenAL version: " - << ll_safe_string(alGetString(AL_VERSION)) << llendl; - llinfos << "OpenAL vendor: " - << ll_safe_string(alGetString(AL_VENDOR)) << llendl; - llinfos << "OpenAL renderer: " - << ll_safe_string(alGetString(AL_RENDERER)) << llendl; + LL_INFOS() << "OpenAL version: " + << ll_safe_string(alGetString(AL_VERSION)) << LL_ENDL; + LL_INFOS() << "OpenAL vendor: " + << ll_safe_string(alGetString(AL_VENDOR)) << LL_ENDL; + LL_INFOS() << "OpenAL renderer: " + << ll_safe_string(alGetString(AL_RENDERER)) << LL_ENDL; ALint major = alutGetMajorVersion (); ALint minor = alutGetMinorVersion (); - llinfos << "ALUT version: " << major << "." << minor << llendl; + LL_INFOS() << "ALUT version: " << major << "." << minor << LL_ENDL; ALCdevice *device = alcGetContextsDevice(alcGetCurrentContext()); alcGetIntegerv(device, ALC_MAJOR_VERSION, 1, &major); alcGetIntegerv(device, ALC_MAJOR_VERSION, 1, &minor); - llinfos << "ALC version: " << major << "." << minor << llendl; + LL_INFOS() << "ALC version: " << major << "." << minor << LL_ENDL; - llinfos << "ALC default device: " + LL_INFOS() << "ALC default device: " << ll_safe_string(alcGetString(device, ALC_DEFAULT_DEVICE_SPECIFIER)) - << llendl; + << LL_ENDL; return true; } @@ -125,24 +125,24 @@ void LLAudioEngine_OpenAL::allocateListener() mListenerp = (LLListener *) new LLListener_OpenAL(); if(!mListenerp) { - llwarns << "LLAudioEngine_OpenAL::allocateListener() Listener creation failed" << llendl; + LL_WARNS() << "LLAudioEngine_OpenAL::allocateListener() Listener creation failed" << LL_ENDL; } } // virtual void LLAudioEngine_OpenAL::shutdown() { - llinfos << "About to LLAudioEngine::shutdown()" << llendl; + LL_INFOS() << "About to LLAudioEngine::shutdown()" << LL_ENDL; LLAudioEngine::shutdown(); - llinfos << "About to alutExit()" << llendl; + LL_INFOS() << "About to alutExit()" << LL_ENDL; if(!alutExit()) { - llwarns << "Nuts." << llendl; - llwarns << "LLAudioEngine_OpenAL::shutdown() ALUT shutdown failed: " << alutGetErrorString (alutGetError ()) << llendl; + LL_WARNS() << "Nuts." << LL_ENDL; + LL_WARNS() << "LLAudioEngine_OpenAL::shutdown() ALUT shutdown failed: " << alutGetErrorString (alutGetError ()) << LL_ENDL; } - llinfos << "LLAudioEngine_OpenAL::shutdown() OpenAL successfully shut down" << llendl; + LL_INFOS() << "LLAudioEngine_OpenAL::shutdown() OpenAL successfully shut down" << LL_ENDL; delete mListenerp; mListenerp = NULL; @@ -160,7 +160,7 @@ LLAudioChannel *LLAudioEngine_OpenAL::createChannel() void LLAudioEngine_OpenAL::setInternalGain(F32 gain) { - //llinfos << "LLAudioEngine_OpenAL::setInternalGain() Gain: " << gain << llendl; + //LL_INFOS() << "LLAudioEngine_OpenAL::setInternalGain() Gain: " << gain << LL_ENDL; alListenerf(AL_GAIN, gain); } @@ -188,7 +188,7 @@ void LLAudioChannelOpenAL::play() { if (mALSource == AL_NONE) { - llwarns << "Playing without a mALSource, aborting" << llendl; + LL_WARNS() << "Playing without a mALSource, aborting" << LL_ENDL; return; } @@ -213,8 +213,8 @@ void LLAudioChannelOpenAL::playSynced(LLAudioChannel *channelp) alGetSourcef(masterchannelp->mALSource, AL_SEC_OFFSET, &master_offset); - llinfos << "Syncing with master at " << master_offset - << "sec" << llendl; + LL_INFOS() << "Syncing with master at " << master_offset + << "sec" << LL_ENDL; // *TODO: detect when this fails, maybe use AL_SAMPLE_ alSourcef(mALSource, AL_SEC_OFFSET, master_offset); } @@ -334,18 +334,18 @@ bool LLAudioBufferOpenAL::loadWAV(const std::string& filename) ALenum error = alutGetError(); if (gDirUtilp->fileExists(filename)) { - llwarns << + LL_WARNS() << "LLAudioBufferOpenAL::loadWAV() Error loading " << filename - << " " << alutGetErrorString(error) << llendl; + << " " << alutGetErrorString(error) << LL_ENDL; } else { // It's common for the file to not actually exist. - lldebugs << + LL_DEBUGS() << "LLAudioBufferOpenAL::loadWAV() Error loading " << filename - << " " << alutGetErrorString(error) << llendl; + << " " << alutGetErrorString(error) << LL_ENDL; } return false; } @@ -369,7 +369,7 @@ U32 LLAudioBufferOpenAL::getLength() bool LLAudioEngine_OpenAL::initWind() { ALenum error; - llinfos << "LLAudioEngine_OpenAL::initWind() start" << llendl; + LL_INFOS() << "LLAudioEngine_OpenAL::initWind() start" << LL_ENDL; mNumEmptyWindALBuffers = MAX_NUM_WIND_BUFFERS; @@ -379,7 +379,7 @@ bool LLAudioEngine_OpenAL::initWind() if((error=alGetError()) != AL_NO_ERROR) { - llwarns << "LLAudioEngine_OpenAL::initWind() Error creating wind sources: "<<error<<llendl; + LL_WARNS() << "LLAudioEngine_OpenAL::initWind() Error creating wind sources: "<<error<<LL_ENDL; } mWindGen = new LLWindGen<WIND_SAMPLE_T>; @@ -392,18 +392,18 @@ bool LLAudioEngine_OpenAL::initWind() if(mWindBuf==NULL) { - llerrs << "LLAudioEngine_OpenAL::initWind() Error creating wind memory buffer" << llendl; + LL_ERRS() << "LLAudioEngine_OpenAL::initWind() Error creating wind memory buffer" << LL_ENDL; return false; } - llinfos << "LLAudioEngine_OpenAL::initWind() done" << llendl; + LL_INFOS() << "LLAudioEngine_OpenAL::initWind() done" << LL_ENDL; return true; } void LLAudioEngine_OpenAL::cleanupWind() { - llinfos << "LLAudioEngine_OpenAL::cleanupWind()" << llendl; + LL_INFOS() << "LLAudioEngine_OpenAL::cleanupWind()" << LL_ENDL; if (mWindSource != AL_NONE) { @@ -479,7 +479,7 @@ void LLAudioEngine_OpenAL::updateWind(LLVector3 wind_vec, F32 camera_altitude) mNumEmptyWindALBuffers = llmin(mNumEmptyWindALBuffers + processed * 3 - unprocessed, MAX_NUM_WIND_BUFFERS-unprocessed); mNumEmptyWindALBuffers = llmax(mNumEmptyWindALBuffers, 0); - //llinfos << "mNumEmptyWindALBuffers: " << mNumEmptyWindALBuffers <<" (" << unprocessed << ":" << processed << ")" << llendl; + //LL_INFOS() << "mNumEmptyWindALBuffers: " << mNumEmptyWindALBuffers <<" (" << unprocessed << ":" << processed << ")" << LL_ENDL; while(processed--) // unqueue old buffers { @@ -490,7 +490,7 @@ void LLAudioEngine_OpenAL::updateWind(LLVector3 wind_vec, F32 camera_altitude) error = alGetError(); if(error != AL_NO_ERROR) { - llwarns << "LLAudioEngine_OpenAL::updateWind() error swapping (unqueuing) buffers" << llendl; + LL_WARNS() << "LLAudioEngine_OpenAL::updateWind() error swapping (unqueuing) buffers" << LL_ENDL; } else { @@ -506,7 +506,7 @@ void LLAudioEngine_OpenAL::updateWind(LLVector3 wind_vec, F32 camera_altitude) alGenBuffers(1,&buffer); if((error=alGetError()) != AL_NO_ERROR) { - llwarns << "LLAudioEngine_OpenAL::updateWind() Error creating wind buffer: " << error << llendl; + LL_WARNS() << "LLAudioEngine_OpenAL::updateWind() Error creating wind buffer: " << error << LL_ENDL; break; } @@ -519,14 +519,14 @@ void LLAudioEngine_OpenAL::updateWind(LLVector3 wind_vec, F32 camera_altitude) error = alGetError(); if(error != AL_NO_ERROR) { - llwarns << "LLAudioEngine_OpenAL::updateWind() error swapping (bufferdata) buffers" << llendl; + LL_WARNS() << "LLAudioEngine_OpenAL::updateWind() error swapping (bufferdata) buffers" << LL_ENDL; } alSourceQueueBuffers(mWindSource, 1, &buffer); error = alGetError(); if(error != AL_NO_ERROR) { - llwarns << "LLAudioEngine_OpenAL::updateWind() error swapping (queuing) buffers" << llendl; + LL_WARNS() << "LLAudioEngine_OpenAL::updateWind() error swapping (queuing) buffers" << LL_ENDL; } --mNumEmptyWindALBuffers; @@ -538,7 +538,7 @@ void LLAudioEngine_OpenAL::updateWind(LLVector3 wind_vec, F32 camera_altitude) { alSourcePlay(mWindSource); - lldebugs << "Wind had stopped - probably ran out of buffers - restarting: " << (unprocessed+mNumEmptyWindALBuffers) << " now queued." << llendl; + LL_DEBUGS() << "Wind had stopped - probably ran out of buffers - restarting: " << (unprocessed+mNumEmptyWindALBuffers) << " now queued." << LL_ENDL; } } diff --git a/indra/llaudio/lllistener_openal.cpp b/indra/llaudio/lllistener_openal.cpp index b3d4b02f09..9dd4c86854 100755 --- a/indra/llaudio/lllistener_openal.cpp +++ b/indra/llaudio/lllistener_openal.cpp @@ -41,13 +41,13 @@ LLListener_OpenAL::~LLListener_OpenAL() void LLListener_OpenAL::translate(LLVector3 offset) { - //llinfos << "LLListener_OpenAL::translate() : " << offset << llendl; + //LL_INFOS() << "LLListener_OpenAL::translate() : " << offset << LL_ENDL; LLListener::translate(offset); } void LLListener_OpenAL::setPosition(LLVector3 pos) { - //llinfos << "LLListener_OpenAL::setPosition() : " << pos << llendl; + //LL_INFOS() << "LLListener_OpenAL::setPosition() : " << pos << LL_ENDL; LLListener::setPosition(pos); } @@ -58,7 +58,7 @@ void LLListener_OpenAL::setVelocity(LLVector3 vel) void LLListener_OpenAL::orient(LLVector3 up, LLVector3 at) { - //llinfos << "LLListener_OpenAL::orient() up: " << up << " at: " << at << llendl; + //LL_INFOS() << "LLListener_OpenAL::orient() up: " << up << " at: " << at << LL_ENDL; LLListener::orient(up, at); } @@ -84,7 +84,7 @@ void LLListener_OpenAL::commitDeferredChanges() void LLListener_OpenAL::setDopplerFactor(F32 factor) { - //llinfos << "LLListener_OpenAL::setDopplerFactor() : " << factor << llendl; + //LL_INFOS() << "LLListener_OpenAL::setDopplerFactor() : " << factor << LL_ENDL; alDopplerFactor(factor); } @@ -92,7 +92,7 @@ F32 LLListener_OpenAL::getDopplerFactor() { ALfloat factor; factor = alGetFloat(AL_DOPPLER_FACTOR); - //llinfos << "LLListener_OpenAL::getDopplerFactor() : " << factor << llendl; + //LL_INFOS() << "LLListener_OpenAL::getDopplerFactor() : " << factor << LL_ENDL; return factor; } diff --git a/indra/llaudio/llstreamingaudio_fmodex.cpp b/indra/llaudio/llstreamingaudio_fmodex.cpp index 42f30aa1c4..9c9e85c00c 100644 --- a/indra/llaudio/llstreamingaudio_fmodex.cpp +++ b/indra/llaudio/llstreamingaudio_fmodex.cpp @@ -91,7 +91,7 @@ void LLStreamingAudio_FMODEX::start(const std::string& url) { //if (!mInited) //{ - // llwarns << "startInternetStream before audio initialized" << llendl; + // LL_WARNS() << "startInternetStream before audio initialized" << LL_ENDL; // return; //} @@ -100,13 +100,13 @@ void LLStreamingAudio_FMODEX::start(const std::string& url) if (!url.empty()) { - llinfos << "Starting internet stream: " << url << llendl; + LL_INFOS() << "Starting internet stream: " << url << LL_ENDL; mCurrentInternetStreamp = new LLAudioStreamManagerFMODEX(mSystem,url); mURL = url; } else { - llinfos << "Set internet stream to null" << llendl; + LL_INFOS() << "Set internet stream to null" << LL_ENDL; mURL.clear(); } } @@ -121,7 +121,7 @@ void LLStreamingAudio_FMODEX::update() LLAudioStreamManagerFMODEX *streamp = *iter; if (streamp->stopStream()) { - llinfos << "Closed dead stream" << llendl; + LL_INFOS() << "Closed dead stream" << LL_ENDL; delete streamp; mDeadStreams.erase(iter++); } @@ -181,7 +181,7 @@ void LLStreamingAudio_FMODEX::update() { if (!strcmp(tag.name, "Sample Rate Change")) { - llinfos << "Stream forced changing sample rate to " << *((float *)tag.data) << llendl; + LL_INFOS() << "Stream forced changing sample rate to " << *((float *)tag.data) << LL_ENDL; mFMODInternetStreamChannelp->setFrequency(*((float *)tag.data)); } continue; @@ -195,9 +195,9 @@ void LLStreamingAudio_FMODEX::update() mFMODInternetStreamChannelp->getPaused(&paused); if(!paused) { - llinfos << "Stream starvation detected! Pausing stream until buffer nearly full." << llendl; - llinfos << " (diskbusy="<<diskbusy<<")" << llendl; - llinfos << " (progress="<<progress<<")" << llendl; + LL_INFOS() << "Stream starvation detected! Pausing stream until buffer nearly full." << LL_ENDL; + LL_INFOS() << " (diskbusy="<<diskbusy<<")" << LL_ENDL; + LL_INFOS() << " (progress="<<progress<<")" << LL_ENDL; mFMODInternetStreamChannelp->setPaused(true); } } @@ -220,14 +220,14 @@ void LLStreamingAudio_FMODEX::stop() if (mCurrentInternetStreamp) { - llinfos << "Stopping internet stream: " << mCurrentInternetStreamp->getURL() << llendl; + LL_INFOS() << "Stopping internet stream: " << mCurrentInternetStreamp->getURL() << LL_ENDL; if (mCurrentInternetStreamp->stopStream()) { delete mCurrentInternetStreamp; } else { - llwarns << "Pushing stream to dead list: " << mCurrentInternetStreamp->getURL() << llendl; + LL_WARNS() << "Pushing stream to dead list: " << mCurrentInternetStreamp->getURL() << LL_ENDL; mDeadStreams.push_back(mCurrentInternetStreamp); } mCurrentInternetStreamp = NULL; @@ -314,9 +314,9 @@ LLAudioStreamManagerFMODEX::LLAudioStreamManagerFMODEX(FMOD::System *system, con if (result!= FMOD_OK) { - llwarns << "Couldn't open fmod stream, error " + LL_WARNS() << "Couldn't open fmod stream, error " << FMOD_ErrorString(result) - << llendl; + << LL_ENDL; mReady = false; return; } @@ -329,7 +329,7 @@ FMOD::Channel *LLAudioStreamManagerFMODEX::startStream() // We need a live and opened stream before we try and play it. if (!mInternetStream || getOpenState() != FMOD_OPENSTATE_READY) { - llwarns << "No internet stream to start playing!" << llendl; + LL_WARNS() << "No internet stream to start playing!" << LL_ENDL; return NULL; } diff --git a/indra/llaudio/llstreamingaudio_fmodex.h b/indra/llaudio/llstreamingaudio_fmodex.h index 1dee18ae7d..2787840ba1 100644 --- a/indra/llaudio/llstreamingaudio_fmodex.h +++ b/indra/llaudio/llstreamingaudio_fmodex.h @@ -49,9 +49,9 @@ class LLStreamingAudio_FMODEX : public LLStreamingAudioInterface /*virtual*/ void start(const std::string& url); /*virtual*/ void stop(); - /*virtual*/ void pause(int pause); + /*virtual*/ void pause(S32 pause); /*virtual*/ void update(); - /*virtual*/ int isPlaying(); + /*virtual*/ S32 isPlaying(); /*virtual*/ void setGain(F32 vol); /*virtual*/ F32 getGain(); /*virtual*/ std::string getURL(); diff --git a/indra/llaudio/llvorbisencode.cpp b/indra/llaudio/llvorbisencode.cpp index dfd5da12b3..2e1ed9b505 100755 --- a/indra/llaudio/llvorbisencode.cpp +++ b/indra/llaudio/llvorbisencode.cpp @@ -127,7 +127,7 @@ S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& erro return(LLVORBISENC_CHUNK_SIZE_ERR); } -// llinfos << "chunk found: '" << wav_header[0] << wav_header[1] << wav_header[2] << wav_header[3] << "'" << llendl; +// LL_INFOS() << "chunk found: '" << wav_header[0] << wav_header[1] << wav_header[2] << wav_header[3] << "'" << LL_ENDL; if (!(strncmp((char *)&(wav_header[0]),"fmt ",4))) { @@ -224,7 +224,7 @@ S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname std::string error_msg; if ((format_error = check_for_invalid_wav_formats(in_fname, error_msg))) { - llwarns << error_msg << ": " << in_fname << llendl; + LL_WARNS() << error_msg << ": " << in_fname << LL_ENDL; return(format_error); } @@ -237,8 +237,8 @@ S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname infile.open(in_fname,LL_APR_RB); if (!infile.getFileHandle()) { - llwarns << "Couldn't open temporary ogg file for writing: " << in_fname - << llendl; + LL_WARNS() << "Couldn't open temporary ogg file for writing: " << in_fname + << LL_ENDL; return(LLVORBISENC_SOURCE_OPEN_ERR); } @@ -246,8 +246,8 @@ S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname outfile.open(out_fname,LL_APR_WPB); if (!outfile.getFileHandle()) { - llwarns << "Couldn't open upload sound file for reading: " << in_fname - << llendl; + LL_WARNS() << "Couldn't open upload sound file for reading: " << in_fname + << LL_ENDL; return(LLVORBISENC_DEST_OPEN_ERR); } @@ -265,7 +265,7 @@ S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname + ((U32) wav_header[5] << 8) + wav_header[4]; -// llinfos << "chunk found: '" << wav_header[0] << wav_header[1] << wav_header[2] << wav_header[3] << "'" << llendl; +// LL_INFOS() << "chunk found: '" << wav_header[0] << wav_header[1] << wav_header[2] << wav_header[3] << "'" << LL_ENDL; if (!(strncmp((char *)&(wav_header[0]),"fmt ",4))) { @@ -308,8 +308,8 @@ S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname // vorbis_encode_ctl(&vi,OV_ECTL_RATEMANAGE_AVG,NULL) || // vorbis_encode_setup_init(&vi)) { - llwarns << "unable to initialize vorbis codec at quality " << quality << llendl; - // llwarns << "unable to initialize vorbis codec at bitrate " << bitrate << llendl; + LL_WARNS() << "unable to initialize vorbis codec at quality " << quality << LL_ENDL; + // LL_WARNS() << "unable to initialize vorbis codec at bitrate " << bitrate << LL_ENDL; return(LLVORBISENC_DEST_OPEN_ERR); } @@ -498,7 +498,7 @@ S32 encode_vorbis_file(const std::string& in_fname, const std::string& out_fname libvorbis. They're never freed or manipulated directly */ // fprintf(stderr,"Vorbis encoding: Done.\n"); - llinfos << "Vorbis encoding: Done." << llendl; + LL_INFOS() << "Vorbis encoding: Done." << LL_ENDL; #endif return(LLVORBISENC_NOERR); |