From f9e0b122ae952a0e5d20567dbb88ac4e61b9b57a Mon Sep 17 00:00:00 2001 From: Siana Gearz Date: Sun, 3 Apr 2011 01:11:48 +0200 Subject: [PATCH] Revert voice control to snowglobe --- indra/newview/llvoiceclient.cpp | 205 ++++++------------ indra/newview/llvoiceclient.h | 16 +- indra/newview/llvoiceremotectrl.cpp | 56 +++-- indra/newview/llvoiceremotectrl.h | 2 - .../xui/en-us/panel_voice_controls.xml | 4 +- .../xui/en-us/panel_voice_remote_expanded.xml | 13 +- 6 files changed, 121 insertions(+), 175 deletions(-) diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index b12f77307..eca5594a5 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -75,10 +75,6 @@ // for MD5 hash #include "llmd5.h" -// -#include "llworld.h" -// - #define USE_SESSION_GROUPS 0 static bool sConnectingToAgni = false; @@ -1120,7 +1116,6 @@ LLVoiceClient::LLVoiceClient() mCommandCookie = 0; mCurrentParcelLocalID = 0; mLoginRetryCount = 0; - mPosLocked = false; mSpeakerVolume = 0; mMicVolume = 0; @@ -1153,7 +1148,6 @@ 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); @@ -3620,7 +3614,7 @@ void LLVoiceClient::sendFriendsListUpdates() << "" << "" << mAccountHandle << "" << "" << buddy->mURI << "" - << "" << buddy->mDisplayName << "" + << "" << buddy->mDisplayName << "" << "" // Without this, SLVoice doesn't seem to parse the command. << "0" << "\n\n\n"; @@ -4846,20 +4840,6 @@ LLVoiceClient::participantState::participantState(const std::string &uri) : { } -// -//static -void LLVoiceClient::sessionState::onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group, void* user_data) -{ - LLChat chat; - std::string name(first + " " + last); - chat.mFromName = name; - chat.mURL = llformat("secondlife:///app/agent/%s/about",id.asString().c_str()); - chat.mText = name+" is possibly eavesdropping in voice."; - chat.mSourceType = CHAT_SOURCE_SYSTEM; - LLFloaterChat::addChat(chat); -} -// - LLVoiceClient::participantState *LLVoiceClient::sessionState::addParticipant(const std::string &uri) { participantState *result = NULL; @@ -4904,30 +4884,6 @@ LLVoiceClient::participantState *LLVoiceClient::sessionState::addParticipant(con if(result->updateMuteState()) mVolumeDirty = true; - // - if(nameFromsipURI(uri) != gVoiceClient->mAccountName) - { - bool found = true; - for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); - iter != LLWorld::getInstance()->getRegionList().end(); ++iter) - { - LLViewerRegion* regionp = *iter; - // let us check to see if they are actually in the sim - if(regionp) - { - if(regionp->mMapAvatarIDs.find(id) != -1) - { - found = true; - break; - } - } - } - if(!found) - // They are not in my list of people in my sims, they must be a spy. - gCacheName->getName(id, onAvatarNameLookup, NULL); - } - // - } else { @@ -5202,19 +5158,16 @@ void LLVoiceClient::switchChannel( void LLVoiceClient::joinSession(sessionState *session) { - if(!mPosLocked) + mNextAudioSession = session; + + if(getState() <= stateNoChannel) { - 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(); - } + // 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(); } } @@ -5229,23 +5182,20 @@ void LLVoiceClient::setSpatialChannel( const std::string &uri, const std::string &credentials) { - if(!mPosLocked) - { - mSpatialSessionURI = uri; - mSpatialSessionCredentials = credentials; - mAreaVoiceDisabled = mSpatialSessionURI.empty(); + 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); } } @@ -5477,23 +5427,20 @@ void LLVoiceClient::declineInvite(std::string &sessionHandle) void LLVoiceClient::leaveNonSpatialChannel() { - 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(); - } + 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() @@ -5722,7 +5669,7 @@ void LLVoiceClient::enforceTether(void) void LLVoiceClient::updatePosition(void) { - if(gVoiceClient && !gVoiceClient->getPosLocked()) + if(gVoiceClient) { LLVOAvatar *agent = gAgent.getAvatarObject(); LLViewerRegion *region = gAgent.getRegion(); @@ -5761,45 +5708,39 @@ void LLVoiceClient::updatePosition(void) void LLVoiceClient::setCameraPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot) { - if(!mPosLocked) + mCameraRequestedPosition = position; + + if(mCameraVelocity != velocity) { - mCameraRequestedPosition = position; - - if(mCameraVelocity != velocity) - { - mCameraVelocity = velocity; - mSpatialCoordsDirty = true; - } - - if(mCameraRot != rot) - { - mCameraRot = rot; - mSpatialCoordsDirty = true; - } + mCameraVelocity = velocity; + mSpatialCoordsDirty = true; + } + + if(mCameraRot != rot) + { + mCameraRot = rot; + mSpatialCoordsDirty = true; } } void LLVoiceClient::setAvatarPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot) { - if(!mPosLocked) + if(dist_vec(mAvatarPosition, position) > 0.1) { - 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; - } + mAvatarPosition = position; + mSpatialCoordsDirty = true; + } + + if(mAvatarVelocity != velocity) + { + mAvatarVelocity = velocity; + mSpatialCoordsDirty = true; + } + + if(mAvatarRot != rot) + { + mAvatarRot = rot; + mSpatialCoordsDirty = true; } } @@ -5820,7 +5761,7 @@ bool LLVoiceClient::channelFromRegion(LLViewerRegion *region, std::string &name) void LLVoiceClient::leaveChannel(void) { - if(!mPosLocked && getState() == stateRunning) + if(getState() == stateRunning) { LL_DEBUGS("Voice") << "leaving channel for teleport/logout" << LL_ENDL; mChannelName.clear(); @@ -5859,7 +5800,7 @@ void LLVoiceClient::setVoiceEnabled(bool enabled) } else { - // Turning voice off loses your current channel -- this makes sure the UI isn't out of sync when you re-enable it. + // Turning voice off looses your current channel -- this makes sure the UI isn't out of sync when you re-enable it. LLVoiceChannel::getCurrentVoiceChannel()->deactivate(); } } @@ -5867,9 +5808,7 @@ void LLVoiceClient::setVoiceEnabled(bool enabled) bool LLVoiceClient::voiceEnabled() { - static const LLCachedControl enable_voice_chat("EnableVoiceChat",false); - static const LLCachedControl cmd_line_disable_voice("CmdLineDisableVoice",false); - return enable_voice_chat && !cmd_line_disable_voice; + return gSavedSettings.getBOOL("EnableVoiceChat") && !gSavedSettings.getBOOL("CmdLineDisableVoice"); } void LLVoiceClient::setLipSyncEnabled(BOOL enabled) @@ -5890,16 +5829,6 @@ BOOL LLVoiceClient::lipSyncEnabled() } } -BOOL LLVoiceClient::getPosLocked() -{ - return mPosLocked; -} - -void LLVoiceClient::setPosLocked(bool locked) -{ - mPosLocked = locked; -} - void LLVoiceClient::setUsePTT(bool usePTT) { if(usePTT && !mUsePTT) diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h index 4f352c23c..cfc336b27 100644 --- a/indra/newview/llvoiceclient.h +++ b/indra/newview/llvoiceclient.h @@ -175,10 +175,6 @@ static void updatePosition(void); void setAvatarPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot); bool channelFromRegion(LLViewerRegion *region, std::string &name); void leaveChannel(void); // call this on logout or teleport begin - - // This should be called when the code detects we have changed parcels. - // It initiates the call to the server that gets the parcel channel. - void parcelChanged(); void setMuteMic(bool muted); // Use this to mute the local mic (for when the client is minimized, etc), ignoring user PTT state. @@ -196,8 +192,6 @@ 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); @@ -299,10 +293,6 @@ static void updatePosition(void); sessionState(); ~sessionState(); - // - static void onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group, void* user_data); - // - participantState *addParticipant(const std::string &uri); // Note: after removeParticipant returns, the participant* that was passed to it will have been deleted. // Take care not to use the pointer again after that. @@ -656,6 +646,10 @@ static void updatePosition(void); bool mCaptureDeviceDirty; bool mRenderDeviceDirty; + // This should be called when the code detects we have changed parcels. + // It initiates the call to the server that gets the parcel channel. + void parcelChanged(); + void switchChannel(std::string uri = std::string(), bool spatial = true, bool no_reconnect = false, bool is_p2p = false, std::string hash = ""); void joinSession(sessionState *session); @@ -738,8 +732,6 @@ static std::string nameFromsipURI(const std::string &uri); LLTimer mUpdateTimer; BOOL mLipSyncEnabled; - - bool mPosLocked; typedef std::set observer_set_t; observer_set_t mParticipantObservers; diff --git a/indra/newview/llvoiceremotectrl.cpp b/indra/newview/llvoiceremotectrl.cpp index 0f4b576ad..73d8c1087 100644 --- a/indra/newview/llvoiceremotectrl.cpp +++ b/indra/newview/llvoiceremotectrl.cpp @@ -76,10 +76,6 @@ BOOL LLVoiceRemoteCtrl::postBuild() mTalkLockBtn = getChild("ptt_lock"); mTalkLockBtn->setClickedCallback(onBtnLock); mTalkLockBtn->setCallbackUserData(this); - - mPosLockBtn = getChild("pos_lock_btn"); - mPosLockBtn->setClickedCallback(onClickPosLock); - mPosLockBtn->setCallbackUserData(this); mSpeakersBtn = getChild("speakers_btn"); mSpeakersBtn->setClickedCallback(onClickSpeakers); @@ -88,7 +84,14 @@ BOOL LLVoiceRemoteCtrl::postBuild() childSetAction("show_channel", onClickPopupBtn, this); childSetAction("end_call_btn", onClickEndCall, this); - + LLTextBox* text = getChild("channel_label"); + if (text) + { + text->setUseEllipses(TRUE); + } + + childSetAction("voice_channel_bg", onClickVoiceChannel, this); + return TRUE; } @@ -103,7 +106,6 @@ void LLVoiceRemoteCtrl::draw() } mTalkBtn->setEnabled(voice_active); - mPosLockBtn->setEnabled(voice_active); mTalkLockBtn->setEnabled(voice_active); // propagate ptt state to button display, @@ -113,9 +115,7 @@ void LLVoiceRemoteCtrl::draw() mTalkBtn->setToggleState(!gSavedSettings.getBOOL("PTTCurrentlyEnabled") || gVoiceClient->getUserPTTState()); } mSpeakersBtn->setToggleState(LLFloaterActiveSpeakers::instanceVisible(LLSD())); - mPosLockBtn->setToggleState(gVoiceClient->getPosLocked()); mTalkLockBtn->setToggleState(!gSavedSettings.getBOOL("PTTCurrentlyEnabled")); - std::string talk_blip_image; if (gVoiceClient->getIsSpeaking(gAgent.getID())) @@ -169,7 +169,36 @@ void LLVoiceRemoteCtrl::draw() && current_channel->isActive() && current_channel != LLVoiceChannelProximal::getInstance()); + childSetValue("channel_label", active_channel_name); + childSetToolTip("voice_channel_bg", active_channel_name); + if (current_channel) + { + LLIconCtrl* voice_channel_icon = getChild("voice_channel_icon"); + if (voice_channel_icon && voice_floater) + { + voice_channel_icon->setImage(voice_floater->getString("voice_icon")); + } + + LLButton* voice_channel_bg = getChild("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("show_channel"); if (expand_button) @@ -249,17 +278,6 @@ void LLVoiceRemoteCtrl::onClickEndCall(void* user_data) } } -//static -void LLVoiceRemoteCtrl::onClickPosLock(void* user_data) -{ - gVoiceClient->setPosLocked(!gVoiceClient->getPosLocked()); - llwarns << gVoiceClient->getPosLocked() << llendl; - - if(!gVoiceClient->getPosLocked()) - { - gVoiceClient->parcelChanged(); //force it to get a new SIP url based on our actual location - } -} void LLVoiceRemoteCtrl::onClickSpeakers(void *user_data) { diff --git a/indra/newview/llvoiceremotectrl.h b/indra/newview/llvoiceremotectrl.h index 94c1603b9..1f61459ff 100644 --- a/indra/newview/llvoiceremotectrl.h +++ b/indra/newview/llvoiceremotectrl.h @@ -54,13 +54,11 @@ 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; LLButton* mTalkLockBtn; LLButton* mSpeakersBtn; - LLButton* mPosLockBtn; }; #endif // LL_LLVOICEREMOTECTRL_H diff --git a/indra/newview/skins/default/xui/en-us/panel_voice_controls.xml b/indra/newview/skins/default/xui/en-us/panel_voice_controls.xml index 1d73a5370..abc5f6e9a 100644 --- a/indra/newview/skins/default/xui/en-us/panel_voice_controls.xml +++ b/indra/newview/skins/default/xui/en-us/panel_voice_controls.xml @@ -6,7 +6,7 @@ name="speakers_btn" tool_tip="Show list of residents using voice chat around you" width="38" />