diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llaudiosourcevo.cpp | 59 | ||||
-rw-r--r-- | indra/newview/llaudiosourcevo.h | 3 | ||||
-rw-r--r-- | indra/newview/llvieweraudio.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llviewermessage.cpp | 8 | ||||
-rw-r--r-- | indra/newview/llviewerobject.cpp | 7 |
5 files changed, 48 insertions, 33 deletions
diff --git a/indra/newview/llaudiosourcevo.cpp b/indra/newview/llaudiosourcevo.cpp index 40eb5ebcd1..b37aba6c15 100644 --- a/indra/newview/llaudiosourcevo.cpp +++ b/indra/newview/llaudiosourcevo.cpp @@ -35,11 +35,8 @@ LLAudioSourceVO::LLAudioSourceVO(const LLUUID &sound_id, const LLUUID& owner_id, const F32 gain, LLViewerObject *objectp) : LLAudioSource(sound_id, owner_id, gain, LLAudioEngine::AUDIO_TYPE_SFX), - mObjectp(objectp), - mActualGain(gain) + mObjectp(objectp) { - setAmbient(FALSE); - updateGain(); update(); } @@ -54,18 +51,18 @@ LLAudioSourceVO::~LLAudioSourceVO() void LLAudioSourceVO::setGain(const F32 gain) { - mActualGain = llclamp(gain, 0.f, 1.f); - updateGain(); + mGain = llclamp(gain, 0.f, 1.f); } -void LLAudioSourceVO::updateGain() +void LLAudioSourceVO::updateMute() { - if (!mObjectp) + if (!mObjectp || mObjectp->isDead()) { + mSourceMuted = true; return; } - BOOL mute = FALSE; + bool mute = false; LLVector3d pos_global; if (mObjectp->isAttachment()) @@ -84,21 +81,21 @@ void LLAudioSourceVO::updateGain() { pos_global = mObjectp->getPositionGlobal(); } - + if (!LLViewerParcelMgr::getInstance()->canHearSound(pos_global)) { - mute = TRUE; + mute = true; } if (!mute) { if (LLMuteList::getInstance()->isMuted(mObjectp->getID())) { - mute = TRUE; + mute = true; } else if (LLMuteList::getInstance()->isMuted(mOwnerID, LLMute::flagObjectSounds)) { - mute = TRUE; + mute = true; } else if (mObjectp->isAttachment()) { @@ -110,24 +107,38 @@ void LLAudioSourceVO::updateGain() if (parent && LLMuteList::getInstance()->isMuted(parent->getID())) { - mute = TRUE; + mute = true; } } } - if (!mute) + if (mute != mSourceMuted) { - mGain = mActualGain; - } - else - { - mGain = 0.f; + mSourceMuted = mute; + if (mSourceMuted) + { + // Stop the sound. + this->play(LLUUID::null); + } + else + { + // Muted sounds keep there data at all times, because + // it's the place where the audio UUID is stored. + // However, it's possible that mCurrentDatap is + // NULL when this source did only preload sounds. + if (mCurrentDatap) + { + // Restart the sound. + this->play(mCurrentDatap->getID()); + } + } } } - void LLAudioSourceVO::update() { + updateMute(); + if (!mObjectp) { return; @@ -139,7 +150,11 @@ void LLAudioSourceVO::update() return; } - updateGain(); + if (mSourceMuted) + { + return; + } + if (mObjectp->isHUDAttachment()) { mPositionGlobal = gAgentCamera.getCameraPositionGlobal(); diff --git a/indra/newview/llaudiosourcevo.h b/indra/newview/llaudiosourcevo.h index a68f58a4b2..f1d8ef4528 100644 --- a/indra/newview/llaudiosourcevo.h +++ b/indra/newview/llaudiosourcevo.h @@ -42,11 +42,10 @@ public: /*virtual*/ void setGain(const F32 gain); private: - void updateGain(); + void updateMute(); private: LLPointer<LLViewerObject> mObjectp; - F32 mActualGain; // The "real" gain, when not off due to parcel effects }; #endif // LL_LLAUDIOSOURCEVO_H diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp index 750bb224b1..b19c738ed2 100644 --- a/indra/newview/llvieweraudio.cpp +++ b/indra/newview/llvieweraudio.cpp @@ -114,10 +114,6 @@ void audio_update_volume(bool force_update) gAudiop->setDopplerFactor(gSavedSettings.getF32("AudioLevelDoppler")); gAudiop->setRolloffFactor(gSavedSettings.getF32("AudioLevelRolloff")); -#ifdef kAUDIO_ENABLE_WIND - gAudiop->enableWind(!mute_audio); -#endif - gAudiop->setMuted(mute_audio); if (force_update) diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index c35173a7d4..2f3aeec9b3 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4213,13 +4213,11 @@ void process_preload_sound(LLMessageSystem *msg, void **user_data) // Don't play sounds from a region with maturity above current agent maturity LLVector3d pos_global = objectp->getPositionGlobal(); - if( !gAgent.canAccessMaturityAtGlobal( pos_global ) ) + if (gAgent.canAccessMaturityAtGlobal(pos_global)) { - return; + // Add audioData starts a transfer internally. + sourcep->addAudioData(datap, FALSE); } - - // Add audioData starts a transfer internally. - sourcep->addAudioData(datap, FALSE); } void process_attached_sound(LLMessageSystem *msg, void **user_data) diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 741a9e6ec4..fd3e80d755 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4445,6 +4445,13 @@ void LLViewerObject::setAttachedSound(const LLUUID &audio_uuid, const LLUUID& ow mAudioSourcep = NULL; } + if (mAudioSourcep && mAudioSourcep->isMuted() && + mAudioSourcep->getCurrentData() && mAudioSourcep->getCurrentData()->getID() == audio_uuid) + { + //llinfos << "Already having this sound as muted sound, ignoring" << llendl; + return; + } + getAudioSource(owner_id); if (mAudioSourcep) |