From dadca1e1b993208ac1092c28083bcfca10a6a72a Mon Sep 17 00:00:00 2001 From: Lynx Linden Date: Wed, 13 Jan 2010 13:37:55 +0000 Subject: EXT-3611: Corrected the volume squares in Sound Prefs. You should now be able to light up the 5th square on the I/O sound devices panel of the preferences floater. --- indra/newview/llfloatervoicedevicesettings.cpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'indra/newview/llfloatervoicedevicesettings.cpp') diff --git a/indra/newview/llfloatervoicedevicesettings.cpp b/indra/newview/llfloatervoicedevicesettings.cpp index 43024a4bd0..d3ef17d402 100644 --- a/indra/newview/llfloatervoicedevicesettings.cpp +++ b/indra/newview/llfloatervoicedevicesettings.cpp @@ -110,21 +110,13 @@ void LLPanelVoiceDeviceSettings::draw() LLPanel::draw(); - F32 voice_power = gVoiceClient->tuningGetEnergy(); - S32 discrete_power = 0; - - if (!is_in_tuning_mode) - { - discrete_power = 0; - } - else - { - discrete_power = llmin(4, llfloor((voice_power / LLVoiceClient::OVERDRIVEN_POWER_LEVEL) * 4.f)); - } - if (is_in_tuning_mode) { - for(S32 power_bar_idx = 0; power_bar_idx < 5; power_bar_idx++) + const S32 num_bars = 5; + F32 voice_power = gVoiceClient->tuningGetEnergy() / LLVoiceClient::OVERDRIVEN_POWER_LEVEL; + S32 discrete_power = llmin(num_bars, llfloor(voice_power * (F32)num_bars + 0.1f)); + + for(S32 power_bar_idx = 0; power_bar_idx < num_bars; power_bar_idx++) { std::string view_name = llformat("%s%d", "bar", power_bar_idx); LLView* bar_view = getChild(view_name); -- cgit v1.2.3 From db2321bad296dd82af300e6bfdd50b5d232af067 Mon Sep 17 00:00:00 2001 From: Lynx Linden Date: Wed, 13 Jan 2010 15:15:57 +0000 Subject: EXT-4220: Fix crash on exit bug. Don't dereference gVoiceClient without checking for NULL in the cleanup for LLPanelVoiceDeviceSettings. I also fixed the rendering of the color squares in the voice device settings. The frame for these boxes were rendered with an off-by-one error on certain platforms. It seems that gl_box_2d(rect, color, FALSE) suffers from a graphics driver bug under certain platforms. Fixing that would requiring a lot of testing on different hardware configurations, so instead I simlply avoided that specific call. --- indra/newview/llfloatervoicedevicesettings.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'indra/newview/llfloatervoicedevicesettings.cpp') diff --git a/indra/newview/llfloatervoicedevicesettings.cpp b/indra/newview/llfloatervoicedevicesettings.cpp index d3ef17d402..638c9f1b8c 100644 --- a/indra/newview/llfloatervoicedevicesettings.cpp +++ b/indra/newview/llfloatervoicedevicesettings.cpp @@ -122,12 +122,21 @@ void LLPanelVoiceDeviceSettings::draw() LLView* bar_view = getChild(view_name); if (bar_view) { + gl_rect_2d(bar_view->getRect(), LLColor4::grey, TRUE); + + LLColor4 color; if (power_bar_idx < discrete_power) { - LLColor4 color = (power_bar_idx >= 3) ? LLUIColorTable::instance().getColor("OverdrivenColor") : LLUIColorTable::instance().getColor("SpeakingColor"); - gl_rect_2d(bar_view->getRect(), color, TRUE); + color = (power_bar_idx >= 3) ? LLUIColorTable::instance().getColor("OverdrivenColor") : LLUIColorTable::instance().getColor("SpeakingColor"); + } + else + { + color = LLUIColorTable::instance().getColor("PanelFocusBackgroundColor"); } - gl_rect_2d(bar_view->getRect(), LLColor4::grey, FALSE); + + LLRect color_rect = bar_view->getRect(); + color_rect.stretch(-1); + gl_rect_2d(color_rect, color, TRUE); } } } @@ -268,7 +277,10 @@ void LLPanelVoiceDeviceSettings::initialize() void LLPanelVoiceDeviceSettings::cleanup() { - gVoiceClient->tuningStop(); + if (gVoiceClient) + { + gVoiceClient->tuningStop(); + } LLVoiceChannel::resume(); } -- cgit v1.2.3