From 4f38dd26825a3c9f92a6608b4b37ede71808bc30 Mon Sep 17 00:00:00 2001
From: Aimee Linden <aimee@lindenlab.com>
Date: Sun, 25 Apr 2010 12:42:10 +0100
Subject: 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().
---
 indra/newview/llappviewermacosx.cpp | 31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)

(limited to 'indra/newview')

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;
-- 
cgit v1.2.3