merge.
commit
28075aa324
|
|
@ -1064,11 +1064,13 @@ if (DARWIN)
|
|||
find_library(APPKIT_LIBRARY AppKit)
|
||||
find_library(COCOA_LIBRARY Cocoa)
|
||||
find_library(IOKIT_LIBRARY IOKit)
|
||||
find_library(COREAUDIO_LIBRARY CoreAudio)
|
||||
|
||||
set(viewer_LIBRARIES
|
||||
${COCOA_LIBRARY}
|
||||
${AGL_LIBRARY}
|
||||
${IOKIT_LIBRARY}
|
||||
${COREAUDIO_LIBRARY}
|
||||
)
|
||||
|
||||
# Add resource files to the project.
|
||||
|
|
|
|||
|
|
@ -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,18 +445,57 @@ std::string LLAppViewerMacOSX::generateSerialNumber()
|
|||
return serial_md5;
|
||||
}
|
||||
|
||||
//virtual
|
||||
void LLAppViewerMacOSX::setMasterSystemAudioMute(bool mute)
|
||||
static AudioDeviceID get_default_audio_output_device(void)
|
||||
{
|
||||
// XXX TODO: make this actually set the OS's audio mute state
|
||||
gSavedSettings.setBOOL("MuteAudio", mute);
|
||||
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()
|
||||
{
|
||||
// XXX TODO: make this actually get the OS's audio mute state
|
||||
return gSavedSettings.getBOOL("MuteAudio");
|
||||
// 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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue