Commit 0c58ac1c76603ce639e419cedd16cfcdcd813045

Authored by malc
1 parent a214c598

Change the way audio is configured

Instead of having separate option for each card and driver use
--audio-drv-list and --audio-card-list options.

Under Linux it allows to set the default(first probed) driver
to something other than OSS.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4792 c046a42c-6fe2-441c-8c8c-71466251a162
audio/audio.c
@@ -38,27 +38,7 @@ @@ -38,27 +38,7 @@
38 #define SW_NAME(sw) (sw)->name ? (sw)->name : "unknown" 38 #define SW_NAME(sw) (sw)->name ? (sw)->name : "unknown"
39 39
40 static struct audio_driver *drvtab[] = { 40 static struct audio_driver *drvtab[] = {
41 -#ifdef CONFIG_OSS  
42 - &oss_audio_driver,  
43 -#endif  
44 -#ifdef CONFIG_ALSA  
45 - &alsa_audio_driver,  
46 -#endif  
47 -#ifdef CONFIG_COREAUDIO  
48 - &coreaudio_audio_driver,  
49 -#endif  
50 -#ifdef CONFIG_DSOUND  
51 - &dsound_audio_driver,  
52 -#endif  
53 -#ifdef CONFIG_FMOD  
54 - &fmod_audio_driver,  
55 -#endif  
56 -#ifdef CONFIG_SDL  
57 - &sdl_audio_driver,  
58 -#endif  
59 -#ifdef CONFIG_ESD  
60 - &esd_audio_driver,  
61 -#endif 41 + AUDIO_DRIVERS
62 &no_audio_driver, 42 &no_audio_driver,
63 &wav_audio_driver 43 &wav_audio_driver
64 }; 44 };
configure
@@ -24,6 +24,8 @@ cross_prefix="" @@ -24,6 +24,8 @@ cross_prefix=""
24 cc="gcc" 24 cc="gcc"
25 gcc3_search="yes" 25 gcc3_search="yes"
26 gcc3_list="gcc-3.4.6 gcc-3.4 gcc34 gcc-3.3.6 gcc-3.3 gcc33 gcc-3.2 gcc32" 26 gcc3_list="gcc-3.4.6 gcc-3.4 gcc34 gcc-3.3.6 gcc-3.3 gcc33 gcc-3.2 gcc32"
  27 +audio_drv_list=""
  28 +audio_card_list=""
27 host_cc="gcc" 29 host_cc="gcc"
28 ar="ar" 30 ar="ar"
29 make="make" 31 make="make"
@@ -87,16 +89,6 @@ mingw32="no" @@ -87,16 +89,6 @@ mingw32="no"
87 EXESUF="" 89 EXESUF=""
88 gdbstub="yes" 90 gdbstub="yes"
89 slirp="yes" 91 slirp="yes"
90 -adlib="no"  
91 -ac97="no"  
92 -gus="no"  
93 -cs4231a="no"  
94 -oss="no"  
95 -dsound="no"  
96 -coreaudio="no"  
97 -alsa="no"  
98 -esd="no"  
99 -fmod="no"  
100 fmod_lib="" 92 fmod_lib=""
101 fmod_inc="" 93 fmod_inc=""
102 vnc_tls="yes" 94 vnc_tls="yes"
@@ -133,32 +125,32 @@ if [ "$cpu" = "i386" ] ; then @@ -133,32 +125,32 @@ if [ "$cpu" = "i386" ] ; then
133 fi 125 fi
134 ;; 126 ;;
135 GNU/kFreeBSD) 127 GNU/kFreeBSD)
136 -oss="yes" 128 +audio_drv_list="oss"
137 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 129 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
138 kqemu="yes" 130 kqemu="yes"
139 fi 131 fi
140 ;; 132 ;;
141 FreeBSD) 133 FreeBSD)
142 bsd="yes" 134 bsd="yes"
143 -oss="yes" 135 +audio_drv_list="oss"
144 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 136 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
145 kqemu="yes" 137 kqemu="yes"
146 fi 138 fi
147 ;; 139 ;;
148 NetBSD) 140 NetBSD)
149 bsd="yes" 141 bsd="yes"
150 -oss="yes" 142 +audio_drv_list="oss"
151 ;; 143 ;;
152 OpenBSD) 144 OpenBSD)
153 bsd="yes" 145 bsd="yes"
154 -oss="yes" 146 +audio_drv_list="oss"
155 ;; 147 ;;
156 Darwin) 148 Darwin)
157 bsd="yes" 149 bsd="yes"
158 darwin="yes" 150 darwin="yes"
159 darwin_user="yes" 151 darwin_user="yes"
160 cocoa="yes" 152 cocoa="yes"
161 -coreaudio="yes" 153 +audio_drv_list="coreaudio"
162 OS_CFLAGS="-mdynamic-no-pic" 154 OS_CFLAGS="-mdynamic-no-pic"
163 OS_LDFLAGS="-framework CoreFoundation -framework IOKit" 155 OS_LDFLAGS="-framework CoreFoundation -framework IOKit"
164 ;; 156 ;;
@@ -191,11 +183,11 @@ SunOS) @@ -191,11 +183,11 @@ SunOS)
191 fi 183 fi
192 fi 184 fi
193 if test -f /usr/include/sys/soundcard.h ; then 185 if test -f /usr/include/sys/soundcard.h ; then
194 - oss=yes 186 + audio_drv_list="oss"
195 fi 187 fi
196 ;; 188 ;;
197 *) 189 *)
198 -oss="yes" 190 +audio_drv_list="oss"
199 linux="yes" 191 linux="yes"
200 linux_user="yes" 192 linux_user="yes"
201 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then 193 if [ "$cpu" = "i386" -o "$cpu" = "x86_64" ] ; then
@@ -264,17 +256,11 @@ for opt do @@ -264,17 +256,11 @@ for opt do
264 ;; 256 ;;
265 --disable-sdl) sdl="no" 257 --disable-sdl) sdl="no"
266 ;; 258 ;;
267 - --enable-coreaudio) coreaudio="yes"  
268 - ;;  
269 - --enable-alsa) alsa="yes"  
270 - ;;  
271 - --enable-esd) esd="yes"  
272 - ;;  
273 - --enable-dsound) dsound="yes" 259 + --fmod-lib=*) fmod_lib="$optarg"
274 ;; 260 ;;
275 - --enable-fmod) fmod="yes" 261 + --audio-card-list=*) audio_card_list="$optarg"
276 ;; 262 ;;
277 - --fmod-lib=*) fmod_lib="$optarg" 263 + --audio-drv-list=*) audio_drv_list="$optarg"
278 ;; 264 ;;
279 --fmod-inc=*) fmod_inc="$optarg" 265 --fmod-inc=*) fmod_inc="$optarg"
280 ;; 266 ;;
@@ -284,21 +270,13 @@ for opt do @@ -284,21 +270,13 @@ for opt do
284 ;; 270 ;;
285 --disable-slirp) slirp="no" 271 --disable-slirp) slirp="no"
286 ;; 272 ;;
287 - --enable-adlib) adlib="yes"  
288 - ;;  
289 - --enable-ac97) ac97="yes"  
290 - ;;  
291 - --enable-gus) gus="yes"  
292 - ;;  
293 - --enable-cs4231a) cs4231a="yes"  
294 - ;;  
295 --disable-kqemu) kqemu="no" 273 --disable-kqemu) kqemu="no"
296 ;; 274 ;;
297 --disable-brlapi) brlapi="no" 275 --disable-brlapi) brlapi="no"
298 ;; 276 ;;
299 --enable-profiler) profiler="yes" 277 --enable-profiler) profiler="yes"
300 ;; 278 ;;
301 - --enable-cocoa) cocoa="yes" ; coreaudio="yes" ; sdl="no" 279 + --enable-cocoa) cocoa="yes" ; sdl="no" ;
302 ;; 280 ;;
303 --disable-gfx-check) check_gfx="no" 281 --disable-gfx-check) check_gfx="no"
304 ;; 282 ;;
@@ -422,15 +400,8 @@ echo " --disable-werror disable compilation abort on warning" @@ -422,15 +400,8 @@ echo " --disable-werror disable compilation abort on warning"
422 echo " --disable-sdl disable SDL" 400 echo " --disable-sdl disable SDL"
423 echo " --enable-cocoa enable COCOA (Mac OS X only)" 401 echo " --enable-cocoa enable COCOA (Mac OS X only)"
424 echo " --enable-mingw32 enable Win32 cross compilation with mingw32" 402 echo " --enable-mingw32 enable Win32 cross compilation with mingw32"
425 -echo " --enable-adlib enable Adlib emulation"  
426 -echo " --enable-ac97 enable AC97 emulation"  
427 -echo " --enable-gus enable Gravis Ultrasound emulation"  
428 -echo " --enable-cs4231a enable CS4231A emulation"  
429 -echo " --enable-coreaudio enable Coreaudio audio driver"  
430 -echo " --enable-alsa enable ALSA audio driver"  
431 -echo " --enable-esd enable EsoundD audio driver"  
432 -echo " --enable-fmod enable FMOD audio driver"  
433 -echo " --enable-dsound enable DirectSound audio driver" 403 +echo " --audio-drv-list set audio drivers list"
  404 +echo " --audio-card-list set list of additional emulated audio cards"
434 echo " --enable-mixemu enable mixer emulation" 405 echo " --enable-mixemu enable mixer emulation"
435 echo " --disable-brlapi disable BrlAPI" 406 echo " --disable-brlapi disable BrlAPI"
436 echo " --disable-vnc-tls disable TLS encryption for VNC server" 407 echo " --disable-vnc-tls disable TLS encryption for VNC server"
@@ -721,7 +692,7 @@ else @@ -721,7 +692,7 @@ else
721 # Make sure to disable cocoa if sdl was set 692 # Make sure to disable cocoa if sdl was set
722 if test "$sdl" = "yes" ; then 693 if test "$sdl" = "yes" ; then
723 cocoa="no" 694 cocoa="no"
724 - coreaudio="no" 695 + audio_drv_list="echo $audio_drv_list | sed s,coreaudio,,g"
725 fi 696 fi
726 fi # -z $sdl 697 fi # -z $sdl
727 698
@@ -835,14 +806,8 @@ if test "$sdl" != "no" ; then @@ -835,14 +806,8 @@ if test "$sdl" != "no" ; then
835 fi 806 fi
836 echo "curses support $curses" 807 echo "curses support $curses"
837 echo "mingw32 support $mingw32" 808 echo "mingw32 support $mingw32"
838 -echo "Adlib support $adlib"  
839 -echo "AC97 support $ac97"  
840 -echo "GUS support $gus"  
841 -echo "CS4231A support $cs4231a"  
842 -echo "CoreAudio support $coreaudio"  
843 -echo "ALSA support $alsa"  
844 -echo "EsounD support $esd"  
845 -echo "DSound support $dsound" 809 +echo "Audio drivers $audio_drv_list"
  810 +echo "Extra audio cards $audio_card_list"
846 echo "Mixer emulation $mixemu" 811 echo "Mixer emulation $mixemu"
847 if test "$fmod" = "yes"; then 812 if test "$fmod" = "yes"; then
848 if test -z $fmod_lib || test -z $fmod_inc; then 813 if test -z $fmod_lib || test -z $fmod_inc; then
@@ -1036,52 +1001,26 @@ if test "$slirp" = "yes" ; then @@ -1036,52 +1001,26 @@ if test "$slirp" = "yes" ; then
1036 echo "CONFIG_SLIRP=yes" >> $config_mak 1001 echo "CONFIG_SLIRP=yes" >> $config_mak
1037 echo "#define CONFIG_SLIRP 1" >> $config_h 1002 echo "#define CONFIG_SLIRP 1" >> $config_h
1038 fi 1003 fi
1039 -if test "$adlib" = "yes" ; then  
1040 - echo "CONFIG_ADLIB=yes" >> $config_mak  
1041 - echo "#define CONFIG_ADLIB 1" >> $config_h  
1042 -fi  
1043 -if test "$ac97" = "yes" ; then  
1044 - echo "CONFIG_AC97=yes" >> $config_mak  
1045 - echo "#define CONFIG_AC97 1" >> $config_h  
1046 -fi  
1047 -if test "$gus" = "yes" ; then  
1048 - echo "CONFIG_GUS=yes" >> $config_mak  
1049 - echo "#define CONFIG_GUS 1" >> $config_h  
1050 -fi  
1051 -if test "$cs4231a" = "yes" ; then  
1052 - echo "CONFIG_CS4231A=yes" >> $config_mak  
1053 - echo "#define CONFIG_CS4231A 1" >> $config_h  
1054 -fi  
1055 -if test "$oss" = "yes" ; then  
1056 - echo "CONFIG_OSS=yes" >> $config_mak  
1057 - echo "#define CONFIG_OSS 1" >> $config_h  
1058 -fi  
1059 -if test "$coreaudio" = "yes" ; then  
1060 - echo "CONFIG_COREAUDIO=yes" >> $config_mak  
1061 - echo "#define CONFIG_COREAUDIO 1" >> $config_h  
1062 -fi  
1063 -if test "$alsa" = "yes" ; then  
1064 - echo "CONFIG_ALSA=yes" >> $config_mak  
1065 - echo "#define CONFIG_ALSA 1" >> $config_h  
1066 -fi  
1067 -if test "$esd" = "yes" ; then  
1068 - echo "CONFIG_ESD=yes" >> $config_mak  
1069 - echo "#define CONFIG_ESD 1" >> $config_h  
1070 -fi  
1071 -if test "$dsound" = "yes" ; then  
1072 - echo "CONFIG_DSOUND=yes" >> $config_mak  
1073 - echo "#define CONFIG_DSOUND 1" >> $config_h  
1074 -fi 1004 +for card in $audio_card_list; do
  1005 + def=CONFIG_`echo $card | tr [:lower:] [:upper:]`
  1006 + echo "$def=yes" >> $config_mak
  1007 + echo "#define $def 1" >> $config_h
  1008 +done
  1009 +echo "#define AUDIO_DRIVERS \\" >> $config_h
  1010 +for drv in $audio_drv_list; do
  1011 + echo " &${drv}_audio_driver, \\" >>$config_h
  1012 + def=CONFIG_`echo $drv | tr [:lower:] [:upper:]`
  1013 + echo "$def=yes" >> $config_mak
  1014 + if test "$drv" == "fmod"; then
  1015 + echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak
  1016 + echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak
  1017 + fi
  1018 +done
  1019 +echo "" >>$config_h
1075 if test "$mixemu" = "yes" ; then 1020 if test "$mixemu" = "yes" ; then
1076 echo "CONFIG_MIXEMU=yes" >> $config_mak 1021 echo "CONFIG_MIXEMU=yes" >> $config_mak
1077 echo "#define CONFIG_MIXEMU 1" >> $config_h 1022 echo "#define CONFIG_MIXEMU 1" >> $config_h
1078 fi 1023 fi
1079 -if test "$fmod" = "yes" ; then  
1080 - echo "CONFIG_FMOD=yes" >> $config_mak  
1081 - echo "CONFIG_FMOD_LIB=$fmod_lib" >> $config_mak  
1082 - echo "CONFIG_FMOD_INC=$fmod_inc" >> $config_mak  
1083 - echo "#define CONFIG_FMOD 1" >> $config_h  
1084 -fi  
1085 if test "$vnc_tls" = "yes" ; then 1024 if test "$vnc_tls" = "yes" ; then
1086 echo "CONFIG_VNC_TLS=yes" >> $config_mak 1025 echo "CONFIG_VNC_TLS=yes" >> $config_mak
1087 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak 1026 echo "CONFIG_VNC_TLS_CFLAGS=$vnc_tls_cflags" >> $config_mak
qemu-doc.texi
@@ -183,8 +183,8 @@ PCI UHCI USB controller and a virtual USB hub. @@ -183,8 +183,8 @@ PCI UHCI USB controller and a virtual USB hub.
183 SMP is supported with up to 255 CPUs. 183 SMP is supported with up to 255 CPUs.
184 184
185 Note that adlib, ac97, gus and cs4231a are only available when QEMU 185 Note that adlib, ac97, gus and cs4231a are only available when QEMU
186 -was configured with --enable-adlib, --enable-ac97, --enable-gus or  
187 ---enable-cs4231a respectively. 186 +was configured with --audio-card-list option containing the name(s) of
  187 +required cards.
188 188
189 QEMU uses the PC BIOS from the Bochs project and the Plex86/Bochs LGPL 189 QEMU uses the PC BIOS from the Bochs project and the Plex86/Bochs LGPL
190 VGA BIOS. 190 VGA BIOS.