From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KAg5A-0002g4-HB for qemu-devel@nongnu.org; Mon, 23 Jun 2008 03:03:20 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KAg58-0002fg-RT for qemu-devel@nongnu.org; Mon, 23 Jun 2008 03:03:20 -0400 Received: from [199.232.76.173] (port=37467 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KAg58-0002fV-FN for qemu-devel@nongnu.org; Mon, 23 Jun 2008 03:03:18 -0400 Received: from mx20.gnu.org ([199.232.41.8]:22591) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KAg56-0005ZE-Cf for qemu-devel@nongnu.org; Mon, 23 Jun 2008 03:03:18 -0400 Received: from fmmailgate02.web.de ([217.72.192.227]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KAg52-0000iA-4E for qemu-devel@nongnu.org; Mon, 23 Jun 2008 03:03:12 -0400 Received: from smtp06.web.de (fmsmtp06.dlan.cinetic.de [172.20.5.172]) by fmmailgate02.web.de (Postfix) with ESMTP id 100C6E2CE0DF for ; Mon, 23 Jun 2008 09:03:08 +0200 (CEST) Received: from [88.65.247.188] (helo=[192.168.1.198]) by smtp06.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.109 #226) id 1KAg4x-0006V9-00 for qemu-devel@nongnu.org; Mon, 23 Jun 2008 09:03:07 +0200 Message-ID: <485F4AAB.1060908@web.de> Date: Mon, 23 Jun 2008 09:03:07 +0200 From: Jan Kiszka MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Sender: jan.kiszka@web.de Subject: [Qemu-devel] [PATCH] Make mixer emulation a configure option Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org QEMU is able to provide software-based mixer emulation (volume control), but so far the user has to comment out the undocumented NOVOL define in the source code. This patch makes the switch controllable via configure. As malc and I still disagree about the preferred default :), the patch comes in two versions: The first one aims at improving the user experience (by making things work out-off-the-box), the second one is for the case that concerns about noticeable performance regressions of CONFIG_MIXEMU/!NOVOL dominate (I don't see them on common QEMU host platforms, though). Whatever you finally pick is not that important as long as a patch is applied at all. Keep in mind that more and more targets' sound emulation may rely on full mixer emulation. Right now, Musicpal already does. Signed-off-by: Jan Kiszka --- audio/mixeng.c | 2 -- audio/mixeng_template.h | 10 +++++----- configure | 9 +++++++++ 3 files changed, 14 insertions(+), 7 deletions(-) Index: b/audio/mixeng.c =================================================================== --- a/audio/mixeng.c +++ b/audio/mixeng.c @@ -28,8 +28,6 @@ #define AUDIO_CAP "mixeng" #include "audio_int.h" -#define NOVOL - /* 8 bit */ #define ENDIAN_CONVERSION natural #define ENDIAN_CONVERT(v) (v) Index: b/audio/mixeng_template.h =================================================================== --- a/audio/mixeng_template.h +++ b/audio/mixeng_template.h @@ -31,14 +31,14 @@ #define HALF (IN_MAX >> 1) #endif -#ifdef NOVOL -#define VOL(a, b) a -#else +#ifdef CONFIG_MIXEMU #ifdef FLOAT_MIXENG #define VOL(a, b) ((a) * (b)) #else #define VOL(a, b) ((a) * (b)) >> 32 #endif +#else +#define VOL(a, b) a #endif #define ET glue (ENDIAN_CONVERSION, glue (_, IN_T)) @@ -113,7 +113,7 @@ static void glue (glue (conv_, ET), _to_ { st_sample_t *out = dst; IN_T *in = (IN_T *) src; -#ifndef NOVOL +#ifdef CONFIG_MIXEMU if (vol->mute) { mixeng_clear (dst, samples); return; @@ -133,7 +133,7 @@ static void glue (glue (conv_, ET), _to_ { st_sample_t *out = dst; IN_T *in = (IN_T *) src; -#ifndef NOVOL +#ifdef CONFIG_MIXEMU if (vol->mute) { mixeng_clear (dst, samples); return; Index: b/configure =================================================================== --- a/configure +++ b/configure @@ -114,6 +114,7 @@ build_docs="no" uname_release="" curses="yes" nptl="yes" +mixemu="yes" # OS specific targetos=`uname -s` @@ -337,6 +338,8 @@ for opt do ;; --disable-nptl) nptl="no" ;; + --disable-mixemu) mixemu="no" + ;; *) echo "ERROR: unknown option $opt"; show_help="yes" ;; esac @@ -428,6 +431,7 @@ echo " --enable-alsa enable echo " --enable-esd enable EsoundD audio driver" echo " --enable-fmod enable FMOD audio driver" echo " --enable-dsound enable DirectSound audio driver" +echo " --disable-mixemu disable mixer emulation" echo " --disable-brlapi disable BrlAPI" echo " --disable-vnc-tls disable TLS encryption for VNC server" echo " --disable-curses disable curses output" @@ -839,6 +843,7 @@ echo "CoreAudio support $coreaudio" echo "ALSA support $alsa" echo "EsounD support $esd" echo "DSound support $dsound" +echo "Mixer emulation $mixemu" if test "$fmod" = "yes"; then if test -z $fmod_lib || test -z $fmod_inc; then echo @@ -1067,6 +1072,10 @@ if test "$dsound" = "yes" ; then echo "CONFIG_DSOUND=yes" >> $config_mak echo "#define CONFIG_DSOUND 1" >> $config_h fi +if test "$mixemu" = "yes" ; then + echo "CONFIG_MIXEMU=yes" >> $config_mak + echo "#define CONFIG_MIXEMU 1" >> $config_h +fi if test "$fmod" = "yes" ; then echo "CONFIG_FMOD=yes" >> $config_mak echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak --------------- --- audio/mixeng.c | 2 -- audio/mixeng_template.h | 10 +++++----- configure | 9 +++++++++ 3 files changed, 14 insertions(+), 7 deletions(-) Index: b/audio/mixeng.c =================================================================== --- a/audio/mixeng.c +++ b/audio/mixeng.c @@ -28,8 +28,6 @@ #define AUDIO_CAP "mixeng" #include "audio_int.h" -#define NOVOL - /* 8 bit */ #define ENDIAN_CONVERSION natural #define ENDIAN_CONVERT(v) (v) Index: b/audio/mixeng_template.h =================================================================== --- a/audio/mixeng_template.h +++ b/audio/mixeng_template.h @@ -31,14 +31,14 @@ #define HALF (IN_MAX >> 1) #endif -#ifdef NOVOL -#define VOL(a, b) a -#else +#ifdef CONFIG_MIXEMU #ifdef FLOAT_MIXENG #define VOL(a, b) ((a) * (b)) #else #define VOL(a, b) ((a) * (b)) >> 32 #endif +#else +#define VOL(a, b) a #endif #define ET glue (ENDIAN_CONVERSION, glue (_, IN_T)) @@ -113,7 +113,7 @@ static void glue (glue (conv_, ET), _to_ { st_sample_t *out = dst; IN_T *in = (IN_T *) src; -#ifndef NOVOL +#ifdef CONFIG_MIXEMU if (vol->mute) { mixeng_clear (dst, samples); return; @@ -133,7 +133,7 @@ static void glue (glue (conv_, ET), _to_ { st_sample_t *out = dst; IN_T *in = (IN_T *) src; -#ifndef NOVOL +#ifdef CONFIG_MIXEMU if (vol->mute) { mixeng_clear (dst, samples); return; Index: b/configure =================================================================== --- a/configure +++ b/configure @@ -114,6 +114,7 @@ build_docs="no" uname_release="" curses="yes" nptl="yes" +mixemu="no" # OS specific targetos=`uname -s` @@ -337,6 +338,8 @@ for opt do ;; --disable-nptl) nptl="no" ;; + --enable-mixemu) mixemu="yes" + ;; *) echo "ERROR: unknown option $opt"; show_help="yes" ;; esac @@ -428,6 +431,7 @@ echo " --enable-alsa enable echo " --enable-esd enable EsoundD audio driver" echo " --enable-fmod enable FMOD audio driver" echo " --enable-dsound enable DirectSound audio driver" +echo " --enable-mixemu enable mixer emulation" echo " --disable-brlapi disable BrlAPI" echo " --disable-vnc-tls disable TLS encryption for VNC server" echo " --disable-curses disable curses output" @@ -839,6 +843,7 @@ echo "CoreAudio support $coreaudio" echo "ALSA support $alsa" echo "EsounD support $esd" echo "DSound support $dsound" +echo "Mixer emulation $mixemu" if test "$fmod" = "yes"; then if test -z $fmod_lib || test -z $fmod_inc; then echo @@ -1067,6 +1072,10 @@ if test "$dsound" = "yes" ; then echo "CONFIG_DSOUND=yes" >> $config_mak echo "#define CONFIG_DSOUND 1" >> $config_h fi +if test "$mixemu" = "yes" ; then + echo "CONFIG_MIXEMU=yes" >> $config_mak + echo "#define CONFIG_MIXEMU 1" >> $config_h +fi if test "$fmod" = "yes" ; then echo "CONFIG_FMOD=yes" >> $config_mak echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak