From 6027ad2630b8650cabcf00628ee9b0d25bedd67f Mon Sep 17 00:00:00 2001 From: Adam Moss Date: Tue, 26 Feb 2008 18:28:52 +0000 Subject: 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 . --- indra/newview/llvoiceclient.cpp | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'indra/newview/llvoiceclient.cpp') 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)) -- cgit v1.2.3