diff options
author | Tofu Linden <tofu.linden@lindenlab.com> | 2009-11-09 17:51:21 +0000 |
---|---|---|
committer | Tofu Linden <tofu.linden@lindenlab.com> | 2009-11-09 17:51:21 +0000 |
commit | 8b9c031f596280f79d06f688c2f654d7ec07a7d0 (patch) | |
tree | 8e35a86892af78f13416b1d904da1c9638f48103 /indra/newview/llvoiceclient.cpp | |
parent | 56841bb2118184aa0a0c2b2a8bc52d2b593cc0c5 (diff) |
Smarter mildly-refactored voice-toggle state management.
Diffstat (limited to 'indra/newview/llvoiceclient.cpp')
-rw-r--r-- | indra/newview/llvoiceclient.cpp | 45 |
1 files changed, 19 insertions, 26 deletions
diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index f303f14843..39d4bb0c02 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -5925,8 +5925,6 @@ void LLVoiceClient::setMicGain(F32 volume) void LLVoiceClient::keyDown(KEY key, MASK mask) { -// LL_DEBUGS("Voice") << "key is " << LLKeyboard::stringFromKey(key) << LL_ENDL; - if (gKeyboard->getKeyRepeated(key)) { // ignore auto-repeat keys @@ -5935,44 +5933,39 @@ void LLVoiceClient::keyDown(KEY key, MASK mask) if(!mPTTIsMiddleMouse) { - if(mPTTIsToggle) - { - if(key == mPTTKey) - { - toggleUserPTTState(); - } - } - else if(mPTTKey != KEY_NONE) - { - setUserPTTState(gKeyboard->getKeyDown(mPTTKey)); - } + bool down = (mPTTKey != KEY_NONE) + && gKeyboard->getKeyDown(mPTTKey); + inputUserControlState(down); } } void LLVoiceClient::keyUp(KEY key, MASK mask) { if(!mPTTIsMiddleMouse) { - if(!mPTTIsToggle && (mPTTKey != KEY_NONE)) + bool down = (mPTTKey != KEY_NONE) + && gKeyboard->getKeyDown(mPTTKey); + inputUserControlState(down); + } +} +void LLVoiceClient::inputUserControlState(bool down) +{ + if(mPTTIsToggle) + { + if(down) // toggle open-mic state on 'down' { - setUserPTTState(gKeyboard->getKeyDown(mPTTKey)); + toggleUserPTTState(); } } + else // set open-mic state as an absolute + { + setUserPTTState(down); + } } void LLVoiceClient::middleMouseState(bool down) { if(mPTTIsMiddleMouse) { - if(mPTTIsToggle) - { - if(down) - { - toggleUserPTTState(); - } - } - else - { - setUserPTTState(down); - } + inputUserControlState(down); } } |