diff options
author | Aimee Linden <aimee@lindenlab.com> | 2010-04-25 12:42:10 +0100 |
---|---|---|
committer | Aimee Linden <aimee@lindenlab.com> | 2010-04-25 12:42:10 +0100 |
commit | 4f38dd26825a3c9f92a6608b4b37ede71808bc30 (patch) | |
tree | e1343a22b9621e63c4f6442e7d563f9e93660371 /indra | |
parent | 0cdaca2b468bbc0f6d9e7f88bd7e39f8c7c04707 (diff) |
DEV-49390 (SNOW-573): Deprecated methods for getting and setting the system audio mute on Mac
AudioHardwareGetProperty(), AudioDeviceGetProperty() and AudioDeviceSetProperty() were deprecated in the 10.5 SDK, replaced using AudioObjectGetPropertyData() and AudioObjectSetPropertyData().
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llappviewermacosx.cpp | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp index 7aeeb418f1..44ef39fb7d 100644 --- a/indra/newview/llappviewermacosx.cpp +++ b/indra/newview/llappviewermacosx.cpp @@ -452,16 +452,17 @@ std::string LLAppViewerMacOSX::generateSerialNumber() static AudioDeviceID get_default_audio_output_device(void) { AudioDeviceID device = 0; - UInt32 size; - OSStatus err; - - size = sizeof(device); - err = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, &size, &device); + UInt32 size = sizeof(device); + AudioObjectPropertyAddress device_address = { kAudioHardwarePropertyDefaultOutputDevice, + kAudioObjectPropertyScopeGlobal, + kAudioObjectPropertyElementMaster }; + + OSStatus err = AudioObjectGetPropertyData(kAudioObjectSystemObject, &device_address, 0, NULL, &size, &device); if(err != noErr) { LL_DEBUGS("SystemMute") << "Couldn't get default audio output device (0x" << std::hex << err << ")" << LL_ENDL; } - + return device; } @@ -469,11 +470,15 @@ static AudioDeviceID get_default_audio_output_device(void) 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); + AudioObjectPropertyAddress device_address = { kAudioDevicePropertyMute, + kAudioDevicePropertyScopeOutput, + kAudioObjectPropertyElementMaster }; + + OSStatus err = AudioObjectSetPropertyData(device, &device_address, 0, NULL, sizeof(mute), &mute); if(err != noErr) { LL_INFOS("SystemMute") << "Couldn't set audio mute property (0x" << std::hex << err << ")" << LL_ENDL; @@ -486,13 +491,17 @@ 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); + AudioObjectPropertyAddress device_address = { kAudioDevicePropertyMute, + kAudioDevicePropertyScopeOutput, + kAudioObjectPropertyElementMaster }; + + OSStatus err = AudioObjectGetPropertyData(device, &device_address, 0, NULL, &size, &mute); if(err != noErr) { LL_DEBUGS("SystemMute") << "Couldn't get audio mute property (0x" << std::hex << err << ")" << LL_ENDL; |