summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOz Linden <oz@lindenlab.com>2017-02-27 09:48:08 -0500
committerOz Linden <oz@lindenlab.com>2017-02-27 09:48:08 -0500
commit12e23a3cb8aadfc74f2ba469c671df51552c557b (patch)
tree957aee3a1b4174e9853e612b1311b5f6d6653100
parent1925fd2b8b9216e5d9388e6a0c077c99aa782cad (diff)
VOICE-44: correct AtOrientation delta check so that facing is
reported correctly
-rw-r--r--indra/newview/llvoicevivox.cpp45
1 files changed, 25 insertions, 20 deletions
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index 5ba0bfaff0..842ad9ca6b 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -101,7 +101,8 @@ namespace {
const F32 PROVISION_RETRY_TIMEOUT = 2.0;
// Cosine of a "trivially" small angle
- const F32 MINUSCULE_ANGLE_COS = 0.999f;
+ const F32 FOUR_DEGREES = 4.0f * (F_PI / 180.0f);
+ const F32 MINUSCULE_ANGLE_COS = (F32) cos(0.5f * FOUR_DEGREES);
const F32 SESSION_JOIN_TIMEOUT = 10.0f;
@@ -2678,12 +2679,13 @@ void LLVivoxVoiceClient::sendPositionAndVolumeUpdate(void)
<< "<Y>" << u.mV[VY] << "</Y>"
<< "<Z>" << u.mV[VZ] << "</Z>"
<< "</UpOrientation>"
- << "<LeftOrientation>"
- << "<X>" << l.mV [VX] << "</X>"
- << "<Y>" << l.mV [VY] << "</Y>"
- << "<Z>" << l.mV [VZ] << "</Z>"
- << "</LeftOrientation>";
-
+ << "<LeftOrientation>"
+ << "<X>" << l.mV [VX] << "</X>"
+ << "<Y>" << l.mV [VY] << "</Y>"
+ << "<Z>" << l.mV [VZ] << "</Z>"
+ << "</LeftOrientation>"
+ ;
+
stream << "</SpeakerPosition>";
stream << "<ListenerPosition>";
@@ -2721,7 +2723,6 @@ void LLVivoxVoiceClient::sendPositionAndVolumeUpdate(void)
pos = earPosition;
vel = earVelocity;
-// LL_DEBUGS("Voice") << "Sending listener position " << earPosition << LL_ENDL;
oldSDKTransform(l, u, a, pos, vel);
@@ -2754,12 +2755,12 @@ void LLVivoxVoiceClient::sendPositionAndVolumeUpdate(void)
<< "<Y>" << u.mV[VY] << "</Y>"
<< "<Z>" << u.mV[VZ] << "</Z>"
<< "</UpOrientation>"
- << "<LeftOrientation>"
- << "<X>" << l.mV [VX] << "</X>"
- << "<Y>" << l.mV [VY] << "</Y>"
- << "<Z>" << l.mV [VZ] << "</Z>"
- << "</LeftOrientation>";
-
+ << "<LeftOrientation>"
+ << "<X>" << l.mV [VX] << "</X>"
+ << "<Y>" << l.mV [VY] << "</Y>"
+ << "<Z>" << l.mV [VZ] << "</Z>"
+ << "</LeftOrientation>"
+ ;
stream << "</ListenerPosition>";
@@ -2833,10 +2834,11 @@ void LLVivoxVoiceClient::sendPositionAndVolumeUpdate(void)
}
//sendLocalAudioUpdates(); obsolete, used to send volume setting on position updates
-
- if(!stream.str().empty())
+ std::string update(stream.str());
+ if(!update.empty())
{
- writeString(stream.str());
+ LL_DEBUGS("VoiceUpdate") << "sending update " << update << LL_ENDL;
+ writeString(update);
}
}
@@ -4838,9 +4840,12 @@ void LLVivoxVoiceClient::setAvatarPosition(const LLVector3d &position, const LLV
mSpatialCoordsDirty = true;
}
- if ((mAvatarRot != rot) && (llabs(dot(mAvatarRot, rot)) > MINUSCULE_ANGLE_COS))
- { // if the two rotations are not exactly equal test their dot product
- // to get the cos of the angle between them. If it is minuscule don't update.
+ // If the two rotations are not exactly equal test their dot product
+ // to get the cos of the angle between them.
+ // If it is too small, don't update.
+ F32 rot_cos_diff = llabs(dot(mAvatarRot, rot));
+ if ((mAvatarRot != rot) && (rot_cos_diff < MINUSCULE_ANGLE_COS))
+ {
mAvatarRot = rot;
mSpatialCoordsDirty = true;
}