From 6af471482d6801530915c1c9ae4bdf788af52eae Mon Sep 17 00:00:00 2001 From: TJ Date: Sat, 7 Sep 2024 00:08:32 +1000 Subject: Add toggles to avatar dropdown for hear sound or voice from avatar. (#2518, #2519) --- indra/newview/llagent.cpp | 14 ++++++++++++++ indra/newview/llagent.h | 7 +++++++ indra/newview/llviewermenu.cpp | 2 ++ indra/newview/skins/default/xui/en/menu_viewer.xml | 18 ++++++++++++++++++ 4 files changed, 41 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index c4336758ac..7c37cc1c00 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -355,6 +355,20 @@ bool LLAgent::isMicrophoneOn(const LLSD& sdname) return LLVoiceClient::getInstance()->getUserPTTState(); } +//static +void LLAgent::toggleHearMediaSoundFromAvatar() +{ + const S32 mediaSoundsEarLocation = gSavedSettings.getS32("MediaSoundsEarLocation"); + gSavedSettings.setS32("MediaSoundsEarLocation", !mediaSoundsEarLocation); +} + +//static +void LLAgent::toggleHearVoiceFromAvatar() +{ + const S32 voiceEarLocation = gSavedSettings.getS32("VoiceEarLocation"); + gSavedSettings.setS32("VoiceEarLocation", !voiceEarLocation); +} + // ************************************************************ // Enabled this definition to compile a 'hacked' viewer that // locally believes the end user has godlike powers. diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 8f892025c9..7c7f7aa91d 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -374,6 +374,13 @@ public: private: bool mVoiceConnected; + //-------------------------------------------------------------------- + // Sound + //-------------------------------------------------------------------- +public: + static void toggleHearMediaSoundFromAvatar(); + static void toggleHearVoiceFromAvatar(); + //-------------------------------------------------------------------- // Chat //-------------------------------------------------------------------- diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 344a9737b1..d8c4e03d93 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -9757,6 +9757,8 @@ void initialize_menus() commit.add("Agent.ToggleMicrophone", boost::bind(&LLAgent::toggleMicrophone, _2)); enable.add("Agent.IsMicrophoneOn", boost::bind(&LLAgent::isMicrophoneOn, _2)); enable.add("Agent.IsActionAllowed", boost::bind(&LLAgent::isActionAllowed, _2)); + commit.add("Agent.ToggleHearMediaSoundFromAvatar", boost::bind(&LLAgent::toggleHearMediaSoundFromAvatar)); + commit.add("Agent.ToggleHearVoiceFromAvatar", boost::bind(&LLAgent::toggleHearVoiceFromAvatar)); // File menu init_menu_file(); diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 7fe9d0efe5..324e868bd5 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -465,6 +465,24 @@ + + + + + + + + +