summaryrefslogtreecommitdiff
path: root/indra/newview/llaudiosourcevo.cpp
diff options
context:
space:
mode:
authorChristian Goetze (CG) <cg@lindenlab.com>2010-09-23 12:56:31 -0700
committerChristian Goetze (CG) <cg@lindenlab.com>2010-09-23 12:56:31 -0700
commit92195c479f597538a55dfa8b2e02c1b4908a2259 (patch)
tree2af86834aa11e66f7e74057f4172d29dfd0703e7 /indra/newview/llaudiosourcevo.cpp
parent78e52f40424cb8336ab5d06c9ea37e16cb2b40a7 (diff)
parent18bd7dfae789ce0d6be3de3811d6d779fc4ec63e (diff)
Merged support for platform specific permanent quick links to the installer
Diffstat (limited to 'indra/newview/llaudiosourcevo.cpp')
-rw-r--r--indra/newview/llaudiosourcevo.cpp59
1 files changed, 37 insertions, 22 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();