diff options
author | Yu Ning <yu.ning@intel.com> | 2015-04-23 17:01:38 +0800 |
---|---|---|
committer | Yu Ning <yu.ning@intel.com> | 2015-04-28 17:59:54 +0800 |
commit | a50f6cf6dd6e924cb1e5648176ff4e23af26834f (patch) | |
tree | a0afe38f96d7ce93662c09f5b6e422be78318be2 | |
parent | b6acf13d152b3326e8d985684500cf1d1ad0ca00 (diff) | |
download | qemu-android-a50f6cf6dd6e924cb1e5648176ff4e23af26834f.tar.gz |
audio: Add winaudio as an alternative audio backend for Windows
QEMU's default audio backend for Windows, winwave, does not work well
with the goldfish audio device when audio input is enabled. The classic
Android emulator does not use winwave, but introduces its own Windows
audio backend called winaudio. This patch adapts winaudio for QEMU 2.x
and makes it available as an alternative audio backend for Windows.
Change-Id: I2da855957035b6d95bdf6e0044a3e807b769abf2
Signed-off-by: Yu Ning <yu.ning@intel.com>
-rw-r--r-- | audio/Makefile.objs | 1 | ||||
-rw-r--r-- | audio/audio_int.h | 1 | ||||
-rw-r--r-- | audio/winaudio.c | 37 | ||||
-rwxr-xr-x | configure | 6 |
4 files changed, 28 insertions, 17 deletions
diff --git a/audio/Makefile.objs b/audio/Makefile.objs index 26a0ac9507..b495cb4c19 100644 --- a/audio/Makefile.objs +++ b/audio/Makefile.objs @@ -9,6 +9,7 @@ common-obj-$(CONFIG_FMOD) += fmodaudio.o common-obj-$(CONFIG_ESD) += esdaudio.o common-obj-$(CONFIG_PA) += paaudio.o common-obj-$(CONFIG_WINWAVE) += winwaveaudio.o +common-obj-$(CONFIG_WINAUDIO) += winaudio.o common-obj-$(CONFIG_AUDIO_PT_INT) += audio_pt_int.o common-obj-$(CONFIG_AUDIO_WIN_INT) += audio_win_int.o common-obj-y += wavcapture.o diff --git a/audio/audio_int.h b/audio/audio_int.h index fd019a0fc3..031eb6e00f 100644 --- a/audio/audio_int.h +++ b/audio/audio_int.h @@ -214,6 +214,7 @@ extern struct audio_driver esd_audio_driver; extern struct audio_driver pa_audio_driver; extern struct audio_driver spice_audio_driver; extern struct audio_driver winwave_audio_driver; +extern struct audio_driver winaudio_audio_driver; extern const struct mixeng_volume nominal_volume; void audio_pcm_init_info (struct audio_pcm_info *info, struct audsettings *as); diff --git a/audio/winaudio.c b/audio/winaudio.c index faaffb75fa..e4fea22c55 100644 --- a/audio/winaudio.c +++ b/audio/winaudio.c @@ -2,6 +2,7 @@ * QEMU "simple" Windows audio driver * * Copyright (c) 2007 The Android Open Source Project + * Copyright (c) 2015 Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -21,13 +22,17 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -#define WIN32_LEAN_AND_MEAN -#include <windows.h> -#include <mmsystem.h> + +#include "qemu-common.h" +#include "sysemu/sysemu.h" +#include "audio.h" #define AUDIO_CAP "winaudio" #include "audio_int.h" +#include <windows.h> +#include <mmsystem.h> + /* define DEBUG to 1 to dump audio debugging info at runtime to stderr */ #define DEBUG 0 @@ -544,7 +549,7 @@ winaudio_in_run (HWVoiceIn *hw) __FUNCTION__, s->read_index, s->read_pos, s->read_size, wav_samples, wav_bytes, live, hw->wpos, hw->samples); - hw->conv(dst, src, wav_samples, &nominal_volume); + hw->conv(dst, src, wav_samples); hw->wpos += wav_samples; if (hw->wpos >= hw->samples) @@ -650,16 +655,16 @@ static struct audio_pcm_ops winaudio_pcm_ops = { winaudio_in_ctl }; -struct audio_driver win_audio_driver = { - INIT_FIELD (name = ) "winaudio", - INIT_FIELD (descr = ) "Windows wave audio", - INIT_FIELD (options = ) winaudio_options, - INIT_FIELD (init = ) winaudio_init, - INIT_FIELD (fini = ) winaudio_fini, - INIT_FIELD (pcm_ops = ) &winaudio_pcm_ops, - INIT_FIELD (can_be_default = ) 1, - INIT_FIELD (max_voices_out = ) 1, - INIT_FIELD (max_voices_in = ) 1, - INIT_FIELD (voice_size_out = ) sizeof (WinAudioOut), - INIT_FIELD (voice_size_in = ) sizeof (WinAudioIn) +struct audio_driver winaudio_audio_driver = { + .name = "winaudio", + .descr = "Windows wave audio", + .options = winaudio_options, + .init = winaudio_init, + .fini = winaudio_fini, + .pcm_ops = &winaudio_pcm_ops, + .can_be_default = 1, + .max_voices_out = 1, + .max_voices_in = 1, + .voice_size_out = sizeof (WinAudioOut), + .voice_size_in = sizeof (WinAudioIn) }; @@ -560,7 +560,7 @@ CYGWIN*) ;; MINGW32*) mingw32="yes" - audio_possible_drivers="winwave dsound sdl fmod" + audio_possible_drivers="winwave dsound sdl fmod winaudio" audio_drv_list="winwave" ;; GNU/kFreeBSD) @@ -2579,6 +2579,10 @@ for drv in $audio_drv_list; do audio_win_int="yes" ;; + winaudio) + libs_softmmu="-lwinmm $libs_softmmu" + ;; + *) echo "$audio_possible_drivers" | grep -q "\<$drv\>" || { error_exit "Unknown driver '$drv' selected" \ |