SL-15072 update. Values for VAD settings now stored in debug settings. Request successfully sent at startup and also, whenever a relevant debug setting is changed. Going to send this build to Brett to test

master
Callum Prentice 2021-04-21 12:07:18 -07:00
parent 28935a8b64
commit 5ef055fe69
3 changed files with 75 additions and 20 deletions

View File

@ -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>

View File

@ -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"))

View File

@ -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);
@ -474,6 +471,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);