[Voice Update] Remove gVoiceClient occurrences in favor of using LLVoiceClient as a Singleton everywhere.

This commit is contained in:
Lirusaito
2013-06-02 01:34:03 -04:00
parent b6096720b1
commit 07e1b5c3b9
16 changed files with 145 additions and 154 deletions

View File

@@ -14096,6 +14096,17 @@ This should be as low as possible, but too low may break functionality</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>ShowVoiceVisualizersInCalls</key>
<map>
<key>Comment</key>
<string>Enables in-world voice visualizers, voice gestures and lip-sync while in group or P2P calls.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>ShowVolumeSettingsPopup</key>
<map>
<key>Comment</key>

View File

@@ -3909,7 +3909,7 @@ bool LLAgent::teleportCore(bool is_local)
// MBW -- Let the voice client know a teleport has begun so it can leave the existing channel.
// This was breaking the case of teleporting within a single sim. Backing it out for now.
// gVoiceClient->leaveChannel();
// LLVoiceClient::getInstance()->leaveChannel();
return true;
}

View File

@@ -4270,8 +4270,10 @@ void LLAppViewer::sendLogoutRequest()
gLogoutMaxTime = LOGOUT_REQUEST_TIME;
mLogoutRequestSent = TRUE;
if(gVoiceClient)
gVoiceClient->leaveChannel();
if(LLVoiceClient::instanceExists())
{
LLVoiceClient::getInstance()->leaveChannel();
}
//Set internal status variables and marker files
gLogoutInProgress = TRUE;

View File

@@ -94,7 +94,7 @@ LLSpeaker::LLSpeaker(const LLUUID& id, const std::string& name, const ESpeakerTy
mDisplayName = name;
mLegacyName = name;
}
gVoiceClient->setUserVolume(id, LLMuteList::getInstance()->getSavedResidentVolume(id));
LLVoiceClient::getInstance()->setUserVolume(id, LLMuteList::getInstance()->getSavedResidentVolume(id));
mActivityTimer.reset(SPEAKER_TIMEOUT);
}
@@ -189,7 +189,7 @@ LLFloaterActiveSpeakers::LLFloaterActiveSpeakers(const LLSD& seed) : mPanel(NULL
BOOL no_open = FALSE;
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_active_speakers.xml", &getFactoryMap(), no_open);
//RN: for now, we poll voice client every frame to get voice amplitude feedback
//gVoiceClient->addObserver(this);
//LLVoiceClient::getInstance()->addObserver(this);
mPanel->refreshSpeakers();
}
@@ -599,7 +599,7 @@ void LLPanelActiveSpeakers::refreshSpeakers()
{
mMuteVoiceCtrl->setValue(LLMuteList::getInstance()->isMuted(selected_id, LLMute::flagVoiceChat));
mMuteVoiceCtrl->setEnabled(LLVoiceClient::voiceEnabled()
&& gVoiceClient->getVoiceEnabled(selected_id)
&& LLVoiceClient::getInstance()->getVoiceEnabled(selected_id)
&& selected_id.notNull()
&& selected_id != gAgent.getID()
&& (selected_speakerp.notNull() && (selected_speakerp->mType == LLSpeaker::SPEAKER_AGENT || selected_speakerp->mType == LLSpeaker::SPEAKER_EXTERNAL)));
@@ -617,9 +617,9 @@ void LLPanelActiveSpeakers::refreshSpeakers()
&& !selected_speakerp->mLegacyName.empty()
&& !LLMuteList::getInstance()->isLinden(selected_speakerp->mLegacyName));
}
mVolumeSlider->setValue(gVoiceClient->getUserVolume(selected_id));
mVolumeSlider->setValue(LLVoiceClient::getInstance()->getUserVolume(selected_id));
mVolumeSlider->setEnabled(LLVoiceClient::voiceEnabled()
&& gVoiceClient->getVoiceEnabled(selected_id)
&& LLVoiceClient::getInstance()->getVoiceEnabled(selected_id)
&& selected_id.notNull()
&& selected_id != gAgent.getID()
&& (selected_speakerp.notNull() && (selected_speakerp->mType == LLSpeaker::SPEAKER_AGENT || selected_speakerp->mType == LLSpeaker::SPEAKER_EXTERNAL)));
@@ -628,7 +628,7 @@ void LLPanelActiveSpeakers::refreshSpeakers()
view->setEnabled(selected_id.notNull());
if (LLView* view = findChild<LLView>("moderator_allow_voice"))
view->setEnabled(selected_id.notNull() && mSpeakerMgr->isVoiceActive() && gVoiceClient->getVoiceEnabled(selected_id));
view->setEnabled(selected_id.notNull() && mSpeakerMgr->isVoiceActive() && LLVoiceClient::getInstance()->getVoiceEnabled(selected_id));
if (LLView* view = findChild<LLView>("moderator_allow_text"))
view->setEnabled(selected_id.notNull());
@@ -751,7 +751,7 @@ void LLPanelActiveSpeakers::onVolumeChange(LLUICtrl* source, void* user_data)
LLUUID speaker_id = panelp->mSpeakerList->getValue().asUUID();
F32 new_volume = (F32)panelp->childGetValue("speaker_volume").asReal();
gVoiceClient->setUserVolume(speaker_id, new_volume);
LLVoiceClient::getInstance()->setUserVolume(speaker_id, new_volume);
// store this volume setting for future sessions
LLMuteList::getInstance()->setSavedResidentVolume(speaker_id, new_volume);
@@ -1012,7 +1012,7 @@ LLPointer<LLSpeaker> LLSpeakerMgr::setSpeaker(const LLUUID& id, const std::strin
void LLSpeakerMgr::update(BOOL resort_ok)
{
if (!gVoiceClient)
if (!LLVoiceClient::instanceExists())
{
return;
}
@@ -1026,7 +1026,7 @@ void LLSpeakerMgr::update(BOOL resort_ok)
}
// update status of all current speakers
BOOL voice_channel_active = (!mVoiceChannel && gVoiceClient->inProximalChannel()) || (mVoiceChannel && mVoiceChannel->isActive());
BOOL voice_channel_active = (!mVoiceChannel && LLVoiceClient::getInstance()->inProximalChannel()) || (mVoiceChannel && mVoiceChannel->isActive());
for (speaker_map_t::iterator speaker_it = mSpeakers.begin(); speaker_it != mSpeakers.end();)
{
LLUUID speaker_id = speaker_it->first;
@@ -1034,21 +1034,21 @@ void LLSpeakerMgr::update(BOOL resort_ok)
speaker_it++;
if (voice_channel_active && gVoiceClient->getVoiceEnabled(speaker_id))
if (voice_channel_active && LLVoiceClient::getInstance()->getVoiceEnabled(speaker_id))
{
speakerp->mSpeechVolume = gVoiceClient->getCurrentPower(speaker_id);
BOOL moderator_muted_voice = gVoiceClient->getIsModeratorMuted(speaker_id);
speakerp->mSpeechVolume = LLVoiceClient::getInstance()->getCurrentPower(speaker_id);
BOOL moderator_muted_voice = LLVoiceClient::getInstance()->getIsModeratorMuted(speaker_id);
if (moderator_muted_voice != speakerp->mModeratorMutedVoice)
{
speakerp->mModeratorMutedVoice = moderator_muted_voice;
speakerp->fireEvent(new LLSpeakerVoiceModerationEvent(speakerp));
}
if (gVoiceClient->getOnMuteList(speaker_id) || speakerp->mModeratorMutedVoice)
if (LLVoiceClient::getInstance()->getOnMuteList(speaker_id) || speakerp->mModeratorMutedVoice)
{
speakerp->mStatus = LLSpeaker::STATUS_MUTED;
}
else if (gVoiceClient->getIsSpeaking(speaker_id))
else if (LLVoiceClient::getInstance()->getIsSpeaking(speaker_id))
{
// reset inactivity expiration
if (speakerp->mStatus != LLSpeaker::STATUS_SPEAKING)
@@ -1143,9 +1143,9 @@ void LLSpeakerMgr::update(BOOL resort_ok)
void LLSpeakerMgr::updateSpeakerList()
{
// are we bound to the currently active voice channel?
if ((!mVoiceChannel && gVoiceClient->inProximalChannel()) || (mVoiceChannel && mVoiceChannel->isActive()))
if ((!mVoiceChannel && LLVoiceClient::getInstance()->inProximalChannel()) || (mVoiceChannel && mVoiceChannel->isActive()))
{
LLVoiceClient::participantMap* participants = gVoiceClient->getParticipantList();
LLVoiceClient::participantMap* participants = LLVoiceClient::getInstance()->getParticipantList();
if(participants)
{
LLVoiceClient::participantMap::iterator participant_it;

View File

@@ -64,7 +64,7 @@ LLPanelVoiceDeviceSettings::LLPanelVoiceDeviceSettings()
// ask for new device enumeration
// now do this in onOpen() instead...
//gVoiceClient->refreshDeviceLists();
//LLVoiceClient::getInstance()->refreshDeviceLists();
}
LLPanelVoiceDeviceSettings::~LLPanelVoiceDeviceSettings()
@@ -86,12 +86,12 @@ BOOL LLPanelVoiceDeviceSettings::postBuild()
void LLPanelVoiceDeviceSettings::draw()
{
// let user know that volume indicator is not yet available
bool is_in_tuning_mode = gVoiceClient->inTuningMode();
bool is_in_tuning_mode = LLVoiceClient::getInstance()->inTuningMode();
childSetVisible("wait_text", !is_in_tuning_mode);
LLPanel::draw();
F32 voice_power = gVoiceClient->tuningGetEnergy();
F32 voice_power = LLVoiceClient::getInstance()->tuningGetEnergy();
S32 discrete_power = 0;
if (!is_in_tuning_mode)
@@ -174,13 +174,13 @@ void LLPanelVoiceDeviceSettings::refresh()
LLSlider* volume_slider = getChild<LLSlider>("mic_volume_slider");
// set mic volume tuning slider based on last mic volume setting
F32 current_volume = (F32)volume_slider->getValue().asReal();
gVoiceClient->tuningSetMicVolume(current_volume);
LLVoiceClient::getInstance()->tuningSetMicVolume(current_volume);
// Fill in popup menus
mCtrlInputDevices = getChild<LLComboBox>("voice_input_device");
mCtrlOutputDevices = getChild<LLComboBox>("voice_output_device");
if(!gVoiceClient->deviceSettingsAvailable())
if(!LLVoiceClient::getInstance()->deviceSettingsAvailable())
{
// The combo boxes are disabled, since we can't get the device settings from the daemon just now.
// Put the currently set default (ONLY) in the box, and select it.
@@ -208,7 +208,7 @@ void LLPanelVoiceDeviceSettings::refresh()
mCtrlInputDevices->removeall();
mCtrlInputDevices->add( getString("default_text"), ADD_BOTTOM );
devices = gVoiceClient->getCaptureDevices();
devices = LLVoiceClient::getInstance()->getCaptureDevices();
for(iter=devices->begin(); iter != devices->end(); iter++)
{
mCtrlInputDevices->add( *iter, ADD_BOTTOM );
@@ -225,7 +225,7 @@ void LLPanelVoiceDeviceSettings::refresh()
mCtrlOutputDevices->removeall();
mCtrlOutputDevices->add( getString("default_text"), ADD_BOTTOM );
devices = gVoiceClient->getRenderDevices();
devices = LLVoiceClient::getInstance()->getRenderDevices();
for(iter=devices->begin(); iter != devices->end(); iter++)
{
mCtrlOutputDevices->add( *iter, ADD_BOTTOM );
@@ -248,34 +248,34 @@ void LLPanelVoiceDeviceSettings::onOpen()
mDevicesUpdated = FALSE;
// ask for new device enumeration
gVoiceClient->refreshDeviceLists();
LLVoiceClient::getInstance()->refreshDeviceLists();
// put voice client in "tuning" mode
gVoiceClient->tuningStart();
LLVoiceClient::getInstance()->tuningStart();
LLVoiceChannel::suspend();
}
void LLPanelVoiceDeviceSettings::onClose(bool app_quitting)
{
gVoiceClient->tuningStop();
LLVoiceClient::getInstance()->tuningStop();
LLVoiceChannel::resume();
}
// static
void LLPanelVoiceDeviceSettings::onCommitInputDevice(LLUICtrl* ctrl, void* user_data)
{
if(gVoiceClient)
if(LLVoiceClient::instanceExists())
{
gVoiceClient->setCaptureDevice(ctrl->getValue().asString());
LLVoiceClient::getInstance()->setCaptureDevice(ctrl->getValue().asString());
}
}
// static
void LLPanelVoiceDeviceSettings::onCommitOutputDevice(LLUICtrl* ctrl, void* user_data)
{
if(gVoiceClient)
if(LLVoiceClient::instanceExists())
{
gVoiceClient->setRenderDevice(ctrl->getValue().asString());
LLVoiceClient::getInstance()->setRenderDevice(ctrl->getValue().asString());
}
}

View File

@@ -515,13 +515,13 @@ LLFloaterIMPanel::~LLFloaterIMPanel()
mSpeakers = NULL;
// End the text IM session if necessary
if(gVoiceClient && mOtherParticipantUUID.notNull())
if(LLVoiceClient::instanceExists() && mOtherParticipantUUID.notNull())
{
switch(mDialog)
{
case IM_NOTHING_SPECIAL:
case IM_SESSION_P2P_INVITE:
gVoiceClient->endUserIMSession(mOtherParticipantUUID);
LLVoiceClient::getInstance()->endUserIMSession(mOtherParticipantUUID);
break;
default:
@@ -651,7 +651,7 @@ void LLFloaterIMPanel::onVolumeChange(LLUICtrl* source, void* user_data)
LLFloaterIMPanel* floaterp = (LLFloaterIMPanel*)user_data;
if (floaterp)
{
gVoiceClient->setUserVolume(floaterp->mOtherParticipantUUID, (F32)source->getValue().asReal());
LLVoiceClient::getInstance()->setUserVolume(floaterp->mOtherParticipantUUID, (F32)source->getValue().asReal());
}
}
@@ -734,7 +734,7 @@ void LLFloaterIMPanel::draw()
{
// refresh volume and mute checkbox
mVolumeSlider->setVisible(LLVoiceClient::voiceEnabled() && mVoiceChannel->isActive());
mVolumeSlider->setValue(gVoiceClient->getUserVolume(mOtherParticipantUUID));
mVolumeSlider->setValue(LLVoiceClient::getInstance()->getUserVolume(mOtherParticipantUUID));
mMuteBtn->setValue(LLMuteList::getInstance()->isMuted(mOtherParticipantUUID, LLMute::flagVoiceChat));
mMuteBtn->setVisible(LLVoiceClient::voiceEnabled() && mVoiceChannel->isActive());
@@ -752,7 +752,8 @@ public:
/*virtual*/ void error(U32 statusNum, const std::string& reason)
{
llinfos << "Error inviting all agents to session" << llendl;
llwarns << "Error inviting all agents to session [status:"
<< statusNum << "]: " << reason << llendl;
//throw something back to the viewer here?
}
@@ -1197,7 +1198,7 @@ void deliver_message(const std::string& utf8_text,
if((offline == IM_OFFLINE) && (LLVoiceClient::getInstance()->isOnlineSIP(other_participant_id)))
{
// User is online through the OOW connector, but not with a regular viewer. Try to send the message via SLVoice.
sent = gVoiceClient->sendTextMessage(other_participant_id, utf8_text);
sent = LLVoiceClient::getInstance()->sendTextMessage(other_participant_id, utf8_text);
}
if(!sent)

View File

@@ -355,10 +355,10 @@ bool inviteUserResponse(const LLSD& notification, const LLSD& response)
{
if (type == IM_SESSION_P2P_INVITE)
{
if(gVoiceClient)
if(LLVoiceClient::instanceExists())
{
std::string s = payload["session_handle"].asString();
gVoiceClient->declineInvite(s);
LLVoiceClient::getInstance()->declineInvite(s);
}
}
else

View File

@@ -1592,7 +1592,7 @@ bool idle_startup()
}
gViewerWindow->getWindow()->setTitle(LLAppViewer::instance()->getWindowTitle() + "- " + name);
// Pass the user information to the voice chat server interface.
gVoiceClient->userAuthorized(firstname, lastname, gAgentID);
LLVoiceClient::getInstance()->userAuthorized(firstname, lastname, gAgentID);
LLStartUp::setStartupState( STATE_WORLD_INIT );
}
else

View File

@@ -73,7 +73,6 @@
#include "llviewerparcelmgr.h"
#include "llviewerthrottle.h"
#include "lluictrlfactory.h"
#include "llvoiceclient.h" // for gVoiceClient
#include "llagentui.h"
#include "lltoolmgr.h"

View File

@@ -182,19 +182,19 @@ void audio_update_volume(bool force_update)
LLViewerMedia::setVolume( mute_media ? 0.0f : media_volume );
// Voice
if (gVoiceClient)
if (LLVoiceClient::instanceExists())
{
F32 voice_volume = mute_volume * master_volume * audio_level_voice;
gVoiceClient->setVoiceVolume(mute_voice ? 0.f : voice_volume);
gVoiceClient->setMicGain(mute_voice ? 0.f : audio_level_mic);
LLVoiceClient::getInstance()->setVoiceVolume(mute_voice ? 0.f : voice_volume);
LLVoiceClient::getInstance()->setMicGain(mute_voice ? 0.f : audio_level_mic);
if (!gViewerWindow->getActive() && mute_when_minimized)
{
gVoiceClient->setMuteMic(true);
LLVoiceClient::getInstance()->setMuteMic(true);
}
else
{
gVoiceClient->setMuteMic(false);
LLVoiceClient::getInstance()->setMuteMic(false);
}
}
}

View File

@@ -547,6 +547,12 @@ bool handleEffectColorChanged(const LLSD& newvalue)
return true;
}
bool handleVoiceClientPrefsChanged(const LLSD& newvalue)
{
LLVoiceClient::getInstance()->updateSettings();
return true;
}
bool handleVelocityInterpolate(const LLSD& newvalue)
{
LLMessageSystem* msg = gMessageSystem;
@@ -571,15 +577,6 @@ bool handleVelocityInterpolate(const LLSD& newvalue)
return true;
}
bool handleVoiceClientPrefsChanged(const LLSD& newvalue)
{
if(gVoiceClient)
{
gVoiceClient->updateSettings();
}
return true;
}
bool handleTranslateChatPrefsChanged(const LLSD& newvalue)
{
LLFloaterChat* floaterp = LLFloaterChat::getInstance();

View File

@@ -1085,7 +1085,7 @@ BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK m
BOOL LLViewerWindow::handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask)
{
BOOL down = TRUE;
gVoiceClient->middleMouseState(true);
LLVoiceClient::getInstance()->middleMouseState(true);
handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down);
// Always handled as far as the OS is concerned.
@@ -1095,7 +1095,7 @@ BOOL LLViewerWindow::handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MAS
BOOL LLViewerWindow::handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask)
{
BOOL down = FALSE;
gVoiceClient->middleMouseState(false);
LLVoiceClient::getInstance()->middleMouseState(false);
handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down);
// Always handled as far as the OS is concerned.
@@ -1237,8 +1237,7 @@ void LLViewerWindow::handleFocusLost(LLWindow *window)
BOOL LLViewerWindow::handleTranslatedKeyDown(KEY key, MASK mask, BOOL repeated)
{
// Let the voice chat code check for its PTT key. Note that this never affects event processing.
if(gVoiceClient)
gVoiceClient->keyDown(key, mask);
LLVoiceClient::getInstance()->keyDown(key, mask);
if (gAwayTimer.getElapsedTimeF32() > MIN_AFK_TIME)
{
@@ -1260,7 +1259,7 @@ BOOL LLViewerWindow::handleTranslatedKeyDown(KEY key, MASK mask, BOOL repeated)
BOOL LLViewerWindow::handleTranslatedKeyUp(KEY key, MASK mask)
{
// Let the voice chat code check for its PTT key. Note that this never affects event processing.
gVoiceClient->keyUp(key, mask);
LLVoiceClient::getInstance()->keyUp(key, mask);
return FALSE;
}

View File

@@ -1526,7 +1526,7 @@ void LLVOAvatar::initInstance(void)
//VTPause(); // VTune
mVoiceVisualizer->setVoiceEnabled( gVoiceClient->getVoiceEnabled( mID ) );
mVoiceVisualizer->setVoiceEnabled( LLVoiceClient::getInstance()->getVoiceEnabled( mID ) );
}
// virtual
@@ -2344,13 +2344,16 @@ void LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
// store off last frame's root position to be consistent with camera position
LLVector3 root_pos_last = mRoot->getWorldPosition();
bool detailed_update = updateCharacter(agent);
bool voice_enabled = gVoiceClient->getVoiceEnabled( mID ) && gVoiceClient->inProximalChannel();
if (gNoRender)
{
return;
}
static LLUICachedControl<bool> visualizers_in_calls("ShowVoiceVisualizersInCalls", false);
bool voice_enabled = (visualizers_in_calls || LLVoiceClient::getInstance()->inProximalChannel()) &&
LLVoiceClient::getInstance()->getVoiceEnabled(mID);
idleUpdateVoiceVisualizer( voice_enabled );
idleUpdateMisc( detailed_update );
idleUpdateAppearanceAnimation();
@@ -2421,7 +2424,7 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled)
// Notice the calls to "gAwayTimer.reset()". This resets the timer that determines how long the avatar has been
// "away", so that the avatar doesn't lapse into away-mode (and slump over) while the user is still talking.
//-----------------------------------------------------------------------------------------------------------------
if ( gVoiceClient->getIsSpeaking( mID ) )
if (LLVoiceClient::getInstance()->getIsSpeaking( mID ))
{
if ( ! mVoiceVisualizer->getCurrentlySpeaking() )
{
@@ -2430,7 +2433,7 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled)
//printf( "gAwayTimer.reset();\n" );
}
mVoiceVisualizer->setSpeakingAmplitude( gVoiceClient->getCurrentPower( mID ) );
mVoiceVisualizer->setSpeakingAmplitude( LLVoiceClient::getInstance()->getCurrentPower( mID ) );
if( isSelf() )
{
@@ -2682,7 +2685,7 @@ F32 LLVOAvatar::calcMorphAmount()
void LLVOAvatar::idleUpdateLipSync(bool voice_enabled)
{
// Use the Lipsync_Ooh and Lipsync_Aah morphs for lip sync
if ( voice_enabled && (gVoiceClient->lipSyncEnabled()) && gVoiceClient->getIsSpeaking( mID ) )
if ( voice_enabled && (LLVoiceClient::getInstance()->lipSyncEnabled()) && LLVoiceClient::getInstance()->getIsSpeaking( mID ) )
{
F32 ooh_morph_amount = 0.0f;
F32 aah_morph_amount = 0.0f;

View File

@@ -28,6 +28,7 @@
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#if LL_LINUX && defined(LL_STANDALONE)
@@ -86,15 +87,13 @@ extern AIHTTPTimeoutPolicy viewerVoiceAccountProvisionResponder_timeout;
extern AIHTTPTimeoutPolicy voiceClientCapResponder_timeout;
static bool sConnectingToAgni = false;
F32 LLVoiceClient::OVERDRIVEN_POWER_LEVEL = 0.7f;
const F32 LLVoiceClient::OVERDRIVEN_POWER_LEVEL = 0.7f;
const F32 SPEAKING_TIMEOUT = 1.f;
const int VOICE_MAJOR_VERSION = 1;
const int VOICE_MINOR_VERSION = 0;
LLVoiceClient *gVoiceClient = NULL;
// Don't retry connecting to the daemon more frequently than this:
const F32 CONNECT_THROTTLE_SECONDS = 1.0f;
@@ -155,19 +154,19 @@ public:
if ( mRetries > 0 )
{
LL_WARNS("Voice") << "ProvisionVoiceAccountRequest returned an error, retrying. status = " << status << ", reason = \"" << reason << "\"" << LL_ENDL;
if ( gVoiceClient ) gVoiceClient->requestVoiceAccountProvision(
if (LLVoiceClient::instanceExists()) LLVoiceClient::getInstance()->requestVoiceAccountProvision(
mRetries - 1);
}
else
{
LL_WARNS("Voice") << "ProvisionVoiceAccountRequest returned an error, too many retries (giving up). status = " << status << ", reason = \"" << reason << "\"" << LL_ENDL;
if ( gVoiceClient ) gVoiceClient->giveUp();
if (LLVoiceClient::instanceExists()) LLVoiceClient::getInstance()->giveUp();
}
}
/*virtual*/ void result(const LLSD& content)
{
if ( gVoiceClient )
if (LLVoiceClient::instanceExists())
{
std::string voice_sip_uri_hostname;
std::string voice_account_server_uri;
@@ -181,7 +180,7 @@ public:
if(content.has("voice_account_server_name"))
voice_account_server_uri = content["voice_account_server_name"].asString();
gVoiceClient->login(
LLVoiceClient::getInstance()->login(
content["username"].asString(),
content["password"].asString(),
voice_sip_uri_hostname,
@@ -384,7 +383,7 @@ LLIOPipe::EStatus LLVivoxProtocolParser::process_impl(
LL_DEBUGS("VivoxProtocolParser") << "at end, mInput is: " << mInput << LL_ENDL;
if(!gVoiceClient->mConnected)
if(!LLVoiceClient::getInstance()->mConnected)
{
// If voice has been disabled, we just want to close the socket. This does so.
LL_INFOS("Voice") << "returning STATUS_STOP" << LL_ENDL;
@@ -484,23 +483,23 @@ void LLVivoxProtocolParser::StartTag(const char *tag, const char **attr)
}
else if (!stricmp("CaptureDevices", tag))
{
gVoiceClient->clearCaptureDevices();
LLVoiceClient::getInstance()->clearCaptureDevices();
}
else if (!stricmp("RenderDevices", tag))
{
gVoiceClient->clearRenderDevices();
LLVoiceClient::getInstance()->clearRenderDevices();
}
else if (!stricmp("Buddies", tag))
{
gVoiceClient->deleteAllBuddies();
LLVoiceClient::getInstance()->deleteAllBuddies();
}
else if (!stricmp("BlockRules", tag))
{
gVoiceClient->deleteAllBlockRules();
LLVoiceClient::getInstance()->deleteAllBlockRules();
}
else if (!stricmp("AutoAcceptRules", tag))
{
gVoiceClient->deleteAllAutoAcceptRules();
LLVoiceClient::getInstance()->deleteAllAutoAcceptRules();
}
}
@@ -608,19 +607,19 @@ void LLVivoxProtocolParser::EndTag(const char *tag)
}
else if (!stricmp("CaptureDevice", tag))
{
gVoiceClient->addCaptureDevice(textBuffer);
LLVoiceClient::getInstance()->addCaptureDevice(textBuffer);
}
else if (!stricmp("RenderDevice", tag))
{
gVoiceClient->addRenderDevice(textBuffer);
LLVoiceClient::getInstance()->addRenderDevice(textBuffer);
}
else if (!stricmp("Buddy", tag))
{
gVoiceClient->processBuddyListEntry(uriString, displayNameString);
LLVoiceClient::getInstance()->processBuddyListEntry(uriString, displayNameString);
}
else if (!stricmp("BlockRule", tag))
{
gVoiceClient->addBlockRule(blockMask, presenceOnly);
LLVoiceClient::getInstance()->addBlockRule(blockMask, presenceOnly);
}
else if (!stricmp("BlockMask", tag))
blockMask = string;
@@ -628,7 +627,7 @@ void LLVivoxProtocolParser::EndTag(const char *tag)
presenceOnly = string;
else if (!stricmp("AutoAcceptRule", tag))
{
gVoiceClient->addAutoAcceptRule(autoAcceptMask, autoAddAsBuddy);
LLVoiceClient::getInstance()->addAutoAcceptRule(autoAcceptMask, autoAddAsBuddy);
}
else if (!stricmp("AutoAcceptMask", tag))
autoAcceptMask = string;
@@ -701,7 +700,7 @@ void LLVivoxProtocolParser::processResponse(std::string tag)
const char *eventTypeCstr = eventTypeString.c_str();
if (!stricmp(eventTypeCstr, "AccountLoginStateChangeEvent"))
{
gVoiceClient->accountLoginStateChangeEvent(accountHandle, statusCode, statusString, state);
LLVoiceClient::getInstance()->accountLoginStateChangeEvent(accountHandle, statusCode, statusString, state);
}
else if (!stricmp(eventTypeCstr, "SessionAddedEvent"))
{
@@ -715,15 +714,15 @@ void LLVivoxProtocolParser::processResponse(std::string tag)
<ChannelName />
</Event>
*/
gVoiceClient->sessionAddedEvent(uriString, alias, sessionHandle, sessionGroupHandle, isChannel, incoming, nameString, applicationString);
LLVoiceClient::getInstance()->sessionAddedEvent(uriString, alias, sessionHandle, sessionGroupHandle, isChannel, incoming, nameString, applicationString);
}
else if (!stricmp(eventTypeCstr, "SessionRemovedEvent"))
{
gVoiceClient->sessionRemovedEvent(sessionHandle, sessionGroupHandle);
LLVoiceClient::getInstance()->sessionRemovedEvent(sessionHandle, sessionGroupHandle);
}
else if (!stricmp(eventTypeCstr, "SessionGroupAddedEvent"))
{
gVoiceClient->sessionGroupAddedEvent(sessionGroupHandle);
LLVoiceClient::getInstance()->sessionGroupAddedEvent(sessionGroupHandle);
}
else if (!stricmp(eventTypeCstr, "MediaStreamUpdatedEvent"))
{
@@ -737,7 +736,7 @@ void LLVivoxProtocolParser::processResponse(std::string tag)
<Incoming>false</Incoming>
</Event>
*/
gVoiceClient->mediaStreamUpdatedEvent(sessionHandle, sessionGroupHandle, statusCode, statusString, state, incoming);
LLVoiceClient::getInstance()->mediaStreamUpdatedEvent(sessionHandle, sessionGroupHandle, statusCode, statusString, state, incoming);
}
else if (!stricmp(eventTypeCstr, "TextStreamUpdatedEvent"))
{
@@ -750,7 +749,7 @@ void LLVivoxProtocolParser::processResponse(std::string tag)
<Incoming>true</Incoming>
</Event>
*/
gVoiceClient->textStreamUpdatedEvent(sessionHandle, sessionGroupHandle, enabled, state, incoming);
LLVoiceClient::getInstance()->textStreamUpdatedEvent(sessionHandle, sessionGroupHandle, enabled, state, incoming);
}
else if (!stricmp(eventTypeCstr, "ParticipantAddedEvent"))
{
@@ -764,7 +763,7 @@ void LLVivoxProtocolParser::processResponse(std::string tag)
<ParticipantType>0</ParticipantType>
</Event>
*/
gVoiceClient->participantAddedEvent(sessionHandle, sessionGroupHandle, uriString, alias, nameString, displayNameString, participantType);
LLVoiceClient::getInstance()->participantAddedEvent(sessionHandle, sessionGroupHandle, uriString, alias, nameString, displayNameString, participantType);
}
else if (!stricmp(eventTypeCstr, "ParticipantRemovedEvent"))
{
@@ -776,7 +775,7 @@ void LLVivoxProtocolParser::processResponse(std::string tag)
<AccountName>xtx7YNV-3SGiG7rA1fo5Ndw==</AccountName>
</Event>
*/
gVoiceClient->participantRemovedEvent(sessionHandle, sessionGroupHandle, uriString, alias, nameString);
LLVoiceClient::getInstance()->participantRemovedEvent(sessionHandle, sessionGroupHandle, uriString, alias, nameString);
}
else if (!stricmp(eventTypeCstr, "ParticipantUpdatedEvent"))
{
@@ -795,21 +794,21 @@ void LLVivoxProtocolParser::processResponse(std::string tag)
// These happen so often that logging them is pretty useless.
squelchDebugOutput = true;
gVoiceClient->participantUpdatedEvent(sessionHandle, sessionGroupHandle, uriString, alias, isModeratorMuted, isSpeaking, volume, energy);
LLVoiceClient::getInstance()->participantUpdatedEvent(sessionHandle, sessionGroupHandle, uriString, alias, isModeratorMuted, isSpeaking, volume, energy);
}
else if (!stricmp(eventTypeCstr, "AuxAudioPropertiesEvent"))
{
gVoiceClient->auxAudioPropertiesEvent(energy);
LLVoiceClient::getInstance()->auxAudioPropertiesEvent(energy);
}
else if (!stricmp(eventTypeCstr, "BuddyPresenceEvent"))
{
gVoiceClient->buddyPresenceEvent(uriString, alias, statusString, applicationString);
LLVoiceClient::getInstance()->buddyPresenceEvent(uriString, alias, statusString, applicationString);
}
else if (!stricmp(eventTypeCstr, "BuddyAndGroupListChangedEvent"))
{
// The buddy list was updated during parsing.
// Need to recheck against the friends list.
gVoiceClient->buddyListChanged();
LLVoiceClient::getInstance()->buddyListChanged();
}
else if (!stricmp(eventTypeCstr, "BuddyChangedEvent"))
{
@@ -827,15 +826,15 @@ void LLVivoxProtocolParser::processResponse(std::string tag)
}
else if (!stricmp(eventTypeCstr, "MessageEvent"))
{
gVoiceClient->messageEvent(sessionHandle, uriString, alias, messageHeader, messageBody, applicationString);
LLVoiceClient::getInstance()->messageEvent(sessionHandle, uriString, alias, messageHeader, messageBody, applicationString);
}
else if (!stricmp(eventTypeCstr, "SessionNotificationEvent"))
{
gVoiceClient->sessionNotificationEvent(sessionHandle, uriString, notificationType);
LLVoiceClient::getInstance()->sessionNotificationEvent(sessionHandle, uriString, notificationType);
}
else if (!stricmp(eventTypeCstr, "SubscriptionEvent"))
{
gVoiceClient->subscriptionEvent(uriString, subscriptionHandle, alias, displayNameString, applicationString, subscriptionType);
LLVoiceClient::getInstance()->subscriptionEvent(uriString, subscriptionHandle, alias, displayNameString, applicationString, subscriptionType);
}
else if (!stricmp(eventTypeCstr, "SessionUpdatedEvent"))
{
@@ -874,39 +873,39 @@ void LLVivoxProtocolParser::processResponse(std::string tag)
const char *actionCstr = actionString.c_str();
if (!stricmp(actionCstr, "Connector.Create.1"))
{
gVoiceClient->connectorCreateResponse(statusCode, statusString, connectorHandle, versionID);
LLVoiceClient::getInstance()->connectorCreateResponse(statusCode, statusString, connectorHandle, versionID);
}
else if (!stricmp(actionCstr, "Account.Login.1"))
{
gVoiceClient->loginResponse(statusCode, statusString, accountHandle, numberOfAliases);
LLVoiceClient::getInstance()->loginResponse(statusCode, statusString, accountHandle, numberOfAliases);
}
else if (!stricmp(actionCstr, "Session.Create.1"))
{
gVoiceClient->sessionCreateResponse(requestId, statusCode, statusString, sessionHandle);
LLVoiceClient::getInstance()->sessionCreateResponse(requestId, statusCode, statusString, sessionHandle);
}
else if (!stricmp(actionCstr, "SessionGroup.AddSession.1"))
{
gVoiceClient->sessionGroupAddSessionResponse(requestId, statusCode, statusString, sessionHandle);
LLVoiceClient::getInstance()->sessionGroupAddSessionResponse(requestId, statusCode, statusString, sessionHandle);
}
else if (!stricmp(actionCstr, "Session.Connect.1"))
{
gVoiceClient->sessionConnectResponse(requestId, statusCode, statusString);
LLVoiceClient::getInstance()->sessionConnectResponse(requestId, statusCode, statusString);
}
else if (!stricmp(actionCstr, "Account.Logout.1"))
{
gVoiceClient->logoutResponse(statusCode, statusString);
LLVoiceClient::getInstance()->logoutResponse(statusCode, statusString);
}
else if (!stricmp(actionCstr, "Connector.InitiateShutdown.1"))
{
gVoiceClient->connectorShutdownResponse(statusCode, statusString);
LLVoiceClient::getInstance()->connectorShutdownResponse(statusCode, statusString);
}
else if (!stricmp(actionCstr, "Account.ListBlockRules.1"))
{
gVoiceClient->accountListBlockRulesResponse(statusCode, statusString);
LLVoiceClient::getInstance()->accountListBlockRulesResponse(statusCode, statusString);
}
else if (!stricmp(actionCstr, "Account.ListAutoAcceptRules.1"))
{
gVoiceClient->accountListAutoAcceptRulesResponse(statusCode, statusString);
LLVoiceClient::getInstance()->accountListAutoAcceptRulesResponse(statusCode, statusString);
}
else if (!stricmp(actionCstr, "Session.Set3DPosition.1"))
{
@@ -916,7 +915,7 @@ void LLVivoxProtocolParser::processResponse(std::string tag)
/*
else if (!stricmp(actionCstr, "Account.ChannelGetList.1"))
{
gVoiceClient->channelGetListResponse(statusCode, statusString);
LLVoiceClient::getInstance()->channelGetListResponse(statusCode, statusString);
}
else if (!stricmp(actionCstr, "Connector.AccountCreate.1"))
{
@@ -998,13 +997,13 @@ void LLVivoxProtocolParser::processResponse(std::string tag)
class LLVoiceClientMuteListObserver : public LLMuteListObserver
{
/* virtual */ void onChange() { gVoiceClient->muteListChanged();}
/* virtual */ void onChange() { LLVoiceClient::getInstance()->muteListChanged();}
};
class LLVoiceClientFriendsObserver : public LLFriendObserver
{
public:
/* virtual */ void changed(U32 mask) { gVoiceClient->updateFriends(mask);}
/* virtual */ void changed(U32 mask) { LLVoiceClient::getInstance()->updateFriends(mask);}
};
static LLVoiceClientMuteListObserver mutelist_listener;
@@ -1055,7 +1054,7 @@ void LLVoiceClientCapResponder::result(const LLSD& content)
voice_credentials["channel_credentials"].asString();
}
gVoiceClient->setSpatialChannel(uri, credentials);
LLVoiceClient::getInstance()->setSpatialChannel(uri, credentials);
}
}
@@ -1115,8 +1114,7 @@ static void killGateway()
///////////////////////////////////////////////////////////////////////////////////////////////
LLVoiceClient::LLVoiceClient()
{
gVoiceClient = this;
{
mWriteInProgress = false;
mAreaVoiceDisabled = false;
mPTT = false;
@@ -1197,30 +1195,23 @@ LLVoiceClient::~LLVoiceClient()
void LLVoiceClient::init(LLPumpIO *pump)
{
// constructor will set up gVoiceClient
LLVoiceClient::getInstance()->mPump = pump;
LLVoiceClient::getInstance()->updateSettings();
}
void LLVoiceClient::terminate()
{
if(gVoiceClient)
if(LLVoiceClient::instanceExists())
{
// gVoiceClient->leaveAudioSession();
gVoiceClient->logout();
// LLVoiceClient::getInstance()->leaveAudioSession();
LLVoiceClient::getInstance()->logout();
// As of SDK version 4885, this should no longer be necessary. It will linger after the socket close if it needs to.
// ms_sleep(2000);
gVoiceClient->connectorShutdown();
gVoiceClient->closeSocket(); // Need to do this now -- bad things happen if the destructor does it later.
LLVoiceClient::getInstance()->connectorShutdown();
LLVoiceClient::getInstance()->closeSocket(); // Need to do this now -- bad things happen if the destructor does it later.
// This will do unpleasant things on windows.
// killGateway();
// Don't do this anymore -- LLSingleton will take care of deleting the object.
// delete gVoiceClient;
// Hint to other code not to access the voice client anymore.
gVoiceClient = NULL;
}
}
@@ -5725,7 +5716,7 @@ void LLVoiceClient::enforceTether(void)
void LLVoiceClient::updatePosition(void)
{
if(gVoiceClient)
if(LLVoiceClient::instanceExists())
{
LLVOAvatar *agent = gAgentAvatarp;
LLViewerRegion *region = gAgent.getRegion();
@@ -5741,7 +5732,7 @@ void LLVoiceClient::updatePosition(void)
rot.setRows(LLViewerCamera::getInstance()->getAtAxis(), LLViewerCamera::getInstance()->getLeftAxis (), LLViewerCamera::getInstance()->getUpAxis());
pos = gAgent.getRegion()->getPosGlobalFromRegion(LLViewerCamera::getInstance()->getOrigin());
gVoiceClient->setCameraPosition(
LLVoiceClient::getInstance()->setCameraPosition(
pos, // position
LLVector3::zero, // velocity
rot); // rotation matrix
@@ -5754,7 +5745,7 @@ void LLVoiceClient::updatePosition(void)
// pos += LLVector3d(mHeadOffset);
pos += LLVector3d(0.f, 0.f, 1.f);
gVoiceClient->setAvatarPosition(
LLVoiceClient::getInstance()->setAvatarPosition(
pos, // position
LLVector3::zero, // velocity
rot); // rotation matrix
@@ -6958,16 +6949,7 @@ void LLVoiceClient::notifyFriendObservers()
void LLVoiceClient::lookupName(const LLUUID &id)
{
gCacheName->get(id, false, boost::bind(&LLVoiceClient::onAvatarNameLookup,_1,_2));
}
//static
void LLVoiceClient::onAvatarNameLookup(const LLUUID& id, const std::string& full_name)
{
if(gVoiceClient)
{
gVoiceClient->avatarNameResolved(id, full_name);
}
gCacheName->get(id, false, boost::bind(&LLVoiceClient::avatarNameResolved,this,_1,_2));
}
void LLVoiceClient::avatarNameResolved(const LLUUID &id, const std::string &name)
@@ -7066,7 +7048,7 @@ class LLViewerParcelVoiceInfo : public LLHTTPNode
voice_credentials["channel_credentials"].asString();
}
gVoiceClient->setSpatialChannel(uri, credentials);
LLVoiceClient::getInstance()->setSpatialChannel(uri, credentials);
}
}
}
@@ -7089,7 +7071,7 @@ class LLViewerRequiredVoiceVersion : public LLHTTPNode
// int minor_voice_version =
// input["body"]["minor_version"].asInteger();
if (gVoiceClient &&
if (LLVoiceClient::instanceExists() &&
(major_voice_version > VOICE_MAJOR_VERSION) )
{
if (!sAlertedUser)

View File

@@ -93,7 +93,7 @@ class LLVoiceClient: public LLSingleton<LLVoiceClient>
public:
static F32 OVERDRIVEN_POWER_LEVEL;
static const F32 OVERDRIVEN_POWER_LEVEL;
void updateSettings(); // call after loading settings and whenever they change
@@ -461,9 +461,8 @@ static void updatePosition(void);
void removeObserver(LLFriendObserver* observer);
void lookupName(const LLUUID &id);
static void onAvatarNameLookup(const LLUUID& id, const std::string& full_name);
void avatarNameResolved(const LLUUID &id, const std::string &name);
typedef std::vector<std::string> deviceList;
deviceList *getCaptureDevices();
@@ -748,8 +747,6 @@ static std::string nameFromsipURI(const std::string &uri);
void notifyFriendObservers();
};
extern LLVoiceClient *gVoiceClient;
#endif //LL_VOICE_CLIENT_H

View File

@@ -113,15 +113,15 @@ void LLVoiceRemoteCtrl::draw()
if (!mTalkBtn->hasMouseCapture())
{
// not in push to talk mode, or push to talk is active means I'm talking
mTalkBtn->setToggleState(!ptt_currently_enabled || gVoiceClient->getUserPTTState());
mTalkBtn->setToggleState(!ptt_currently_enabled || LLVoiceClient::getInstance()->getUserPTTState());
}
mSpeakersBtn->setToggleState(LLFloaterActiveSpeakers::instanceVisible(LLSD()));
mTalkLockBtn->setToggleState(!ptt_currently_enabled);
std::string talk_blip_image;
if (gVoiceClient->getIsSpeaking(gAgent.getID()))
if (LLVoiceClient::getInstance()->getIsSpeaking(gAgent.getID()))
{
F32 voice_power = gVoiceClient->getCurrentPower(gAgent.getID());
F32 voice_power = LLVoiceClient::getInstance()->getCurrentPower(gAgent.getID());
if (voice_power > LLVoiceClient::OVERDRIVEN_POWER_LEVEL)
{
@@ -129,7 +129,7 @@ void LLVoiceRemoteCtrl::draw()
}
else
{
F32 power = gVoiceClient->getCurrentPower(gAgent.getID());
F32 power = LLVoiceClient::getInstance()->getCurrentPower(gAgent.getID());
S32 icon_image_idx = llmin(2, llfloor((power / LLVoiceClient::OVERDRIVEN_POWER_LEVEL) * 3.f));
switch(icon_image_idx)
@@ -224,7 +224,7 @@ void LLVoiceRemoteCtrl::onBtnTalkClicked()
// when in toggle mode, clicking talk button turns mic on/off
if (gSavedSettings.getBOOL("PushToTalkToggle"))
{
gVoiceClient->toggleUserPTTState();
LLVoiceClient::getInstance()->toggleUserPTTState();
}
}
@@ -233,7 +233,7 @@ void LLVoiceRemoteCtrl::onBtnTalkHeld()
// when not in toggle mode, holding down talk button turns on mic
if (!gSavedSettings.getBOOL("PushToTalkToggle"))
{
gVoiceClient->setUserPTTState(true);
LLVoiceClient::getInstance()->setUserPTTState(true);
}
}
@@ -242,7 +242,7 @@ void LLVoiceRemoteCtrl::onBtnTalkReleased()
// when not in toggle mode, releasing talk button turns off mic
if (!gSavedSettings.getBOOL("PushToTalkToggle"))
{
gVoiceClient->setUserPTTState(false);
LLVoiceClient::getInstance()->setUserPTTState(false);
}
}