Fix "Speak" toolbar button state not correct when toggling voice

Ansariel 2014-09-11 10:11:24 +02:00
parent 40adc15f0f
commit 2eb34c2bc5
4 changed files with 32 additions and 7 deletions

View File

@ -488,11 +488,17 @@ void LLVoiceClient::setMicGain(F32 volume)
//------------------------------------------
// enable/disable voice features
bool LLVoiceClient::voiceEnabled()
// <FS:Ansariel> Bypass LLCachedControls for voice status update
//bool LLVoiceClient::voiceEnabled()
bool LLVoiceClient::voiceEnabled(bool no_cache)
// </FS:Ansariel>
{
if (mVoiceModule)
{
return mVoiceModule->voiceEnabled();
// <FS:Ansariel> Bypass LLCachedControls for voice status update
//return mVoiceModule->voiceEnabled();
return mVoiceModule->voiceEnabled(no_cache);
// </FS:Ansariel>
}
else
{

View File

@ -186,7 +186,10 @@ public:
/////////////////////////
/// @name enable disable voice and features
//@{
virtual bool voiceEnabled()=0;
// <FS:Ansariel> Bypass LLCachedControls for voice status update
//virtual bool voiceEnabled()=0;
virtual bool voiceEnabled(bool no_cache = false)=0;
// </FS:Ansariel>
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();
// <FS:Ansariel> Bypass LLCachedControls for voice status update
//bool voiceEnabled();
bool voiceEnabled(bool no_cache = false);
// </FS:Ansariel>
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);

View File

@ -4720,15 +4720,22 @@ void LLVivoxVoiceClient::setVoiceEnabled(bool enabled)
}
}
bool LLVivoxVoiceClient::voiceEnabled()
// <FS:Ansariel> Bypass LLCachedControls for voice status update
//bool LLVivoxVoiceClient::voiceEnabled()
bool LLVivoxVoiceClient::voiceEnabled(bool no_cache)
{
// <FS:Ansariel> Replace frequently called gSavedSettings
//return gSavedSettings.getBOOL("EnableVoiceChat") && !gSavedSettings.getBOOL("CmdLineDisableVoice");
if (no_cache)
{
return gSavedSettings.getBOOL("EnableVoiceChat") && !gSavedSettings.getBOOL("CmdLineDisableVoice");
}
static LLCachedControl<bool> sEnableVoiceChat(gSavedSettings, "EnableVoiceChat");
static LLCachedControl<bool> sCmdLineDisableVoice(gSavedSettings, "CmdLineDisableVoice");
return sEnableVoiceChat && !sCmdLineDisableVoice;
// </FS:Ansariel>
}
// </FS:Ansariel>
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();
// <FS:Ansariel> 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();
// </FS:Ansariel>
gAgent.setVoiceConnected(voice_status);

View File

@ -168,7 +168,10 @@ public:
/////////////////////////
/// @name enable disable voice and features
//@{
virtual bool voiceEnabled();
// <FS:Ansariel> Bypass LLCachedControls for voice status update
//virtual bool voiceEnabled();
virtual bool voiceEnabled(bool no_cache = false);
// </FS:Ansariel>
virtual void setVoiceEnabled(bool enabled);
virtual BOOL lipSyncEnabled();
virtual void setLipSyncEnabled(BOOL enabled);