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
#include "llmd5.h"
// <edit>
#include "llworld.h"
// </edit>
#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()
<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.BuddySet.1\">"
<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
<< "<BuddyURI>" << buddy->mURI << "</BuddyURI>"
<< "<DisplayName>" << buddy->mDisplayName << "</DisplayName>"
<< "<DisplayName>" << buddy->mDisplayName << "</DisplayName>"
<< "<BuddyData></BuddyData>" // Without this, SLVoice doesn't seem to parse the command.
<< "<GroupID>0</GroupID>"
<< "</Request>\n\n\n";
@@ -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)
{
participantState *result = NULL;
@@ -4904,30 +4884,6 @@ LLVoiceClient::participantState *LLVoiceClient::sessionState::addParticipant(con
if(result->updateMuteState())
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
{
@@ -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<bool> enable_voice_chat("EnableVoiceChat",false);
static const LLCachedControl<bool> 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)

View File

@@ -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();
// <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);
// 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<LLVoiceClientParticipantObserver*> observer_set_t;
observer_set_t mParticipantObservers;

View File

@@ -76,10 +76,6 @@ BOOL LLVoiceRemoteCtrl::postBuild()
mTalkLockBtn = getChild<LLButton>("ptt_lock");
mTalkLockBtn->setClickedCallback(onBtnLock);
mTalkLockBtn->setCallbackUserData(this);
mPosLockBtn = getChild<LLButton>("pos_lock_btn");
mPosLockBtn->setClickedCallback(onClickPosLock);
mPosLockBtn->setCallbackUserData(this);
mSpeakersBtn = getChild<LLButton>("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<LLTextBox>("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<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)
@@ -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)
{

View File

@@ -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

View File

@@ -6,7 +6,7 @@
name="speakers_btn"
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"
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"
image_unselected="ptt_lock_off.tga" label="" left_delta="4" name="ptt_lock"
scale_image="false" toggle="true"
@@ -14,6 +14,6 @@
<icon bottom="-19" height="16" image_name="icn_voice_ptt-off.tga" left_delta="42"
name="voice_volume" width="16" />
<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" />
</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" />
<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="-20" height="20" image_selected="pos_lock_on.tga" image_unselected="pos_lock_off.tga" label=""
left_delta="28" name="pos_lock_btn" tool_tip="Click to lock position" width="20" toggle="true" scale_image="false" />
<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" />
<panel bottom="13" filename="panel_voice_controls.xml" left="1" />
</panel>