summaryrefslogtreecommitdiff
path: root/indra/newview/llaudiosourcevo.cpp
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2022-07-12 00:42:54 +0300
committerAndrey Lihatskiy <alihatskiy@productengine.com>2022-07-12 00:42:54 +0300
commit43de9f202e9c09bc46e9b4e51ac87425b99b9a55 (patch)
tree99ea03d6f0af12135b4a428ec0b7c595a7d3ee9f /indra/newview/llaudiosourcevo.cpp
parent3f98411c56f4daa06c9102346a8dd37af18d2cb6 (diff)
parent1e4f2ec07e32a142f35817d3186a124df3f8cd25 (diff)
Merge branch 'master' into DRTVWR-528
# Conflicts: # indra/newview/llappviewer.cpp
Diffstat (limited to 'indra/newview/llaudiosourcevo.cpp')
-rw-r--r--indra/newview/llaudiosourcevo.cpp36
1 files changed, 31 insertions, 5 deletions
diff --git a/indra/newview/llaudiosourcevo.cpp b/indra/newview/llaudiosourcevo.cpp
index 4b6c855bde..1846238d93 100644
--- a/indra/newview/llaudiosourcevo.cpp
+++ b/indra/newview/llaudiosourcevo.cpp
@@ -34,6 +34,7 @@
#include "llmutelist.h"
#include "llviewercontrol.h"
#include "llviewerparcelmgr.h"
+#include "llvoavatarself.h"
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),
@@ -141,11 +142,36 @@ void LLAudioSourceVO::updateMute()
LLVector3d pos_global = getPosGlobal();
F32 cutoff = mObjectp->getSoundCutOffRadius();
- if ((cutoff > 0.1f && !isInCutOffRadius(pos_global, cutoff)) // consider cutoff below 0.1m as off
- || !LLViewerParcelMgr::getInstance()->canHearSound(pos_global))
- {
- mute = true;
- }
+ // Object can specify radius at which it turns off
+ // consider cutoff below 0.1m as 'cutoff off'
+ if (cutoff > 0.1f && !isInCutOffRadius(pos_global, cutoff))
+ {
+ mute = true;
+ }
+ // check if parcel allows sounds to pass border
+ else if (!LLViewerParcelMgr::getInstance()->canHearSound(pos_global))
+ {
+ if (isAgentAvatarValid() && gAgentAvatarp->getParent())
+ {
+ // Check if agent is riding this object
+ // Agent can ride something out of region border and canHearSound
+ // will treat object as not being part of agent's parcel.
+ LLViewerObject *sound_root = (LLViewerObject*)mObjectp->getRoot();
+ LLViewerObject *agent_root = (LLViewerObject*)gAgentAvatarp->getRoot();
+ if (sound_root != agent_root)
+ {
+ mute = true;
+ }
+ else
+ {
+ LL_INFOS() << "roots identical" << LL_ENDL;
+ }
+ }
+ else
+ {
+ mute = true;
+ }
+ }
if (!mute)
{