summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOz Linden <oz@lindenlab.com>2018-04-13 20:34:10 -0400
committerOz Linden <oz@lindenlab.com>2018-04-13 20:34:10 -0400
commit73b44833a6a801a7bc72810664557e559d54575d (patch)
treee8a1582e1c65fd1cad68367474ceace422b002ab
parentd71da863c9341aeaa64ec64119601d158affe747 (diff)
VOICE-59: display human-friendly names for voice input and output devices
-rw-r--r--indra/newview/llpanelvoicedevicesettings.cpp21
-rw-r--r--indra/newview/llvoicevivox.cpp35
-rw-r--r--indra/newview/llvoicevivox.h4
3 files changed, 45 insertions, 15 deletions
diff --git a/indra/newview/llpanelvoicedevicesettings.cpp b/indra/newview/llpanelvoicedevicesettings.cpp
index 07f8045546..3dfa559dac 100644
--- a/indra/newview/llpanelvoicedevicesettings.cpp
+++ b/indra/newview/llpanelvoicedevicesettings.cpp
@@ -38,7 +38,8 @@
// Library includes (after viewer)
#include "lluictrlfactory.h"
-
+#include "llmemorystream.h"
+#include "llsdserialize.h"
static LLPanelInjector<LLPanelVoiceDeviceSettings> t_panel_group_general("panel_voice_device_settings");
static const std::string DEFAULT_DEVICE("Default");
@@ -244,7 +245,14 @@ void LLPanelVoiceDeviceSettings::refresh()
iter != LLVoiceClient::getInstance()->getCaptureDevices().end();
iter++)
{
- mCtrlInputDevices->add(getLocalizedDeviceName(*iter), *iter, ADD_BOTTOM);
+ // the devices in the list are serialized as an LLSD map
+ // deserialize to separate the display and device names
+ std::string device_names(*iter);
+ size_t len = device_names.size();
+ LLMemoryStream device_stream((U8*)device_names.c_str(), len);
+ LLSD device = LLSDSerialize::fromNotation(device_stream, len);
+
+ mCtrlInputDevices->add(getLocalizedDeviceName(device["display"]), device["device"], ADD_BOTTOM);
}
// Fix invalid input audio device preference.
@@ -264,7 +272,14 @@ void LLPanelVoiceDeviceSettings::refresh()
for(iter= LLVoiceClient::getInstance()->getRenderDevices().begin();
iter != LLVoiceClient::getInstance()->getRenderDevices().end(); iter++)
{
- mCtrlOutputDevices->add(getLocalizedDeviceName(*iter), *iter, ADD_BOTTOM);
+ // the devices in the list are serialized as an LLSD map
+ // deserialize to separate the display and device names
+ std::string device_names(*iter);
+ size_t len = device_names.size();
+ LLMemoryStream device_stream((U8*)device_names.c_str(), len);
+ LLSD device = LLSDSerialize::fromNotation(device_stream, len);
+
+ mCtrlOutputDevices->add(getLocalizedDeviceName(device["display"]), device["display"], ADD_BOTTOM);
}
// Fix invalid output audio device preference.
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index 8e46e08b14..90e106b000 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -48,6 +48,7 @@
#include "llviewercontrol.h"
#include "llappviewer.h" // for gDisconnected, gDisableVoice
#include "llprocess.h"
+#include "llsdserialize.h"
// Viewer includes
#include "llmutelist.h" // to check for muted avatars
@@ -1964,6 +1965,7 @@ bool LLVivoxVoiceClient::performMicTuning()
if (mTuningSpeakerVolumeDirty)
{
+ LL_INFOS("Voice") << "setting tuning speaker level to " << mTuningSpeakerVolume << LL_ENDL;
stream
<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetSpeakerLevel.1\">"
<< "<Level>" << mTuningSpeakerVolume << "</Level>"
@@ -2321,11 +2323,15 @@ void LLVivoxVoiceClient::clearCaptureDevices()
mCaptureDevices.clear();
}
-void LLVivoxVoiceClient::addCaptureDevice(const std::string& name)
+void LLVivoxVoiceClient::addCaptureDevice(const std::string& display_name, const std::string& device_name)
{
- LL_DEBUGS("Voice") << name << LL_ENDL;
-
- mCaptureDevices.push_back(name);
+ LL_DEBUGS("Voice") << "display: '" << display_name << "' device: '" << device_name << "'" << LL_ENDL;
+ LLSD device(LLSD::emptyMap());
+ device["display"]=display_name;
+ device["device"]=device_name;
+ std::ostringstream device_names;
+ LLSDSerialize::toNotation(device, device_names);
+ mCaptureDevices.push_back(device_names.str());
}
LLVoiceDeviceList& LLVivoxVoiceClient::getCaptureDevices()
@@ -2363,10 +2369,15 @@ void LLVivoxVoiceClient::clearRenderDevices()
mRenderDevices.clear();
}
-void LLVivoxVoiceClient::addRenderDevice(const std::string& name)
+void LLVivoxVoiceClient::addRenderDevice(const std::string& display_name, const std::string& device_name)
{
- LL_DEBUGS("Voice") << name << LL_ENDL;
- mRenderDevices.push_back(name);
+ LL_DEBUGS("Voice") << "display: '" << display_name << "' device: '" << device_name << "'" << LL_ENDL;
+ LLSD device(LLSD::emptyMap());
+ device["display"]=display_name;
+ device["device"]=device_name;
+ std::ostringstream device_names;
+ LLSDSerialize::toNotation(device, device_names);
+ mRenderDevices.push_back(device_names.str());
}
LLVoiceDeviceList& LLVivoxVoiceClient::getRenderDevices()
@@ -4022,7 +4033,7 @@ void LLVivoxVoiceClient::sessionNotificationEvent(std::string &sessionHandle, st
void LLVivoxVoiceClient::auxAudioPropertiesEvent(F32 energy)
{
- LL_DEBUGS("Voice") << "got energy " << energy << LL_ENDL;
+ LL_DEBUGS("VoiceEnergy") << "got energy " << energy << LL_ENDL;
mTuningEnergy = energy;
}
@@ -7006,16 +7017,20 @@ void LLVivoxProtocolParser::EndTag(const char *tag)
else if (!stricmp("Presence", tag))
statusString = string;
else if (!stricmp("CaptureDevices", tag))
+ {
LLVivoxVoiceClient::getInstance()->setDevicesListUpdated(true);
+ }
else if (!stricmp("RenderDevices", tag))
+ {
LLVivoxVoiceClient::getInstance()->setDevicesListUpdated(true);
+ }
else if (!stricmp("CaptureDevice", tag))
{
- LLVivoxVoiceClient::getInstance()->addCaptureDevice(deviceString);
+ LLVivoxVoiceClient::getInstance()->addCaptureDevice(displayNameString, deviceString);
}
else if (!stricmp("RenderDevice", tag))
{
- LLVivoxVoiceClient::getInstance()->addRenderDevice(deviceString);
+ LLVivoxVoiceClient::getInstance()->addRenderDevice(displayNameString, deviceString);
}
else if (!stricmp("BlockMask", tag))
blockMask = string;
diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h
index 9d4af85c8c..b4cf94444b 100644
--- a/indra/newview/llvoicevivox.h
+++ b/indra/newview/llvoicevivox.h
@@ -432,10 +432,10 @@ protected:
//----------------------------------
// devices
void clearCaptureDevices();
- void addCaptureDevice(const std::string& name);
+ void addCaptureDevice(const std::string& display_name, const std::string& device_name);
void clearRenderDevices();
void setDevicesListUpdated(bool state);
- void addRenderDevice(const std::string& name);
+ void addRenderDevice(const std::string& display_name, const std::string& device_name);
void buildSetAudioDevices(std::ostringstream &stream);
void getCaptureDevicesSendMessage();