summaryrefslogtreecommitdiff
path: root/indra/newview/llappviewermacosx.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llappviewermacosx.cpp')
-rw-r--r--indra/newview/llappviewermacosx.cpp61
1 files changed, 60 insertions, 1 deletions
diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp
index 1282e437f2..80d9b14345 100644
--- a/indra/newview/llappviewermacosx.cpp
+++ b/indra/newview/llappviewermacosx.cpp
@@ -50,6 +50,7 @@
#include <Carbon/Carbon.h>
#include "lldir.h"
#include <signal.h>
+#include <CoreAudio/CoreAudio.h> // for systemwide mute
class LLMediaCtrl; // for LLURLDispatcher
namespace
@@ -391,7 +392,12 @@ void LLAppViewerMacOSX::handleCrashReporting(bool reportFreeze)
_exit(1);
}
- // TODO:palmer REMOVE THIS VERY SOON. THIS WILL NOT BE IN VIEWER 2.0
+ // TODO from palmer: Find a better way to handle managing old crash logs
+ // when this is a separate imbedable module. Ideally just sort crash stack
+ // logs based on date, and grab the latest one as opposed to deleting them
+ // for thoughts on what the module would look like.
+ // See: https://wiki.lindenlab.com/wiki/Viewer_Crash_Reporter_Round_4
+
// Remove the crash stack log from previous executions.
// Since we've started logging a new instance of the app, we can assume
// The old crash stack is invalid for the next crash report.
@@ -444,6 +450,59 @@ std::string LLAppViewerMacOSX::generateSerialNumber()
return serial_md5;
}
+static AudioDeviceID get_default_audio_output_device(void)
+{
+ AudioDeviceID device = 0;
+ UInt32 size;
+ OSStatus err;
+
+ size = sizeof(device);
+ err = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, &size, &device);
+ if(err != noErr)
+ {
+ LL_DEBUGS("SystemMute") << "Couldn't get default audio output device (0x" << std::hex << err << ")" << LL_ENDL;
+ }
+
+ return device;
+}
+
+//virtual
+void LLAppViewerMacOSX::setMasterSystemAudioMute(bool new_mute)
+{
+ AudioDeviceID device = get_default_audio_output_device();
+
+ if(device != 0)
+ {
+ UInt32 mute = new_mute;
+ OSStatus err = AudioDeviceSetProperty(device, NULL, 0, false, kAudioDevicePropertyMute, sizeof(mute), &mute);
+ if(err != noErr)
+ {
+ LL_INFOS("SystemMute") << "Couldn't set audio mute property (0x" << std::hex << err << ")" << LL_ENDL;
+ }
+ }
+}
+
+//virtual
+bool LLAppViewerMacOSX::getMasterSystemAudioMute()
+{
+ // Assume the system isn't muted
+ UInt32 mute = 0;
+
+ AudioDeviceID device = get_default_audio_output_device();
+
+ if(device != 0)
+ {
+ UInt32 size = sizeof(mute);
+ OSStatus err = AudioDeviceGetProperty(device, 0, false, kAudioDevicePropertyMute, &size, &mute);
+ if(err != noErr)
+ {
+ LL_DEBUGS("SystemMute") << "Couldn't get audio mute property (0x" << std::hex << err << ")" << LL_ENDL;
+ }
+ }
+
+ return (mute != 0);
+}
+
OSErr AEGURLHandler(const AppleEvent *messagein, AppleEvent *reply, long refIn)
{
OSErr result = noErr;