summaryrefslogtreecommitdiff
path: root/indra/newview/llappviewermacosx.cpp
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2010-02-03 14:13:56 -0800
committerJames Cook <james@lindenlab.com>2010-02-03 14:13:56 -0800
commit88350edbcbec615f3b15fc82bd5ce4005621ac6f (patch)
treec244f41159cf32f3e03c6c311e1453bbd383bad5 /indra/newview/llappviewermacosx.cpp
parentd489216b6ef41f0d22f3a9062ba6daacc67bc038 (diff)
parent0bee31de32cb5999e7ec06d74f55d34ce0ac052b (diff)
merge
Diffstat (limited to 'indra/newview/llappviewermacosx.cpp')
-rw-r--r--indra/newview/llappviewermacosx.cpp54
1 files changed, 54 insertions, 0 deletions
diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp
index 1282e437f2..f8f8f50cd6 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
@@ -444,6 +445,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;