From d3f361752e5988800228cff11fcc50289b2f88c7 Mon Sep 17 00:00:00 2001 From: Rick Pasetto Date: Wed, 27 Jan 2010 14:00:02 -0800 Subject: Plumb getting and setting the system audio mute through appviewer Next step is to actually implement the OS-specific calls to do so. Until then, behavior is the same; the status bar will mute/unmute the "master" audio for the viewer *only* --- indra/newview/llappviewer.cpp | 14 +++++++++++++- indra/newview/llappviewer.h | 4 ++++ indra/newview/llappviewermacosx.cpp | 14 ++++++++++++++ indra/newview/llappviewermacosx.h | 3 +++ indra/newview/llstatusbar.cpp | 6 +++--- 5 files changed, 37 insertions(+), 4 deletions(-) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 0e248ff88b..9aa15789ed 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -2685,7 +2685,7 @@ void LLAppViewer::handleViewerCrash() gMessageSystem->stopLogging(); } - LLWorld::getInstance()->getInfo(gDebugInfo); + if (LLWorld::instanceExists()) LLWorld::getInstance()->getInfo(gDebugInfo); // Close the debug file pApp->writeDebugInfo(); @@ -4405,3 +4405,15 @@ void LLAppViewer::launchUpdater() // LLAppViewer::instance()->forceQuit(); } + +//virtual +void LLAppViewer::setMasterSystemAudioMute(bool mute) +{ + gSavedSettings.setBOOL("MuteAudio", mute); +} + +//virtual +bool LLAppViewer::getMasterSystemAudioMute() +{ + return gSavedSettings.getBOOL("MuteAudio"); +} diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 40e74061b5..a011c5ebfd 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -168,6 +168,10 @@ public: void purgeCache(); // Clear the local cache. + // mute/unmute the system's master audio + virtual void setMasterSystemAudioMute(bool mute); + virtual bool getMasterSystemAudioMute(); + protected: virtual bool initWindow(); // Initialize the viewer's window. virtual bool initLogging(); // Initialize log files, logging system, return false on failure. diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp index 1282e437f2..cc38a0940c 100644 --- a/indra/newview/llappviewermacosx.cpp +++ b/indra/newview/llappviewermacosx.cpp @@ -444,6 +444,20 @@ std::string LLAppViewerMacOSX::generateSerialNumber() return serial_md5; } +//virtual +void LLAppViewerMacOSX::setMasterSystemAudioMute(bool mute) +{ + // XXX TODO: make this actually set the OS's audio mute state + gSavedSettings.setBOOL("MuteAudio", mute); +} + +//virtual +bool LLAppViewerMacOSX::getMasterSystemAudioMute() +{ + // XXX TODO: make this actually get the OS's audio mute state + return gSavedSettings.getBOOL("MuteAudio"); +} + OSErr AEGURLHandler(const AppleEvent *messagein, AppleEvent *reply, long refIn) { OSErr result = noErr; diff --git a/indra/newview/llappviewermacosx.h b/indra/newview/llappviewermacosx.h index bc841fc3a7..cbf7e6c209 100644 --- a/indra/newview/llappviewermacosx.h +++ b/indra/newview/llappviewermacosx.h @@ -48,6 +48,9 @@ public: // virtual bool init(); // Override to do application initialization + // mute/unmute the system's master audio + virtual void setMasterSystemAudioMute(bool mute); + virtual bool getMasterSystemAudioMute(); protected: virtual bool restoreErrorTrap(); diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 8a36475510..bff32af228 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -354,7 +354,7 @@ void LLStatusBar::refresh() childSetEnabled("stat_btn", net_stats_visible); // update the master volume button state - BOOL mute_audio = gSavedSettings.getBOOL("MuteAudio"); + bool mute_audio = LLAppViewer::instance()->getMasterSystemAudioMute(); mBtnVolume->setToggleState(mute_audio); } @@ -523,8 +523,8 @@ void LLStatusBar::onMouseEnterVolume(LLUICtrl* ctrl) static void onClickVolume(void* data) { // toggle the master mute setting - BOOL mute_audio = gSavedSettings.getBOOL("MuteAudio"); - gSavedSettings.setBOOL("MuteAudio", !mute_audio); + bool mute_audio = LLAppViewer::instance()->getMasterSystemAudioMute(); + LLAppViewer::instance()->setMasterSystemAudioMute(!mute_audio); } // sets the static variables necessary for the date -- cgit v1.2.3