[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 1/5] audio/coreaudio.c: Factor out use of AudioHardwa
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PULL 1/5] audio/coreaudio.c: Factor out use of AudioHardwareGetProperty |
Date: |
Tue, 15 Dec 2015 11:18:24 +0100 |
From: Peter Maydell <address@hidden>
The CoreAudio function AudioHardwareGetProperty has been deprecated
starting with OSX 10.6, so factor out our call to it so we can
provide an equivalent with the new APIs when they exist.
Signed-off-by: Peter Maydell <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>
---
audio/coreaudio.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/audio/coreaudio.c b/audio/coreaudio.c
index 6dfd63e..433e009 100644
--- a/audio/coreaudio.c
+++ b/audio/coreaudio.c
@@ -50,6 +50,16 @@ typedef struct coreaudioVoiceOut {
int rpos;
} coreaudioVoiceOut;
+static OSStatus coreaudio_get_voice(AudioDeviceID *id)
+{
+ UInt32 size = sizeof(*id);
+
+ return AudioHardwareGetProperty(
+ kAudioHardwarePropertyDefaultOutputDevice,
+ &size,
+ id);
+}
+
static void coreaudio_logstatus (OSStatus status)
{
const char *str = "BUG";
@@ -303,12 +313,7 @@ static int coreaudio_init_out(HWVoiceOut *hw, struct
audsettings *as,
audio_pcm_init_info (&hw->info, as);
- /* open default output device */
- propertySize = sizeof(core->outputDeviceID);
- status = AudioHardwareGetProperty(
- kAudioHardwarePropertyDefaultOutputDevice,
- &propertySize,
- &core->outputDeviceID);
+ status = coreaudio_get_voice(&core->outputDeviceID);
if (status != kAudioHardwareNoError) {
coreaudio_logerr2 (status, typ,
"Could not get default output Device\n");
--
1.8.3.1
- [Qemu-devel] [PULL 0/5] coreaudio: use new-in-OSX-10.6 APIs, cleanups., Gerd Hoffmann, 2015/12/15
- [Qemu-devel] [PULL 5/5] audio/coreaudio.c: Avoid deprecated AudioDeviceAdd/RemoveIOProc APIs, Gerd Hoffmann, 2015/12/15
- [Qemu-devel] [PULL 4/5] audio/coreaudio.c: Use new-in-OSX-10.6 APIs when available, Gerd Hoffmann, 2015/12/15
- [Qemu-devel] [PULL 2/5] audio/coreaudio.c: Use new-in-OSX-10.6 API for getting default voice, Gerd Hoffmann, 2015/12/15
- [Qemu-devel] [PULL 3/5] audio/coreaudio.c: Factor out uses of AudioDeviceGet/SetProperty, Gerd Hoffmann, 2015/12/15
- [Qemu-devel] [PULL 1/5] audio/coreaudio.c: Factor out use of AudioHardwareGetProperty,
Gerd Hoffmann <=
- Re: [Qemu-devel] [PULL 0/5] coreaudio: use new-in-OSX-10.6 APIs, cleanups., Peter Maydell, 2015/12/17