From 5bb2b426d6a80a4d0f300969f55f2a8269403ff8 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 20 Mar 2014 09:44:51 +0100 Subject: [PATCH] Clean up formatting according to code convention for sound explorer related code in LLAudioEngine --- indra/llaudio/llaudioengine.cpp | 46 ++++++++++++---------- indra/llaudio/llaudioengine.h | 68 ++++++++++++++++----------------- 2 files changed, 59 insertions(+), 55 deletions(-) diff --git a/indra/llaudio/llaudioengine.cpp b/indra/llaudio/llaudioengine.cpp index 1c315c9cb6..c8b1074ea9 100755 --- a/indra/llaudio/llaudioengine.cpp +++ b/indra/llaudio/llaudioengine.cpp @@ -47,7 +47,7 @@ extern void request_sound(const LLUUID &sound_guid); LLAudioEngine* gAudiop = NULL; // NaCl - Sound explorer -int LLAudioSource::gSoundHistoryPruneCounter; +S32 LLAudioSource::sSoundHistoryPruneCounter; // NaCl End // @@ -827,7 +827,7 @@ void LLAudioEngine::triggerSound(const LLUUID &audio_uuid, const LLUUID& owner_i // Create a new source (since this can't be associated with an existing source. LL_DEBUGS("AudioEngine") << "Localized: " << audio_uuid << LL_ENDL; - // NaCl - Do not load silent sounds. + // NaCl - Do not load silent sounds. if (mMuted || gain gSoundHistory; // static -void LLAudioSource::logSoundPlay(LLUUID id, LLAudioSource* audio_source, LLVector3d position, S32 type, LLUUID assetid, LLUUID ownerid, LLUUID sourceid, bool is_trigger, bool is_looped) +void LLAudioSource::logSoundPlay(const LLUUID& id, LLAudioSource* audio_source, LLVector3d position, S32 type, const LLUUID& assetid, const LLUUID& ownerid, const LLUUID& sourceid, bool is_trigger, bool is_looped) { // Corrupt asset, do not bother if( gAudiop->isCorruptSound( assetid ) ) @@ -1346,9 +1346,9 @@ void LLAudioSource::logSoundPlay(LLUUID id, LLAudioSource* audio_source, LLVecto } // static -void LLAudioSource::logSoundStop(LLUUID id) +void LLAudioSource::logSoundStop(const LLUUID& id) { - if(gSoundHistory.find(id) != gSoundHistory.end()) + if (gSoundHistory.find(id) != gSoundHistory.end()) { gSoundHistory[id].mPlaying = false; gSoundHistory[id].mTimeStopped = LLTimer::getElapsedSeconds(); @@ -1360,18 +1360,18 @@ void LLAudioSource::logSoundStop(LLUUID id) // static void LLAudioSource::pruneSoundLog() { - if(++gSoundHistoryPruneCounter >= 64) + if (++sSoundHistoryPruneCounter >= 64) { - gSoundHistoryPruneCounter = 0; - while(gSoundHistory.size() > 256) + sSoundHistoryPruneCounter = 0; + while (gSoundHistory.size() > 256) { std::map::iterator iter = gSoundHistory.begin(); std::map::iterator end = gSoundHistory.end(); U64 lowest_time = (*iter).second.mTimeStopped; LLUUID lowest_id = (*iter).first; - for( ; iter != end; ++iter) + for ( ; iter != end; ++iter) { - if((*iter).second.mTimeStopped < lowest_time) + if ((*iter).second.mTimeStopped < lowest_time) { lowest_time = (*iter).second.mTimeStopped; lowest_id = (*iter).first; @@ -1391,10 +1391,12 @@ LLAudioSource::~LLAudioSource() // Stop playback of this sound mChannelp->setSource(NULL); mChannelp = NULL; - // NaCl - Sound Explorer - if(mType != LLAudioEngine::AUDIO_TYPE_UI) // && mSourceID.notNull()) - logSoundStop(mLogID); - // NaCl End + // NaCl - Sound Explorer + if (mType != LLAudioEngine::AUDIO_TYPE_UI) // && mSourceID.notNull()) + { + logSoundStop(mLogID); + } + // NaCl End } } @@ -1495,10 +1497,12 @@ bool LLAudioSource::setupChannel() 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 + // 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()) { diff --git a/indra/llaudio/llaudioengine.h b/indra/llaudio/llaudioengine.h index 963494dd56..642b8810ad 100755 --- a/indra/llaudio/llaudioengine.h +++ b/indra/llaudio/llaudioengine.h @@ -141,12 +141,12 @@ public: // Methods actually related to setting up and removing sounds // Owner ID is the owner of the object making the request - // NaCl - Sound Explorer + // NaCl - Sound Explorer void triggerSound(const LLUUID &sound_id, const LLUUID& owner_id, const F32 gain, const S32 type = LLAudioEngine::AUDIO_TYPE_NONE, const LLVector3d &pos_global = LLVector3d::zero, - const LLUUID source_object = LLUUID::null); - // NaCl End + const LLUUID source_object = LLUUID::null); + // NaCl End void triggerSound(SoundData& soundData); bool preloadSound(const LLUUID &id); @@ -283,9 +283,9 @@ class LLAudioSource public: // owner_id is the id of the agent responsible for making this sound // play, for example, the owner of the object currently playing it - // NaCl - Sound Explorer - LLAudioSource(const LLUUID &id, const LLUUID& owner_id, const F32 gain, const S32 type = LLAudioEngine::AUDIO_TYPE_NONE, const LLUUID source_id = LLUUID::null, const bool isTrigger = true); - // NaCl End + // NaCl - Sound Explorer + LLAudioSource(const LLUUID &id, const LLUUID& owner_id, const F32 gain, const S32 type = LLAudioEngine::AUDIO_TYPE_NONE, const LLUUID& source_id = LLUUID::null, const bool isTrigger = true); + // NaCl End virtual ~LLAudioSource(); virtual void update(); // Update this audio source @@ -325,9 +325,9 @@ public: virtual void setGain(const F32 gain) { mGain = llclamp(gain, 0.f, 1.f); } const LLUUID &getID() const { return mID; } - // NaCl - Sound Explorer - const LLUUID &getLogID() const { return mLogID; } - // NaCl End + // NaCl - Sound Explorer + const LLUUID &getLogID() const { return mLogID; } + // NaCl End bool isDone() const; bool isMuted() const { return mSourceMuted; } @@ -345,12 +345,12 @@ public: protected: void setChannel(LLAudioChannel *channelp); LLAudioChannel *getChannel() const { return mChannelp; } - // NaCl - Sound Explorer - static void logSoundPlay(LLUUID id, LLAudioSource* audio_source, LLVector3d position, S32 type, LLUUID assetid, LLUUID ownerid, LLUUID sourceid, bool is_trigger, bool is_looped); - static void logSoundStop(LLUUID id); - static void pruneSoundLog(); - static int gSoundHistoryPruneCounter; - // NaCl End + // NaCl - Sound Explorer + static void logSoundPlay(const LLUUID& id, LLAudioSource* audio_source, LLVector3d position, S32 type, const LLUUID& assetid, const LLUUID& ownerid, const LLUUID& sourceid, bool is_trigger, bool is_looped); + static void logSoundStop(const LLUUID& id); + static void pruneSoundLog(); + static S32 sSoundHistoryPruneCounter; + // NaCl End protected: LLUUID mID; // The ID of the source is that of the object if it's attached to an object. @@ -368,11 +368,11 @@ protected: S32 mType; LLVector3d mPositionGlobal; LLVector3 mVelocity; - // NaCl - Sound explorer - LLUUID mLogID; - LLUUID mSourceID; - bool mIsTrigger; - // NaCl end + // NaCl - Sound explorer + LLUUID mLogID; + LLUUID mSourceID; + bool mIsTrigger; + // NaCl end //LLAudioSource *mSyncMasterp; // If we're a slave, the source that we're synced to. LLAudioChannel *mChannelp; // If we're currently playing back, this is the channel that we're assigned to. @@ -517,20 +517,20 @@ extern LLAudioEngine* gAudiop; // NaCl - Sound explorer struct LLSoundHistoryItem { - LLUUID mID; - LLVector3d mPosition; - S32 mType; - bool mPlaying; - LLUUID mAssetID; - LLUUID mOwnerID; - LLUUID mSourceID; - bool mIsTrigger; - bool mIsLooped; - F64 mTimeStarted; - F64 mTimeStopped; - bool mReviewed; - bool mReviewedCollision; - LLAudioSource* mAudioSource; + LLUUID mID; + LLVector3d mPosition; + S32 mType; + bool mPlaying; + LLUUID mAssetID; + LLUUID mOwnerID; + LLUUID mSourceID; + bool mIsTrigger; + bool mIsLooped; + F64 mTimeStarted; + F64 mTimeStopped; + bool mReviewed; + bool mReviewedCollision; + LLAudioSource* mAudioSource; LLSoundHistoryItem() : mType(0)