summaryrefslogtreecommitdiff
path: root/indra/newview/llvoiceclient.cpp
diff options
context:
space:
mode:
authorAdam Moss <moss@lindenlab.com>2008-02-26 18:28:52 +0000
committerAdam Moss <moss@lindenlab.com>2008-02-26 18:28:52 +0000
commit6027ad2630b8650cabcf00628ee9b0d25bedd67f (patch)
treeac3725af83ec4b998d13b0f7e5698412fd297032 /indra/newview/llvoiceclient.cpp
parent03337b9142305a8d0b8744505c498ae19dd4c9a2 (diff)
QAR-279 Improved Voice volume management & Linux Voice
Featuring: DEV-9505 Working device enumeration A.K.A. USB headset support DEV-9727 Linux Voice quality issues in 1.19.0 DEV-10802 Change the way local output volume is handled And Vivox SDK updates all-round. svn merge -c80652 svn+ssh://svn.lindenlab.com/svn/linden/qa/qar-279 .
Diffstat (limited to 'indra/newview/llvoiceclient.cpp')
-rw-r--r--indra/newview/llvoiceclient.cpp26
1 files changed, 23 insertions, 3 deletions
diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp
index 48b8ea8c60..69e08db2bf 100644
--- a/indra/newview/llvoiceclient.cpp
+++ b/indra/newview/llvoiceclient.cpp
@@ -2286,10 +2286,19 @@ void LLVoiceClient::tuningSetMicVolume(float volume)
void LLVoiceClient::tuningSetSpeakerVolume(float volume)
{
- int scaledVolume = ((int)(volume * 100.0f)) - 100;
+ // incoming volume has the range [0.0 ... 1.0], with 0.5 as the default.
+ // Map it as follows: 0.0 -> -100, 0.5 -> 24, 1.0 -> 50
+
+ volume -= 0.5f; // offset volume to the range [-0.5 ... 0.5], with 0 at the default.
+ int scaledVolume = 24; // offset scaledVolume by its default level
+ if(volume < 0.0f)
+ scaledVolume += ((int)(volume * 248.0f)); // (24 - (-100)) * 2
+ else
+ scaledVolume += ((int)(volume * 52.0f)); // (50 - 24) * 2
+
if(scaledVolume != mTuningSpeakerVolume)
{
- mTuningSpeakerVolume = ((int)(volume * 100.0f)) - 100;
+ mTuningSpeakerVolume = scaledVolume;
mTuningSpeakerVolumeDirty = true;
}
}
@@ -3690,7 +3699,18 @@ void LLVoiceClient::setEarLocation(S32 loc)
void LLVoiceClient::setVoiceVolume(F32 volume)
{
- int scaledVolume = ((int)(volume * 100.0f)) - 100;
+// llinfos << "volume is " << volume << llendl;
+
+ // incoming volume has the range [0.0 ... 1.0], with 0.5 as the default.
+ // Map it as follows: 0.0 -> -100, 0.5 -> 24, 1.0 -> 50
+
+ volume -= 0.5f; // offset volume to the range [-0.5 ... 0.5], with 0 at the default.
+ int scaledVolume = 24; // offset scaledVolume by its default level
+ if(volume < 0.0f)
+ scaledVolume += ((int)(volume * 248.0f)); // (24 - (-100)) * 2
+ else
+ scaledVolume += ((int)(volume * 52.0f)); // (50 - 24) * 2
+
if(scaledVolume != mSpeakerVolume)
{
if((scaledVolume == -100) || (mSpeakerVolume == -100))