beginnings of a voice position lock
This commit is contained in:
@@ -1116,6 +1116,7 @@ LLVoiceClient::LLVoiceClient()
|
||||
mCommandCookie = 0;
|
||||
mCurrentParcelLocalID = 0;
|
||||
mLoginRetryCount = 0;
|
||||
mPosLocked = false;
|
||||
|
||||
mSpeakerVolume = 0;
|
||||
mMicVolume = 0;
|
||||
@@ -1148,6 +1149,7 @@ LLVoiceClient::LLVoiceClient()
|
||||
mTuningMicVolumeDirty = true;
|
||||
mTuningSpeakerVolume = 0;
|
||||
mTuningSpeakerVolumeDirty = true;
|
||||
|
||||
|
||||
// gMuteListp isn't set up at this point, so we defer this until later.
|
||||
// gMuteListp->addObserver(&mutelist_listener);
|
||||
@@ -5158,16 +5160,19 @@ void LLVoiceClient::switchChannel(
|
||||
|
||||
void LLVoiceClient::joinSession(sessionState *session)
|
||||
{
|
||||
mNextAudioSession = session;
|
||||
|
||||
if(getState() <= stateNoChannel)
|
||||
if(!mPosLocked)
|
||||
{
|
||||
// We're already set up to join a channel, just needed to fill in the session handle
|
||||
}
|
||||
else
|
||||
{
|
||||
// State machine will come around and rejoin if uri/handle is not empty.
|
||||
sessionTerminate();
|
||||
mNextAudioSession = session;
|
||||
|
||||
if(getState() <= stateNoChannel)
|
||||
{
|
||||
// We're already set up to join a channel, just needed to fill in the session handle
|
||||
}
|
||||
else
|
||||
{
|
||||
// State machine will come around and rejoin if uri/handle is not empty.
|
||||
sessionTerminate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5182,20 +5187,23 @@ void LLVoiceClient::setSpatialChannel(
|
||||
const std::string &uri,
|
||||
const std::string &credentials)
|
||||
{
|
||||
mSpatialSessionURI = uri;
|
||||
mSpatialSessionCredentials = credentials;
|
||||
mAreaVoiceDisabled = mSpatialSessionURI.empty();
|
||||
if(!mPosLocked)
|
||||
{
|
||||
mSpatialSessionURI = uri;
|
||||
mSpatialSessionCredentials = credentials;
|
||||
mAreaVoiceDisabled = mSpatialSessionURI.empty();
|
||||
|
||||
LL_DEBUGS("Voice") << "got spatial channel uri: \"" << uri << "\"" << LL_ENDL;
|
||||
|
||||
if((mAudioSession && !(mAudioSession->mIsSpatial)) || (mNextAudioSession && !(mNextAudioSession->mIsSpatial)))
|
||||
{
|
||||
// User is in a non-spatial chat or joining a non-spatial chat. Don't switch channels.
|
||||
LL_INFOS("Voice") << "in non-spatial chat, not switching channels" << LL_ENDL;
|
||||
}
|
||||
else
|
||||
{
|
||||
switchChannel(mSpatialSessionURI, true, false, false, mSpatialSessionCredentials);
|
||||
LL_DEBUGS("Voice") << "got spatial channel uri: \"" << uri << "\"" << LL_ENDL;
|
||||
|
||||
if((mAudioSession && !(mAudioSession->mIsSpatial)) || (mNextAudioSession && !(mNextAudioSession->mIsSpatial)))
|
||||
{
|
||||
// User is in a non-spatial chat or joining a non-spatial chat. Don't switch channels.
|
||||
LL_INFOS("Voice") << "in non-spatial chat, not switching channels" << LL_ENDL;
|
||||
}
|
||||
else
|
||||
{
|
||||
switchChannel(mSpatialSessionURI, true, false, false, mSpatialSessionCredentials);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5427,20 +5435,23 @@ void LLVoiceClient::declineInvite(std::string &sessionHandle)
|
||||
|
||||
void LLVoiceClient::leaveNonSpatialChannel()
|
||||
{
|
||||
LL_DEBUGS("Voice")
|
||||
<< "called in state " << state2string(getState())
|
||||
<< LL_ENDL;
|
||||
|
||||
// Make sure we don't rejoin the current session.
|
||||
sessionState *oldNextSession = mNextAudioSession;
|
||||
mNextAudioSession = NULL;
|
||||
|
||||
// Most likely this will still be the current session at this point, but check it anyway.
|
||||
reapSession(oldNextSession);
|
||||
|
||||
verifySessionState();
|
||||
|
||||
sessionTerminate();
|
||||
if(!mPosLocked)
|
||||
{
|
||||
LL_DEBUGS("Voice")
|
||||
<< "called in state " << state2string(getState())
|
||||
<< LL_ENDL;
|
||||
|
||||
// Make sure we don't rejoin the current session.
|
||||
sessionState *oldNextSession = mNextAudioSession;
|
||||
mNextAudioSession = NULL;
|
||||
|
||||
// Most likely this will still be the current session at this point, but check it anyway.
|
||||
reapSession(oldNextSession);
|
||||
|
||||
verifySessionState();
|
||||
|
||||
sessionTerminate();
|
||||
}
|
||||
}
|
||||
|
||||
std::string LLVoiceClient::getCurrentChannel()
|
||||
@@ -5669,7 +5680,7 @@ void LLVoiceClient::enforceTether(void)
|
||||
void LLVoiceClient::updatePosition(void)
|
||||
{
|
||||
|
||||
if(gVoiceClient)
|
||||
if(gVoiceClient && !gVoiceClient->getPosLocked())
|
||||
{
|
||||
LLVOAvatar *agent = gAgent.getAvatarObject();
|
||||
LLViewerRegion *region = gAgent.getRegion();
|
||||
@@ -5708,39 +5719,45 @@ void LLVoiceClient::updatePosition(void)
|
||||
|
||||
void LLVoiceClient::setCameraPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot)
|
||||
{
|
||||
mCameraRequestedPosition = position;
|
||||
|
||||
if(mCameraVelocity != velocity)
|
||||
if(!mPosLocked)
|
||||
{
|
||||
mCameraVelocity = velocity;
|
||||
mSpatialCoordsDirty = true;
|
||||
}
|
||||
|
||||
if(mCameraRot != rot)
|
||||
{
|
||||
mCameraRot = rot;
|
||||
mSpatialCoordsDirty = true;
|
||||
mCameraRequestedPosition = position;
|
||||
|
||||
if(mCameraVelocity != velocity)
|
||||
{
|
||||
mCameraVelocity = velocity;
|
||||
mSpatialCoordsDirty = true;
|
||||
}
|
||||
|
||||
if(mCameraRot != rot)
|
||||
{
|
||||
mCameraRot = rot;
|
||||
mSpatialCoordsDirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLVoiceClient::setAvatarPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot)
|
||||
{
|
||||
if(dist_vec(mAvatarPosition, position) > 0.1)
|
||||
if(!mPosLocked)
|
||||
{
|
||||
mAvatarPosition = position;
|
||||
mSpatialCoordsDirty = true;
|
||||
}
|
||||
|
||||
if(mAvatarVelocity != velocity)
|
||||
{
|
||||
mAvatarVelocity = velocity;
|
||||
mSpatialCoordsDirty = true;
|
||||
}
|
||||
|
||||
if(mAvatarRot != rot)
|
||||
{
|
||||
mAvatarRot = rot;
|
||||
mSpatialCoordsDirty = true;
|
||||
if(dist_vec(mAvatarPosition, position) > 0.1)
|
||||
{
|
||||
mAvatarPosition = position;
|
||||
mSpatialCoordsDirty = true;
|
||||
}
|
||||
|
||||
if(mAvatarVelocity != velocity)
|
||||
{
|
||||
mAvatarVelocity = velocity;
|
||||
mSpatialCoordsDirty = true;
|
||||
}
|
||||
|
||||
if(mAvatarRot != rot)
|
||||
{
|
||||
mAvatarRot = rot;
|
||||
mSpatialCoordsDirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5761,7 +5778,7 @@ bool LLVoiceClient::channelFromRegion(LLViewerRegion *region, std::string &name)
|
||||
|
||||
void LLVoiceClient::leaveChannel(void)
|
||||
{
|
||||
if(getState() == stateRunning)
|
||||
if(!mPosLocked && getState() == stateRunning)
|
||||
{
|
||||
LL_DEBUGS("Voice") << "leaving channel for teleport/logout" << LL_ENDL;
|
||||
mChannelName.clear();
|
||||
@@ -5800,7 +5817,7 @@ void LLVoiceClient::setVoiceEnabled(bool enabled)
|
||||
}
|
||||
else
|
||||
{
|
||||
// Turning voice off looses your current channel -- this makes sure the UI isn't out of sync when you re-enable it.
|
||||
// Turning voice off loses your current channel -- this makes sure the UI isn't out of sync when you re-enable it.
|
||||
LLVoiceChannel::getCurrentVoiceChannel()->deactivate();
|
||||
}
|
||||
}
|
||||
@@ -5829,6 +5846,16 @@ BOOL LLVoiceClient::lipSyncEnabled()
|
||||
}
|
||||
}
|
||||
|
||||
BOOL LLVoiceClient::getPosLocked()
|
||||
{
|
||||
return mPosLocked;
|
||||
}
|
||||
|
||||
void LLVoiceClient::setPosLocked(bool locked)
|
||||
{
|
||||
mPosLocked = locked;
|
||||
}
|
||||
|
||||
void LLVoiceClient::setUsePTT(bool usePTT)
|
||||
{
|
||||
if(usePTT && !mUsePTT)
|
||||
|
||||
@@ -192,6 +192,8 @@ static void updatePosition(void);
|
||||
void setUserVolume(const LLUUID& id, F32 volume); // set's volume for specified agent, from 0-1 (where .5 is nominal)
|
||||
void setLipSyncEnabled(BOOL enabled);
|
||||
BOOL lipSyncEnabled();
|
||||
void setPosLocked(bool locked);
|
||||
BOOL getPosLocked(); //whether our position is locked to keep us nearby
|
||||
|
||||
// PTT key triggering
|
||||
void keyDown(KEY key, MASK mask);
|
||||
@@ -732,6 +734,8 @@ static std::string nameFromsipURI(const std::string &uri);
|
||||
LLTimer mUpdateTimer;
|
||||
|
||||
BOOL mLipSyncEnabled;
|
||||
|
||||
bool mPosLocked;
|
||||
|
||||
typedef std::set<LLVoiceClientParticipantObserver*> observer_set_t;
|
||||
observer_set_t mParticipantObservers;
|
||||
|
||||
@@ -83,15 +83,9 @@ BOOL LLVoiceRemoteCtrl::postBuild()
|
||||
|
||||
childSetAction("show_channel", onClickPopupBtn, this);
|
||||
childSetAction("end_call_btn", onClickEndCall, this);
|
||||
childSetAction("pos_lock_btn", onClickPosLock, this);
|
||||
|
||||
LLTextBox* text = getChild<LLTextBox>("channel_label");
|
||||
if (text)
|
||||
{
|
||||
text->setUseEllipses(TRUE);
|
||||
}
|
||||
|
||||
childSetAction("voice_channel_bg", onClickVoiceChannel, this);
|
||||
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -168,37 +162,12 @@ void LLVoiceRemoteCtrl::draw()
|
||||
&& current_channel
|
||||
&& current_channel->isActive()
|
||||
&& current_channel != LLVoiceChannelProximal::getInstance());
|
||||
|
||||
childSetEnabled("pos_lock_btn", LLVoiceClient::voiceEnabled()
|
||||
&& current_channel
|
||||
&& current_channel->isActive());
|
||||
|
||||
childSetValue("channel_label", active_channel_name);
|
||||
childSetToolTip("voice_channel_bg", active_channel_name);
|
||||
|
||||
if (current_channel)
|
||||
{
|
||||
LLIconCtrl* voice_channel_icon = getChild<LLIconCtrl>("voice_channel_icon");
|
||||
if (voice_channel_icon && voice_floater)
|
||||
{
|
||||
voice_channel_icon->setImage(voice_floater->getString("voice_icon"));
|
||||
}
|
||||
|
||||
LLButton* voice_channel_bg = getChild<LLButton>("voice_channel_bg");
|
||||
if (voice_channel_bg)
|
||||
{
|
||||
LLColor4 bg_color;
|
||||
if (current_channel->isActive())
|
||||
{
|
||||
bg_color = lerp(LLColor4::green, LLColor4::white, 0.7f);
|
||||
}
|
||||
else if (current_channel->getState() == LLVoiceChannel::STATE_ERROR)
|
||||
{
|
||||
bg_color = lerp(LLColor4::red, LLColor4::white, 0.7f);
|
||||
}
|
||||
else // active, but not connected
|
||||
{
|
||||
bg_color = lerp(LLColor4::yellow, LLColor4::white, 0.7f);
|
||||
}
|
||||
voice_channel_bg->setImageColor(bg_color);
|
||||
}
|
||||
}
|
||||
|
||||
LLButton* expand_button = getChild<LLButton>("show_channel");
|
||||
if (expand_button)
|
||||
@@ -278,6 +247,12 @@ void LLVoiceRemoteCtrl::onClickEndCall(void* user_data)
|
||||
}
|
||||
}
|
||||
|
||||
//static
|
||||
void LLVoiceRemoteCtrl::onClickPosLock(void* user_data)
|
||||
{
|
||||
gVoiceClient->setPosLocked(!gVoiceClient->getPosLocked());
|
||||
llwarns << gVoiceClient->getPosLocked() << llendl;
|
||||
}
|
||||
|
||||
void LLVoiceRemoteCtrl::onClickSpeakers(void *user_data)
|
||||
{
|
||||
|
||||
@@ -54,6 +54,7 @@ public:
|
||||
static void onClickPopupBtn(void* user_data);
|
||||
static void onClickVoiceChannel(void* user_data);
|
||||
static void onClickEndCall(void* user_data);
|
||||
static void onClickPosLock(void* user_data);
|
||||
|
||||
protected:
|
||||
LLButton* mTalkBtn;
|
||||
|
||||
@@ -5,16 +5,7 @@
|
||||
<panel bottom="1" filename="panel_bg_tab.xml" name="panel_bg_tab" height="47" left="0" width="130" />
|
||||
<button bottom="-20" height="20" image_overlay="icn_voice-call-end.tga" label=""
|
||||
left="4" name="end_call_btn" tool_tip="Click to hang up" width="20" />
|
||||
<button bottom="-21" height="22" image_disabled="icn_rounded-text-field.tga"
|
||||
image_disabled_selected="icn_rounded-text-field.tga"
|
||||
image_hover_selected="icn_rounded-text-field.tga"
|
||||
image_hover_unselected="icn_rounded-text-field.tga"
|
||||
image_selected="icn_rounded-text-field.tga"
|
||||
image_unselected="icn_rounded-text-field.tga" label="" left_delta="23"
|
||||
name="voice_channel_bg" scale_image="true" width="102" />
|
||||
<icon bottom="-18" height="16" image_name="icn_voice-localchat.tga" label=""
|
||||
left_delta="4" mouse_opaque="false" name="voice_channel_icon" width="16" />
|
||||
<text bottom="-19" font="SansSerifSmall" height="16" label="" left_delta="18"
|
||||
mouse_opaque="false" name="channel_label" text_color="0 0 0" width="65" />
|
||||
<button bottom="-20" height="20" image_selected="ptt_lock_on.tga" image_unselected="ptt_lock_off.tga" label=""
|
||||
left_delta="28" name="pos_lock_btn" tool_tip="Click to lock position" width="20" />
|
||||
<panel bottom="13" filename="panel_voice_controls.xml" left="1" />
|
||||
</panel>
|
||||
|
||||
Reference in New Issue
Block a user