diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/app_settings/settings.xml | 38 | ||||
-rw-r--r-- | indra/newview/llvoicevivox.cpp | 48 | ||||
-rw-r--r-- | indra/newview/llvoicevivox.h | 9 |
3 files changed, 75 insertions, 20 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 626a3d1ff3..bedf8a7bfe 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -14425,7 +14425,43 @@ <key>Value</key> <integer>44125</integer> </map> - <key>VoiceCallsFriendsOnly</key> + + + <key>VivoxVadHangover</key> + <map> + <key>Comment</key> + <string>The time (in milliseconds) that it takes or the VAD to switch back to silence from speech mode after the last speech frame has been detected</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>U32</string> + <key>Value</key> + <integer>2000</integer> + </map> + <key>VivoxVadNoiseFloor</key> + <map> + <key>Comment</key> + <string>A dimensionless value between 0 and 20000 (default 576) that controls the maximum level at which the noise floor may be set at by the VAD's noise tracking</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>U32</string> + <key>Value</key> + <integer>576</integer> + </map> + <key>VivoxVadSensitivity</key> + <map> + <key>Comment</key> + <string> + A dimensionless value between 0 and 100, indicating the 'sensitivity of the VAD'. Increasing this value corresponds to decreasing the sensitivity of the VAD</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>U32</string> + <key>Value</key> + <integer>40</integer> + </map> + <key>VoiceCallsFriendsOnly</key> <map> <key>Comment</key> <string>(Deprecated) Only accept voice calls from residents on your friends list</string> diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index fa4504de62..f2115feb10 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -651,7 +651,6 @@ void LLVivoxVoiceClient::idle(void* user_data) { } - //========================================================================= // the following are methods to support the coroutine implementation of the // voice connection and processing. They should only be called in the context @@ -683,13 +682,18 @@ void LLVivoxVoiceClient::voiceControlCoro() bool success = startAndConnectSession(); if (success) { - // disable the automatic VAD and explicitly set the VAD variables ourselves - // see SL-15072 for more details - unsigned int vad_hangover = 2001; - unsigned int vad_noise_floor = 577; - unsigned int vad_sensitivity = 44; + // disable the automatic VAD and explicitly set the initial values of + // the VAD variables ourselves see SL-15072 for more details + unsigned int vad_hangover = gSavedSettings.getU32("VivoxVadHangover"); + unsigned int vad_noise_floor = gSavedSettings.getU32("VivoxVadNoiseFloor"); + unsigned int vad_sensitivity = gSavedSettings.getU32("VivoxVadSensitivity"); setupVADParams(vad_hangover, vad_noise_floor, vad_sensitivity); + // watch for changes to the VAD settings via Debug Settings UI and act on them accordingly + gSavedSettings.getControl("VivoxVadHangover")->getSignal()->connect(boost::bind(&LLVivoxVoiceClient::onVADSettingsChange, this)); + gSavedSettings.getControl("VivoxVadNoiseFloor")->getSignal()->connect(boost::bind(&LLVivoxVoiceClient::onVADSettingsChange, this)); + gSavedSettings.getControl("VivoxVadSensitivity")->getSignal()->connect(boost::bind(&LLVivoxVoiceClient::onVADSettingsChange, this)); + if (mTuningMode) { performMicTuning(); @@ -737,7 +741,6 @@ void LLVivoxVoiceClient::voiceControlCoro() LL_INFOS("Voice") << "exiting" << LL_ENDL; } - bool LLVivoxVoiceClient::startAndConnectSession() { bool ok = false; @@ -3264,8 +3267,8 @@ void LLVivoxVoiceClient::setupVADParams(unsigned int vad_hangover, stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetVadProperties.1\">" << "<VadAuto>" << vad_auto_enabled << "</VadAuto>" << "<VadHangover>" << vad_hangover << "</VadHangover>" - << "<vad_noise_floor>" << vad_hangover << "</vad_noise_floor>" - << "<vad_sensitivity>" << vad_hangover << "</vad_sensitivity>" + << "<VadSensitivity>" << vad_sensitivity << "</VadSensitivity>" + << "<VadNoiseFloor>" << vad_noise_floor << "</VadNoiseFloor>" << "</Request>\n\n\n"; if (!stream.str().empty()) @@ -3274,6 +3277,17 @@ void LLVivoxVoiceClient::setupVADParams(unsigned int vad_hangover, } } +void LLVivoxVoiceClient::onVADSettingsChange() +{ + // pick up the VAD variables (one of which was changed) + unsigned int vad_hangover = gSavedSettings.getU32("VivoxVadHangover"); + unsigned int vad_noise_floor = gSavedSettings.getU32("VivoxVadNoiseFloor"); + unsigned int vad_sensitivity = gSavedSettings.getU32("VivoxVadSensitivity"); + + // build a VAD params change request and send it to SLVoice + setupVADParams(vad_hangover, vad_noise_floor, vad_sensitivity); +} + ///////////////////////////// // Response/Event handlers @@ -7628,13 +7642,15 @@ void LLVivoxProtocolParser::processResponse(std::string tag) } else if (!stricmp(actionCstr, "Aux.SetVadProperties.1")) { - // temporary for debugging- will eventually remove entirely or replace with a - // toast message to alert the user that it was set - std::cout << "@@@" << std::endl; - std::cout << " Response for Aux.SetVadProperties.1 was" << std::endl; - std::cout << " statusCode: " << statusCode << std::endl; - std::cout << " statusString: " << statusString << std::endl; - std::cout << "@@@" << std::endl; + // both values of statusCode (old and more recent) indicate valid requests + if (statusCode != 0 && statusCode != 200) + { + LL_WARNS("Voice") << "Aux.SetVadProperties.1 request failed: " + << "statusCode: " << statusCode + << " and " + << "statusString: " << statusString + << LL_ENDL; + } } /* else if (!stricmp(actionCstr, "Account.ChannelGetList.1")) diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h index 7985eae6e4..960030659d 100644 --- a/indra/newview/llvoicevivox.h +++ b/indra/newview/llvoicevivox.h @@ -446,9 +446,6 @@ protected: // local audio updates, mic mute, speaker mute, mic volume and speaker volumes void sendLocalAudioUpdates(); - // disable auto-VAD and configure VAD parameters explicitly - void LLVivoxVoiceClient::setupVADParams(unsigned int vad_hangover, unsigned int vad_noise_floor, unsigned int vad_sensitivity); - ///////////////////////////// // Response/Event handlers void connectorCreateResponse(int statusCode, std::string &statusString, std::string &connectorHandle, std::string &versionID); @@ -475,6 +472,12 @@ protected: void muteListChanged(); ///////////////////////////// + // VAD changes + // disable auto-VAD and configure VAD parameters explicitly + void setupVADParams(unsigned int vad_hangover, unsigned int vad_noise_floor, unsigned int vad_sensitivity); + void onVADSettingsChange(); + + ///////////////////////////// // Sending updates of current state void updatePosition(void); void setCameraPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot); |