From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: "John Arbuckle" <programmingkidx@gmail.com>,
"Andreas Färber" <andreas.faerber@web.de>,
"Gerd Hoffmann" <kraxel@redhat.com>,
patches@linaro.org
Subject: [Qemu-devel] [PATCH 2/5] audio/coreaudio.c: Use new-in-OSX-10.6 API for getting default voice
Date: Sat, 28 Nov 2015 21:55:21 +0000 [thread overview]
Message-ID: <1448747724-15572-3-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1448747724-15572-1-git-send-email-peter.maydell@linaro.org>
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>
---
audio/coreaudio.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/audio/coreaudio.c b/audio/coreaudio.c
index 433e009..2211e17 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)
{
--
2.6.2
next prev parent reply other threads:[~2015-11-28 21:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-28 21:55 [Qemu-devel] [PATCH 0/5] audio/coreaudio.c: Fix deprecation warnings Peter Maydell
2015-11-28 21:55 ` [Qemu-devel] [PATCH 1/5] audio/coreaudio.c: Factor out use of AudioHardwareGetProperty Peter Maydell
2015-11-28 21:55 ` Peter Maydell [this message]
2015-11-28 21:55 ` [Qemu-devel] [PATCH 3/5] audio/coreaudio.c: Factor out uses of AudioDeviceGet/SetProperty Peter Maydell
2015-11-28 21:55 ` [Qemu-devel] [PATCH 4/5] audio/coreaudio.c: Use new-in-OSX-10.6 APIs when available Peter Maydell
2015-11-28 21:55 ` [Qemu-devel] [PATCH 5/5] audio/coreaudio.c: Avoid deprecated AudioDeviceAdd/RemoveIOProc APIs Peter Maydell
2015-12-01 16:27 ` [Qemu-devel] [PATCH 0/5] audio/coreaudio.c: Fix deprecation warnings Programmingkid
2015-12-01 16:39 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1448747724-15572-3-git-send-email-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=andreas.faerber@web.de \
--cc=kraxel@redhat.com \
--cc=patches@linaro.org \
--cc=programmingkidx@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).