summaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2015-11-28 21:55:21 +0000
committerGerd Hoffmann <kraxel@redhat.com>2015-12-15 11:08:11 +0100
commit624d1fc30fd64e082880ca21cae5fadb67d05c64 (patch)
treeaf22add586fa22da66dcb0d721fa4ce1717a5557 /audio
parent88a0f8300b7478d4b9cf3d6679e9f8f7f0db4b0d (diff)
downloadqemu-624d1fc30fd64e082880ca21cae5fadb67d05c64.tar.gz
qemu-624d1fc30fd64e082880ca21cae5fadb67d05c64.tar.bz2
qemu-624d1fc30fd64e082880ca21cae5fadb67d05c64.zip
audio/coreaudio.c: Use new-in-OSX-10.6 API for getting default voice
If we're building for OSX 10.6 or better, use the new API AudioObjectGetPropertyData for getting the default voice. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1448747724-15572-3-git-send-email-peter.maydell@linaro.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'audio')
-rw-r--r--audio/coreaudio.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/audio/coreaudio.c b/audio/coreaudio.c
index 433e009db5..2211e17998 100644
--- a/audio/coreaudio.c
+++ b/audio/coreaudio.c
@@ -32,6 +32,10 @@
#define AUDIO_CAP "coreaudio"
#include "audio_int.h"
+#ifndef MAC_OS_X_VERSION_10_6
+#define MAC_OS_X_VERSION_10_6 1060
+#endif
+
static int isAtexit;
typedef struct {
@@ -50,6 +54,28 @@ typedef struct coreaudioVoiceOut {
int rpos;
} coreaudioVoiceOut;
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+/* The APIs used here only become available from 10.6 */
+
+static OSStatus coreaudio_get_voice(AudioDeviceID *id)
+{
+ UInt32 size = sizeof(*id);
+ AudioObjectPropertyAddress addr = {
+ kAudioHardwarePropertyDefaultOutputDevice,
+ kAudioObjectPropertyScopeGlobal,
+ kAudioObjectPropertyElementMaster
+ };
+
+ return AudioObjectGetPropertyData(kAudioObjectSystemObject,
+ &addr,
+ 0,
+ NULL,
+ &size,
+ id);
+}
+#else
+/* Legacy versions of functions using deprecated APIs */
+
static OSStatus coreaudio_get_voice(AudioDeviceID *id)
{
UInt32 size = sizeof(*id);
@@ -59,6 +85,7 @@ static OSStatus coreaudio_get_voice(AudioDeviceID *id)
&size,
id);
}
+#endif
static void coreaudio_logstatus (OSStatus status)
{