Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Alchemy Viewer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Silent mode is enabled
All outbound communications are blocked.
Learn more
.
Show more breadcrumbs
Alchemy Viewer
Alchemy Viewer
Commits
e2e31b1b
Commit
e2e31b1b
authored
15 years ago
by
Leyla Farazha
Browse files
Options
Downloads
Patches
Plain Diff
Added min and max for media sound attenuation
reviewed by Richard
parent
8c3feea2
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
indra/newview/llviewermedia.cpp
+23
-5
23 additions, 5 deletions
indra/newview/llviewermedia.cpp
indra/newview/llviewermedia.h
+1
-0
1 addition, 0 deletions
indra/newview/llviewermedia.h
with
24 additions
and
5 deletions
indra/newview/llviewermedia.cpp
+
23
−
5
View file @
e2e31b1b
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
#include
"llviewerprecompiledheaders.h"
#include
"llviewerprecompiledheaders.h"
#include
"llagent.h"
#include
"llagent.h"
#include
"llagentcamera.h"
#include
"llviewermedia.h"
#include
"llviewermedia.h"
#include
"llviewermediafocus.h"
#include
"llviewermediafocus.h"
#include
"llmimetypes.h"
#include
"llmimetypes.h"
...
@@ -1914,15 +1915,29 @@ void LLViewerMediaImpl::updateVolume()
...
@@ -1914,15 +1915,29 @@ void LLViewerMediaImpl::updateVolume()
{
{
if
(
mMediaSource
)
if
(
mMediaSource
)
{
{
F32
attenuation_multiplier
=
1.0
;
// always scale the volume by the global media volume
F32
volume
=
mRequestedVolume
*
LLViewerMedia
::
getVolume
();
if
(
mProximityDistance
>
0
)
// attenuate if this is not parcel media
if
(
!
mIsParcelMedia
)
{
{
if
(
mProximityCamera
>
gSavedSettings
.
getF32
(
"MediaRollOffMaxDistance"
))
{
volume
=
0
;
}
else
{
// attenuated volume = volume * roll_off rate / distance^2
// adjust distance by saved setting so we can tune the distance at which attenuation begins
// the actual start distance is sqrt(MediaRollOffMaxDistance)+MediaRollOffStartAdjustment
F64
adjusted_distance
=
mProximityCamera
-
gSavedSettings
.
getF32
(
"MediaRollOffStart"
);
// the attenuation multiplier should never be more than one since that would increase volume
// the attenuation multiplier should never be more than one since that would increase volume
attenuation_multiplier
=
llmin
(
1.0
,
gSavedSettings
.
getF32
(
"MediaRollOffFactor"
)
/
mProximityDistance
);
volume
=
volume
*
llmin
(
1.0
,
gSavedSettings
.
getF32
(
"MediaRollOffRate"
)
/
adjusted_distance
*
adjusted_distance
);
}
}
}
mMediaSource
->
setVolume
(
mRequestedVolume
*
LLViewerMedia
::
getVolume
()
*
attenuation_multiplier
);
mMediaSource
->
setVolume
(
volume
);
}
}
}
}
...
@@ -3009,6 +3024,9 @@ void LLViewerMediaImpl::calculateInterest()
...
@@ -3009,6 +3024,9 @@ void LLViewerMediaImpl::calculateInterest()
LLVector3d
agent_global
=
gAgent
.
getPositionGlobal
()
;
LLVector3d
agent_global
=
gAgent
.
getPositionGlobal
()
;
LLVector3d
global_delta
=
agent_global
-
obj_global
;
LLVector3d
global_delta
=
agent_global
-
obj_global
;
mProximityDistance
=
global_delta
.
magVecSquared
();
// use distance-squared because it's cheaper and sorts the same.
mProximityDistance
=
global_delta
.
magVecSquared
();
// use distance-squared because it's cheaper and sorts the same.
LLVector3d
camera_delta
=
gAgentCamera
.
getCameraPositionGlobal
()
-
obj_global
;
mProximityCamera
=
camera_delta
.
magVec
();
}
}
if
(
mNeedsMuteCheck
)
if
(
mNeedsMuteCheck
)
...
...
This diff is collapsed.
Click to expand it.
indra/newview/llviewermedia.h
+
1
−
0
View file @
e2e31b1b
...
@@ -431,6 +431,7 @@ class LLViewerMediaImpl
...
@@ -431,6 +431,7 @@ class LLViewerMediaImpl
bool
mIsParcelMedia
;
bool
mIsParcelMedia
;
S32
mProximity
;
S32
mProximity
;
F64
mProximityDistance
;
F64
mProximityDistance
;
F64
mProximityCamera
;
LLMimeDiscoveryResponder
*
mMimeTypeProbe
;
LLMimeDiscoveryResponder
*
mMimeTypeProbe
;
bool
mMediaAutoPlay
;
bool
mMediaAutoPlay
;
std
::
string
mMediaEntryURL
;
std
::
string
mMediaEntryURL
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment