diff options
author | maksymsproductengine <maksymsproductengine@lindenlab.com> | 2013-01-18 03:52:42 +0200 |
---|---|---|
committer | maksymsproductengine <maksymsproductengine@lindenlab.com> | 2013-01-18 03:52:42 +0200 |
commit | 5eef65e99476b716985eeccfbbcdafdfb664cb1a (patch) | |
tree | 9a045f88ebf6ffd2353dd5e2adf8806d74e0a37a /indra/newview | |
parent | 2f20348fb6a5b9a461e284f76c207e7384f221ee (diff) |
CHUI-379 FIXED Restore Voice Morphing menu
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llviewermenu.cpp | 16 | ||||
-rw-r--r-- | indra/newview/llvoicevivox.cpp | 100 | ||||
-rw-r--r-- | indra/newview/llvoicevivox.h | 3 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_voice_effect.xml | 3 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_viewer.xml | 39 |
5 files changed, 149 insertions, 12 deletions
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index a0aa639ac6..8b45c44ed0 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -108,6 +108,7 @@ #include "llviewerparcelmgr.h" #include "llviewerstats.h" #include "llvoavatarself.h" +#include "llvoicevivox.h" #include "llworldmap.h" #include "pipeline.h" #include "llviewerjoystick.h" @@ -8152,6 +8153,11 @@ public: } }; +void handle_voice_morphing_subscribe() +{ + LLWeb::loadURLExternal(LLTrans::getString("voice_morphing_url")); +} + class LLToggleUIHints : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -8337,7 +8343,15 @@ void initialize_menus() // Me > Movement view_listener_t::addMenu(new LLAdvancedAgentFlyingInfo(), "Agent.getFlying"); - + + // Communicate > Voice morphing > Subscribe... + commit.add("Communicate.VoiceMorphing.Subscribe", boost::bind(&handle_voice_morphing_subscribe)); + LLVivoxVoiceClient * voice_clientp = LLVivoxVoiceClient::getInstance(); + enable.add("Communicate.VoiceMorphing.NoVoiceMorphing.Check" + , boost::bind(&LLVivoxVoiceClient::onCheckVoiceEffect, voice_clientp, "NoVoiceMorphing")); + commit.add("Communicate.VoiceMorphing.NoVoiceMorphing.Click" + , boost::bind(&LLVivoxVoiceClient::onClickVoiceEffect, voice_clientp, "NoVoiceMorphing")); + // World menu view_listener_t::addMenu(new LLWorldAlwaysRun(), "World.AlwaysRun"); view_listener_t::addMenu(new LLWorldCreateLandmark(), "World.CreateLandmark"); diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 5e121bbcee..f3342b7ff1 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -34,6 +34,7 @@ #include "llvoavatarself.h" #include "llbufferstream.h" #include "llfile.h" +#include "llmenugl.h" #ifdef LL_STANDALONE # include "expat.h" #else @@ -70,6 +71,9 @@ #define USE_SESSION_GROUPS 0 +extern LLMenuBarGL* gMenuBarView; +extern void handle_voice_morphing_subscribe(); + const F32 VOLUME_SCALE_VIVOX = 0.01f; const F32 SPEAKING_TIMEOUT = 1.f; @@ -6739,10 +6743,106 @@ void LLVivoxVoiceClient::removeObserver(LLVoiceEffectObserver* observer) mVoiceFontObservers.erase(observer); } +// method checks the item in VoiceMorphing menu for appropriate current voice font +bool LLVivoxVoiceClient::onCheckVoiceEffect(const std::string& voice_effect_name) +{ + LLVoiceEffectInterface * effect_interfacep = LLVoiceClient::instance().getVoiceEffectInterface(); + if (NULL != effect_interfacep) + { + const LLUUID& currect_voice_effect_id = effect_interfacep->getVoiceEffect(); + + if (currect_voice_effect_id.isNull()) + { + if (voice_effect_name == "NoVoiceMorphing") + { + return true; + } + } + else + { + const LLSD& voice_effect_props = effect_interfacep->getVoiceEffectProperties(currect_voice_effect_id); + if (voice_effect_props["name"].asString() == voice_effect_name) + { + return true; + } + } + } + + return false; +} + +// method changes voice font for selected VoiceMorphing menu item +void LLVivoxVoiceClient::onClickVoiceEffect(const std::string& voice_effect_name) +{ + LLVoiceEffectInterface * effect_interfacep = LLVoiceClient::instance().getVoiceEffectInterface(); + if (NULL != effect_interfacep) + { + if (voice_effect_name == "NoVoiceMorphing") + { + effect_interfacep->setVoiceEffect(LLUUID()); + return; + } + const voice_effect_list_t& effect_list = effect_interfacep->getVoiceEffectList(); + if (!effect_list.empty()) + { + for (voice_effect_list_t::const_iterator it = effect_list.begin(); it != effect_list.end(); ++it) + { + if (voice_effect_name == it->first) + { + effect_interfacep->setVoiceEffect(it->second); + return; + } + } + } + } +} + +// it updates VoiceMorphing menu items in accordance with purchased properties +void LLVivoxVoiceClient::updateVoiceMorphingMenu() +{ + if (mVoiceFontListDirty) + { + LLVoiceEffectInterface * effect_interfacep = LLVoiceClient::instance().getVoiceEffectInterface(); + if (effect_interfacep) + { + const voice_effect_list_t& effect_list = effect_interfacep->getVoiceEffectList(); + if (!effect_list.empty()) + { + LLMenuGL * voice_morphing_menup = gMenuBarView->findChildMenuByName("VoiceMorphing", TRUE); + + if (NULL != voice_morphing_menup) + { + S32 items = voice_morphing_menup->getItemCount(); + if (items > 0) + { + voice_morphing_menup->erase(1, items - 3, false); + + S32 pos = 1; + for (voice_effect_list_t::const_iterator it = effect_list.begin(); it != effect_list.end(); ++it) + { + LLMenuItemCheckGL::Params p; + p.name = it->first; + p.label = it->first; + p.on_check.function(boost::bind(&LLVivoxVoiceClient::onCheckVoiceEffect, this, it->first)); + p.on_click.function(boost::bind(&LLVivoxVoiceClient::onClickVoiceEffect, this, it->first)); + LLMenuItemCheckGL * voice_effect_itemp = LLUICtrlFactory::create<LLMenuItemCheckGL>(p); + voice_morphing_menup->insert(pos++, voice_effect_itemp, false); + } + + voice_morphing_menup->needsArrange(); + } + } + } + } + } +} + void LLVivoxVoiceClient::notifyVoiceFontObservers() { LL_DEBUGS("Voice") << "Notifying voice effect observers. Lists changed: " << mVoiceFontListDirty << LL_ENDL; + updateVoiceMorphingMenu(); + for (voice_font_observer_set_t::iterator it = mVoiceFontObservers.begin(); it != mVoiceFontObservers.end(); ) diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h index 69f33df94b..574027de42 100644 --- a/indra/newview/llvoicevivox.h +++ b/indra/newview/llvoicevivox.h @@ -246,6 +246,8 @@ public: //@} + bool onCheckVoiceEffect(const std::string& voice_effect_name); + void onClickVoiceEffect(const std::string& voice_effect_name); protected: ////////////////////// @@ -854,6 +856,7 @@ private: void accountGetTemplateFontsSendMessage(); void sessionSetVoiceFontSendMessage(sessionState *session); + void updateVoiceMorphingMenu(); void notifyVoiceFontObservers(); typedef enum e_voice_font_type diff --git a/indra/newview/skins/default/xui/en/floater_voice_effect.xml b/indra/newview/skins/default/xui/en/floater_voice_effect.xml index 35cb2670d0..146c3d7e30 100644 --- a/indra/newview/skins/default/xui/en/floater_voice_effect.xml +++ b/indra/newview/skins/default/xui/en/floater_voice_effect.xml @@ -5,12 +5,13 @@ height="500" name="voice_effects" help_topic="voice_effects" - title="VOICE MORPHING" + title="VOICE MORPHING PREVIEW" background_visible="true" label="Places" layout="topleft" min_height="360" min_width="200" + save_rect="true" width="300"> <string name="no_voice_effect"> (No Voice Morph) diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 8d5e3f0b5d..10fd8138d2 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -268,17 +268,36 @@ parameter="conversation" /> </menu_item_check> <menu_item_separator/> - <menu_item_check - label="Voice morphing..." - name="ShowVoice" + <menu + label="Voice morphing" + name="VoiceMorphing" visibility_control="VoiceMorphingEnabled"> - <menu_item_check.on_check - function="Floater.Visible" - parameter="voice_effect" /> - <menu_item_check.on_click - function="Floater.Toggle" - parameter="voice_effect" /> - </menu_item_check> + <menu_item_check + label="No voice morphing" + name="NoVoiceMorphing"> + <menu_item_check.on_check + function="Communicate.VoiceMorphing.NoVoiceMorphing.Check" /> + <menu_item_check.on_click + function="Communicate.VoiceMorphing.NoVoiceMorphing.Click" /> + </menu_item_check> + <menu_item_separator/> + <menu_item_check + label="Preview..." + name="Preview"> + <menu_item_check.on_check + function="Floater.Visible" + parameter="voice_effect" /> + <menu_item_check.on_click + function="Floater.Toggle" + parameter="voice_effect" /> + </menu_item_check> + <menu_item_call + label="Subscribe..." + name="Subscribe"> + <menu_item_call.on_click + function="Communicate.VoiceMorphing.Subscribe" /> + </menu_item_call> + </menu> <menu_item_check label="Gestures..." name="Gestures" |