diff options
author | Tofu Linden <tofu.linden@lindenlab.com> | 2010-01-28 12:48:48 -0800 |
---|---|---|
committer | Tofu Linden <tofu.linden@lindenlab.com> | 2010-01-28 12:48:48 -0800 |
commit | 5a34cf1af83314774f11b0d24279794794bc9147 (patch) | |
tree | 720b576c642646f27d3e5b4f7ccba91b9e708371 /indra/newview/llappviewermacosx.cpp | |
parent | 2795661869e3dbbfe1e6becec1d6bb3635eafd3b (diff) | |
parent | fc8e185fafcfea1ead8b9c064ed38d5ac65f81b6 (diff) |
Merge from viewer2 trunk.
Diffstat (limited to 'indra/newview/llappviewermacosx.cpp')
-rw-r--r-- | indra/newview/llappviewermacosx.cpp | 54 |
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; |