Revert voice control to snowglobe

This commit is contained in:
Siana Gearz
2011-04-03 01:11:48 +02:00
parent 7e895d4590
commit f9e0b122ae
6 changed files with 121 additions and 175 deletions

View File

@@ -75,10 +75,6 @@
// for MD5 hash // for MD5 hash
#include "llmd5.h" #include "llmd5.h"
// <edit>
#include "llworld.h"
// </edit>
#define USE_SESSION_GROUPS 0 #define USE_SESSION_GROUPS 0
static bool sConnectingToAgni = false; static bool sConnectingToAgni = false;
@@ -1120,7 +1116,6 @@ LLVoiceClient::LLVoiceClient()
mCommandCookie = 0; mCommandCookie = 0;
mCurrentParcelLocalID = 0; mCurrentParcelLocalID = 0;
mLoginRetryCount = 0; mLoginRetryCount = 0;
mPosLocked = false;
mSpeakerVolume = 0; mSpeakerVolume = 0;
mMicVolume = 0; mMicVolume = 0;
@@ -1154,7 +1149,6 @@ LLVoiceClient::LLVoiceClient()
mTuningSpeakerVolume = 0; mTuningSpeakerVolume = 0;
mTuningSpeakerVolumeDirty = true; mTuningSpeakerVolumeDirty = true;
// gMuteListp isn't set up at this point, so we defer this until later. // gMuteListp isn't set up at this point, so we defer this until later.
// gMuteListp->addObserver(&mutelist_listener); // gMuteListp->addObserver(&mutelist_listener);
@@ -4846,20 +4840,6 @@ LLVoiceClient::participantState::participantState(const std::string &uri) :
{ {
} }
// <edit>
//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);
}
// </edit>
LLVoiceClient::participantState *LLVoiceClient::sessionState::addParticipant(const std::string &uri) LLVoiceClient::participantState *LLVoiceClient::sessionState::addParticipant(const std::string &uri)
{ {
participantState *result = NULL; participantState *result = NULL;
@@ -4904,30 +4884,6 @@ LLVoiceClient::participantState *LLVoiceClient::sessionState::addParticipant(con
if(result->updateMuteState()) if(result->updateMuteState())
mVolumeDirty = true; mVolumeDirty = true;
// <edit>
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);
}
// </edit>
} }
else else
{ {
@@ -5202,8 +5158,6 @@ void LLVoiceClient::switchChannel(
void LLVoiceClient::joinSession(sessionState *session) void LLVoiceClient::joinSession(sessionState *session)
{ {
if(!mPosLocked)
{
mNextAudioSession = session; mNextAudioSession = session;
if(getState() <= stateNoChannel) if(getState() <= stateNoChannel)
@@ -5215,7 +5169,6 @@ void LLVoiceClient::joinSession(sessionState *session)
// State machine will come around and rejoin if uri/handle is not empty. // State machine will come around and rejoin if uri/handle is not empty.
sessionTerminate(); sessionTerminate();
} }
}
} }
void LLVoiceClient::setNonSpatialChannel( void LLVoiceClient::setNonSpatialChannel(
@@ -5229,8 +5182,6 @@ void LLVoiceClient::setSpatialChannel(
const std::string &uri, const std::string &uri,
const std::string &credentials) const std::string &credentials)
{ {
if(!mPosLocked)
{
mSpatialSessionURI = uri; mSpatialSessionURI = uri;
mSpatialSessionCredentials = credentials; mSpatialSessionCredentials = credentials;
mAreaVoiceDisabled = mSpatialSessionURI.empty(); mAreaVoiceDisabled = mSpatialSessionURI.empty();
@@ -5246,7 +5197,6 @@ void LLVoiceClient::setSpatialChannel(
{ {
switchChannel(mSpatialSessionURI, true, false, false, mSpatialSessionCredentials); switchChannel(mSpatialSessionURI, true, false, false, mSpatialSessionCredentials);
} }
}
} }
void LLVoiceClient::callUser(const LLUUID &uuid) void LLVoiceClient::callUser(const LLUUID &uuid)
@@ -5477,8 +5427,6 @@ void LLVoiceClient::declineInvite(std::string &sessionHandle)
void LLVoiceClient::leaveNonSpatialChannel() void LLVoiceClient::leaveNonSpatialChannel()
{ {
if(!mPosLocked)
{
LL_DEBUGS("Voice") LL_DEBUGS("Voice")
<< "called in state " << state2string(getState()) << "called in state " << state2string(getState())
<< LL_ENDL; << LL_ENDL;
@@ -5493,7 +5441,6 @@ void LLVoiceClient::leaveNonSpatialChannel()
verifySessionState(); verifySessionState();
sessionTerminate(); sessionTerminate();
}
} }
std::string LLVoiceClient::getCurrentChannel() std::string LLVoiceClient::getCurrentChannel()
@@ -5722,7 +5669,7 @@ void LLVoiceClient::enforceTether(void)
void LLVoiceClient::updatePosition(void) void LLVoiceClient::updatePosition(void)
{ {
if(gVoiceClient && !gVoiceClient->getPosLocked()) if(gVoiceClient)
{ {
LLVOAvatar *agent = gAgent.getAvatarObject(); LLVOAvatar *agent = gAgent.getAvatarObject();
LLViewerRegion *region = gAgent.getRegion(); LLViewerRegion *region = gAgent.getRegion();
@@ -5761,8 +5708,6 @@ void LLVoiceClient::updatePosition(void)
void LLVoiceClient::setCameraPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot) void LLVoiceClient::setCameraPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot)
{ {
if(!mPosLocked)
{
mCameraRequestedPosition = position; mCameraRequestedPosition = position;
if(mCameraVelocity != velocity) if(mCameraVelocity != velocity)
@@ -5776,13 +5721,10 @@ void LLVoiceClient::setCameraPosition(const LLVector3d &position, const LLVector
mCameraRot = rot; mCameraRot = rot;
mSpatialCoordsDirty = true; mSpatialCoordsDirty = true;
} }
}
} }
void LLVoiceClient::setAvatarPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot) 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; mAvatarPosition = position;
@@ -5800,7 +5742,6 @@ void LLVoiceClient::setAvatarPosition(const LLVector3d &position, const LLVector
mAvatarRot = rot; mAvatarRot = rot;
mSpatialCoordsDirty = true; mSpatialCoordsDirty = true;
} }
}
} }
bool LLVoiceClient::channelFromRegion(LLViewerRegion *region, std::string &name) bool LLVoiceClient::channelFromRegion(LLViewerRegion *region, std::string &name)
@@ -5820,7 +5761,7 @@ bool LLVoiceClient::channelFromRegion(LLViewerRegion *region, std::string &name)
void LLVoiceClient::leaveChannel(void) void LLVoiceClient::leaveChannel(void)
{ {
if(!mPosLocked && getState() == stateRunning) if(getState() == stateRunning)
{ {
LL_DEBUGS("Voice") << "leaving channel for teleport/logout" << LL_ENDL; LL_DEBUGS("Voice") << "leaving channel for teleport/logout" << LL_ENDL;
mChannelName.clear(); mChannelName.clear();
@@ -5859,7 +5800,7 @@ void LLVoiceClient::setVoiceEnabled(bool enabled)
} }
else 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(); LLVoiceChannel::getCurrentVoiceChannel()->deactivate();
} }
} }
@@ -5867,9 +5808,7 @@ void LLVoiceClient::setVoiceEnabled(bool enabled)
bool LLVoiceClient::voiceEnabled() bool LLVoiceClient::voiceEnabled()
{ {
static const LLCachedControl<bool> enable_voice_chat("EnableVoiceChat",false); return gSavedSettings.getBOOL("EnableVoiceChat") && !gSavedSettings.getBOOL("CmdLineDisableVoice");
static const LLCachedControl<bool> cmd_line_disable_voice("CmdLineDisableVoice",false);
return enable_voice_chat && !cmd_line_disable_voice;
} }
void LLVoiceClient::setLipSyncEnabled(BOOL enabled) 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) void LLVoiceClient::setUsePTT(bool usePTT)
{ {
if(usePTT && !mUsePTT) if(usePTT && !mUsePTT)

View File

@@ -176,10 +176,6 @@ static void updatePosition(void);
bool channelFromRegion(LLViewerRegion *region, std::string &name); bool channelFromRegion(LLViewerRegion *region, std::string &name);
void leaveChannel(void); // call this on logout or teleport begin 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. void setMuteMic(bool muted); // Use this to mute the local mic (for when the client is minimized, etc), ignoring user PTT state.
void setUserPTTState(bool ptt); void setUserPTTState(bool ptt);
@@ -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 setUserVolume(const LLUUID& id, F32 volume); // set's volume for specified agent, from 0-1 (where .5 is nominal)
void setLipSyncEnabled(BOOL enabled); void setLipSyncEnabled(BOOL enabled);
BOOL lipSyncEnabled(); BOOL lipSyncEnabled();
void setPosLocked(bool locked);
BOOL getPosLocked(); //whether our position is locked to keep us nearby
// PTT key triggering // PTT key triggering
void keyDown(KEY key, MASK mask); void keyDown(KEY key, MASK mask);
@@ -299,10 +293,6 @@ static void updatePosition(void);
sessionState(); sessionState();
~sessionState(); ~sessionState();
// <edit>
static void onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group, void* user_data);
// </edit>
participantState *addParticipant(const std::string &uri); participantState *addParticipant(const std::string &uri);
// Note: after removeParticipant returns, the participant* that was passed to it will have been deleted. // 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. // Take care not to use the pointer again after that.
@@ -656,6 +646,10 @@ static void updatePosition(void);
bool mCaptureDeviceDirty; bool mCaptureDeviceDirty;
bool mRenderDeviceDirty; 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 switchChannel(std::string uri = std::string(), bool spatial = true, bool no_reconnect = false, bool is_p2p = false, std::string hash = "");
void joinSession(sessionState *session); void joinSession(sessionState *session);
@@ -739,8 +733,6 @@ static std::string nameFromsipURI(const std::string &uri);
BOOL mLipSyncEnabled; BOOL mLipSyncEnabled;
bool mPosLocked;
typedef std::set<LLVoiceClientParticipantObserver*> observer_set_t; typedef std::set<LLVoiceClientParticipantObserver*> observer_set_t;
observer_set_t mParticipantObservers; observer_set_t mParticipantObservers;

View File

@@ -77,10 +77,6 @@ BOOL LLVoiceRemoteCtrl::postBuild()
mTalkLockBtn->setClickedCallback(onBtnLock); mTalkLockBtn->setClickedCallback(onBtnLock);
mTalkLockBtn->setCallbackUserData(this); mTalkLockBtn->setCallbackUserData(this);
mPosLockBtn = getChild<LLButton>("pos_lock_btn");
mPosLockBtn->setClickedCallback(onClickPosLock);
mPosLockBtn->setCallbackUserData(this);
mSpeakersBtn = getChild<LLButton>("speakers_btn"); mSpeakersBtn = getChild<LLButton>("speakers_btn");
mSpeakersBtn->setClickedCallback(onClickSpeakers); mSpeakersBtn->setClickedCallback(onClickSpeakers);
mSpeakersBtn->setCallbackUserData(this); mSpeakersBtn->setCallbackUserData(this);
@@ -88,6 +84,13 @@ BOOL LLVoiceRemoteCtrl::postBuild()
childSetAction("show_channel", onClickPopupBtn, this); childSetAction("show_channel", onClickPopupBtn, this);
childSetAction("end_call_btn", onClickEndCall, this); childSetAction("end_call_btn", onClickEndCall, this);
LLTextBox* text = getChild<LLTextBox>("channel_label");
if (text)
{
text->setUseEllipses(TRUE);
}
childSetAction("voice_channel_bg", onClickVoiceChannel, this);
return TRUE; return TRUE;
@@ -103,7 +106,6 @@ void LLVoiceRemoteCtrl::draw()
} }
mTalkBtn->setEnabled(voice_active); mTalkBtn->setEnabled(voice_active);
mPosLockBtn->setEnabled(voice_active);
mTalkLockBtn->setEnabled(voice_active); mTalkLockBtn->setEnabled(voice_active);
// propagate ptt state to button display, // propagate ptt state to button display,
@@ -113,10 +115,8 @@ void LLVoiceRemoteCtrl::draw()
mTalkBtn->setToggleState(!gSavedSettings.getBOOL("PTTCurrentlyEnabled") || gVoiceClient->getUserPTTState()); mTalkBtn->setToggleState(!gSavedSettings.getBOOL("PTTCurrentlyEnabled") || gVoiceClient->getUserPTTState());
} }
mSpeakersBtn->setToggleState(LLFloaterActiveSpeakers::instanceVisible(LLSD())); mSpeakersBtn->setToggleState(LLFloaterActiveSpeakers::instanceVisible(LLSD()));
mPosLockBtn->setToggleState(gVoiceClient->getPosLocked());
mTalkLockBtn->setToggleState(!gSavedSettings.getBOOL("PTTCurrentlyEnabled")); mTalkLockBtn->setToggleState(!gSavedSettings.getBOOL("PTTCurrentlyEnabled"));
std::string talk_blip_image; std::string talk_blip_image;
if (gVoiceClient->getIsSpeaking(gAgent.getID())) if (gVoiceClient->getIsSpeaking(gAgent.getID()))
{ {
@@ -169,7 +169,36 @@ void LLVoiceRemoteCtrl::draw()
&& current_channel->isActive() && current_channel->isActive()
&& current_channel != LLVoiceChannelProximal::getInstance()); && 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<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"); LLButton* expand_button = getChild<LLButton>("show_channel");
if (expand_button) 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) void LLVoiceRemoteCtrl::onClickSpeakers(void *user_data)
{ {

View File

@@ -54,13 +54,11 @@ public:
static void onClickPopupBtn(void* user_data); static void onClickPopupBtn(void* user_data);
static void onClickVoiceChannel(void* user_data); static void onClickVoiceChannel(void* user_data);
static void onClickEndCall(void* user_data); static void onClickEndCall(void* user_data);
static void onClickPosLock(void* user_data);
protected: protected:
LLButton* mTalkBtn; LLButton* mTalkBtn;
LLButton* mTalkLockBtn; LLButton* mTalkLockBtn;
LLButton* mSpeakersBtn; LLButton* mSpeakersBtn;
LLButton* mPosLockBtn;
}; };
#endif // LL_LLVOICEREMOTECTRL_H #endif // LL_LLVOICEREMOTECTRL_H

View File

@@ -6,7 +6,7 @@
name="speakers_btn" name="speakers_btn"
tool_tip="Show list of residents using voice chat around you" width="38" /> tool_tip="Show list of residents using voice chat around you" width="38" />
<button bottom="-22" height="22" label="Talk" left_delta="40" name="push_to_talk" <button bottom="-22" height="22" label="Talk" left_delta="40" name="push_to_talk"
tab_stop="false" tool_tip="Hold the button to talk" width="64" /> tab_stop="false" tool_tip="Hold the button to talk" width="60" />
<button bottom="-19" height="16" image_selected="ptt_lock_on.tga" <button bottom="-19" height="16" image_selected="ptt_lock_on.tga"
image_unselected="ptt_lock_off.tga" label="" left_delta="4" name="ptt_lock" image_unselected="ptt_lock_off.tga" label="" left_delta="4" name="ptt_lock"
scale_image="false" toggle="true" scale_image="false" toggle="true"
@@ -14,6 +14,6 @@
<icon bottom="-19" height="16" image_name="icn_voice_ptt-off.tga" left_delta="42" <icon bottom="-19" height="16" image_name="icn_voice_ptt-off.tga" left_delta="42"
name="voice_volume" width="16" /> name="voice_volume" width="16" />
<button bottom="-22" control_name="ShowVoiceChannelPopup" height="22" label="" <button bottom="-22" control_name="ShowVoiceChannelPopup" height="22" label=""
left_delta="20" name="show_channel" scale_image="true" toggle="true" left_delta="16" name="show_channel" scale_image="true" toggle="true"
tool_tip="Click to show current voice channel" width="22" /> tool_tip="Click to show current voice channel" width="22" />
</panel> </panel>

View File

@@ -5,7 +5,16 @@
<panel bottom="1" filename="panel_bg_tab.xml" name="panel_bg_tab" height="47" left="0" width="130" /> <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="" <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" /> left="4" name="end_call_btn" tool_tip="Click to hang up" width="20" />
<button bottom="-20" height="20" image_selected="pos_lock_on.tga" image_unselected="pos_lock_off.tga" label="" <button bottom="-21" height="22" image_disabled="icn_rounded-text-field.tga"
left_delta="28" name="pos_lock_btn" tool_tip="Click to lock position" width="20" toggle="true" scale_image="false" /> 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" />
<panel bottom="13" filename="panel_voice_controls.xml" left="1" /> <panel bottom="13" filename="panel_voice_controls.xml" left="1" />
</panel> </panel>