From 8602c5827caf40b654e9a6fed0d345fb0eee610b Mon Sep 17 00:00:00 2001 From: maxim_productengine Date: Mon, 25 Jun 2018 18:51:34 +0300 Subject: MAINT-8457 FIXED "Mute" switching cancels the volume settings of Nearby Media --- indra/newview/llpanelnearbymedia.cpp | 6 +++--- indra/newview/llviewermedia.cpp | 15 +++++++++++++++ indra/newview/llviewermedia.h | 2 ++ 3 files changed, 20 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpanelnearbymedia.cpp b/indra/newview/llpanelnearbymedia.cpp index d8ef5b39ad..f3a2ed9408 100644 --- a/indra/newview/llpanelnearbymedia.cpp +++ b/indra/newview/llpanelnearbymedia.cpp @@ -1168,12 +1168,12 @@ void LLPanelNearByMedia::onClickSelectedMediaMute() F32 volume = impl->getVolume(); if(volume > 0.0) { - impl->setVolume(0.0); + impl->setMute(true); } else if (mVolumeSlider->getValueF32() == 0.0) { - impl->setVolume(1.0); - mVolumeSlider->setValue(1.0); + impl->setMute(false); + mVolumeSlider->setValue(impl->getVolume()); } else { diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 4334cbfda3..22a21c9ca3 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -1555,6 +1555,7 @@ LLViewerMediaImpl::LLViewerMediaImpl( const LLUUID& texture_id, mNavigateServerRequest(false), mMediaSourceFailed(false), mRequestedVolume(1.0f), + mPreviousVolume(1.0f), mIsMuted(false), mNeedsMuteCheck(false), mPreviousMediaState(MEDIA_NONE), @@ -2081,6 +2082,20 @@ void LLViewerMediaImpl::setVolume(F32 volume) updateVolume(); } +////////////////////////////////////////////////////////////////////////////////////////// +void LLViewerMediaImpl::setMute(bool mute) +{ + if (mute) + { + mPreviousVolume = mRequestedVolume; + setVolume(0.0); + } + else + { + setVolume(mPreviousVolume); + } +} + ////////////////////////////////////////////////////////////////////////////////////////// void LLViewerMediaImpl::updateVolume() { diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h index c52960dfcf..e2e758befb 100644 --- a/indra/newview/llviewermedia.h +++ b/indra/newview/llviewermedia.h @@ -216,6 +216,7 @@ public: void skipBack(F32 step_scale); void skipForward(F32 step_scale); void setVolume(F32 volume); + void setMute(bool mute); void updateVolume(); F32 getVolume(); void focus(bool focus); @@ -448,6 +449,7 @@ private: bool mNavigateServerRequest; bool mMediaSourceFailed; F32 mRequestedVolume; + F32 mPreviousVolume; bool mIsMuted; bool mNeedsMuteCheck; int mPreviousMediaState; -- cgit v1.2.3