Clean up formatting according to code convention for sound explorer related code in LLAudioEngine

Ansariel 2014-03-20 09:44:51 +01:00
parent 4c6aa0198c
commit 5bb2b426d6
2 changed files with 59 additions and 55 deletions

View File

@ -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 <FLT_EPSILON*2)
{
return;
@ -1284,7 +1284,7 @@ void LLAudioEngine::assetCallback(LLVFS *vfs, const LLUUID &uuid, LLAssetType::E
//
LLAudioSource::LLAudioSource(const LLUUID& id, const LLUUID& owner_id, const F32 gain, const S32 type, const LLUUID source_id, const bool isTrigger)
LLAudioSource::LLAudioSource(const LLUUID& id, const LLUUID& owner_id, const F32 gain, const S32 type, const LLUUID& source_id, const bool isTrigger)
: mID(id),
mOwnerID(owner_id),
mPriority(0.f),
@ -1302,16 +1302,16 @@ LLAudioSource::LLAudioSource(const LLUUID& id, const LLUUID& owner_id, const F32
mCurrentDatap(NULL),
mQueuedDatap(NULL),
// NaCl - Sound explorer
mSourceID(source_id),
mSourceID(source_id),
mIsTrigger(isTrigger)
{
mLogID.generate();
mLogID.generate();
}
std::map<LLUUID, LLSoundHistoryItem> 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)
{
// <FS:ND> 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<LLUUID, LLSoundHistoryItem>::iterator iter = gSoundHistory.begin();
std::map<LLUUID, LLSoundHistoryItem>::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())
{

View File

@ -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)