From 2eb34c2bc5b03ae495a816ea8813a7c0057ffff1 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 11 Sep 2014 10:11:24 +0200 Subject: [PATCH] Fix "Speak" toolbar button state not correct when toggling voice --- indra/newview/llvoiceclient.cpp | 10 ++++++++-- indra/newview/llvoiceclient.h | 10 ++++++++-- indra/newview/llvoicevivox.cpp | 14 ++++++++++++-- indra/newview/llvoicevivox.h | 5 ++++- 4 files changed, 32 insertions(+), 7 deletions(-) diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 9f8f9ae27c..7d29eaa256 100755 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -488,11 +488,17 @@ void LLVoiceClient::setMicGain(F32 volume) //------------------------------------------ // enable/disable voice features -bool LLVoiceClient::voiceEnabled() +// Bypass LLCachedControls for voice status update +//bool LLVoiceClient::voiceEnabled() +bool LLVoiceClient::voiceEnabled(bool no_cache) +// { if (mVoiceModule) { - return mVoiceModule->voiceEnabled(); + // Bypass LLCachedControls for voice status update + //return mVoiceModule->voiceEnabled(); + return mVoiceModule->voiceEnabled(no_cache); + // } else { diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h index 9d1410a45b..bcdba2b587 100755 --- a/indra/newview/llvoiceclient.h +++ b/indra/newview/llvoiceclient.h @@ -186,7 +186,10 @@ public: ///////////////////////// /// @name enable disable voice and features //@{ - virtual bool voiceEnabled()=0; + // Bypass LLCachedControls for voice status update + //virtual bool voiceEnabled()=0; + virtual bool voiceEnabled(bool no_cache = false)=0; + // virtual void setVoiceEnabled(bool enabled)=0; virtual void setLipSyncEnabled(BOOL enabled)=0; virtual BOOL lipSyncEnabled()=0; @@ -397,7 +400,10 @@ public: void setVoiceVolume(F32 volume); void setMicGain(F32 volume); void setUserVolume(const LLUUID& id, F32 volume); // set's volume for specified agent, from 0-1 (where .5 is nominal) - bool voiceEnabled(); + // Bypass LLCachedControls for voice status update + //bool voiceEnabled(); + bool voiceEnabled(bool no_cache = false); + // void setLipSyncEnabled(BOOL enabled); 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); diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index cccdacb31c..85b82d19b7 100755 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -4720,15 +4720,22 @@ void LLVivoxVoiceClient::setVoiceEnabled(bool enabled) } } -bool LLVivoxVoiceClient::voiceEnabled() +// Bypass LLCachedControls for voice status update +//bool LLVivoxVoiceClient::voiceEnabled() +bool LLVivoxVoiceClient::voiceEnabled(bool no_cache) { // Replace frequently called gSavedSettings //return gSavedSettings.getBOOL("EnableVoiceChat") && !gSavedSettings.getBOOL("CmdLineDisableVoice"); + if (no_cache) + { + return gSavedSettings.getBOOL("EnableVoiceChat") && !gSavedSettings.getBOOL("CmdLineDisableVoice"); + } static LLCachedControl sEnableVoiceChat(gSavedSettings, "EnableVoiceChat"); static LLCachedControl sCmdLineDisableVoice(gSavedSettings, "CmdLineDisableVoice"); return sEnableVoiceChat && !sCmdLineDisableVoice; // } +// void LLVivoxVoiceClient::setLipSyncEnabled(BOOL enabled) { @@ -5474,7 +5481,10 @@ void LLVivoxVoiceClient::notifyStatusObservers(LLVoiceClientStatusObserver::ESta if ( status != LLVoiceClientStatusObserver::STATUS_JOINING && status != LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL) { - bool voice_status = LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking(); + // Bypass LLCachedControls for voice status update + //bool voice_status = LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking(); + bool voice_status = LLVoiceClient::getInstance()->voiceEnabled(true) && LLVoiceClient::getInstance()->isVoiceWorking(); + // gAgent.setVoiceConnected(voice_status); diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h index de28cf34aa..d6f2bd05b1 100755 --- a/indra/newview/llvoicevivox.h +++ b/indra/newview/llvoicevivox.h @@ -168,7 +168,10 @@ public: ///////////////////////// /// @name enable disable voice and features //@{ - virtual bool voiceEnabled(); + // Bypass LLCachedControls for voice status update + //virtual bool voiceEnabled(); + virtual bool voiceEnabled(bool no_cache = false); + // virtual void setVoiceEnabled(bool enabled); virtual BOOL lipSyncEnabled(); virtual void setLipSyncEnabled(BOOL enabled);