Changed to way to determine the default lowlevel sound driver (part of the

mixing3.patch by Dawn Teschendorf).
This commit is contained in:
Volker Ruppert 2014-11-22 11:43:40 +00:00
parent 9805324c42
commit 7330f3a61c
4 changed files with 18 additions and 19 deletions

View File

@ -270,7 +270,7 @@ typedef class BOCHSAPI logfunctions
public:
logfunctions(void);
logfunctions(class iofunctions *);
~logfunctions(void);
virtual ~logfunctions(void);
void info(const char *fmt, ...) BX_CPP_AttrPrintf(2, 3);
void error(const char *fmt, ...) BX_CPP_AttrPrintf(2, 3);

View File

@ -885,15 +885,15 @@ typedef
#define BX_SUPPORT_SOUNDLOW 0
#if BX_SUPPORT_SOUNDLOW
// Determines which sound lowlevel class is to be used as the default.
// Determines which sound lowlevel driver is to be used as the default.
// Currently the following are available:
// bx_sound_alsa_c Output for Linux with ALSA PCM and sequencer interface
// bx_sound_linux_c Output for Linux, to /dev/dsp and /dev/midi00
// bx_sound_windows_c Output for Windows midi and wave mappers
// bx_sound_osx_c Output for MacOSX midi and wave device
// bx_sound_sdl_c Wave output with SDL
// bx_sound_lowlevel_c Dummy functions, no output
#define BX_SOUND_LOWLEVEL_C bx_sound_lowlevel_c
// alsa Output for Linux with ALSA PCM and sequencer interface
// oss Output for Linux, to /dev/dsp and /dev/midi00
// win Output for Windows midi and wave mappers
// osx Output for MacOSX midi and wave device
// sdl Wave output with SDL/SDL2
// dummy Dummy functions, no output
#define BX_SOUND_LOWLEVEL_NAME "dummy"
// Use ALSA sound interface on Linux
#define BX_HAVE_ALSASOUND 0
#endif

View File

@ -1877,14 +1877,12 @@ if test "$soundcard_present" = 1; then
case "$target" in
*-linux* | *-freebsd*)
SOUNDLOW_OBJS='soundlnx.o'
AC_DEFINE(BX_SOUND_LOWLEVEL_C, bx_sound_linux_c)
soundlow_drivers="oss"
soundlow_default="oss"
bx_have_alsa=0
AC_CHECK_HEADER([alsa/asoundlib.h], [bx_have_alsa=1])
if test "$bx_have_alsa" = 1; then
SOUNDLOW_OBJS="$SOUNDLOW_OBJS soundalsa.o"
AC_DEFINE(BX_SOUND_LOWLEVEL_C, bx_sound_alsa_c)
soundlow_default="alsa"
soundlow_drivers="alsa $soundlow_drivers"
AC_DEFINE(BX_HAVE_ALSASOUND, 1)
@ -1897,28 +1895,24 @@ if test "$soundcard_present" = 1; then
;;
*-pc-windows*)
SOUNDLOW_OBJS='soundwin.o'
AC_DEFINE(BX_SOUND_LOWLEVEL_C, bx_sound_windows_c)
DEVICE_LINK_OPTS="$DEVICE_LINK_OPTS winmm.lib"
soundlow_drivers="win"
soundlow_default="win"
;;
*-cygwin* | *-mingw32*)
SOUNDLOW_OBJS='soundwin.o'
AC_DEFINE(BX_SOUND_LOWLEVEL_C, bx_sound_windows_c)
DEVICE_LINK_OPTS="$DEVICE_LINK_OPTS -lwinmm"
soundlow_drivers="win"
soundlow_default="win"
;;
*-macosx* | *-macos* | *-apple-darwin*)
SOUNDLOW_OBJS='soundosx.o'
AC_DEFINE(BX_SOUND_LOWLEVEL_C, bx_sound_osx_c)
DEVICE_LINK_OPTS="$DEVICE_LINK_OPTS -framework CoreServices -framework AudioUnit -framework AudioToolbox"
soundlow_drivers="osx"
soundlow_default="osx"
;;
*)
SOUNDLOW_OBJS=''
AC_DEFINE(BX_SOUND_LOWLEVEL_C, bx_sound_lowlevel_c)
soundlow_default="dummy"
;;
esac
@ -1949,6 +1943,7 @@ if test "$soundcard_present" = 1; then
AC_MSG_RESULT($soundlow_drivers)
AC_MSG_CHECKING(for default sound lowlevel module)
AC_MSG_RESULT($soundlow_default)
AC_DEFINE_UNQUOTED(BX_SOUND_LOWLEVEL_NAME, "$soundlow_default")
else
AC_DEFINE(BX_SUPPORT_SOUNDLOW, 0)
fi

View File

@ -79,11 +79,17 @@ bx_soundmod_ctl_c::~bx_soundmod_ctl_c()
void bx_soundmod_ctl_c::init()
{
static const char default_name[] = BX_SOUND_LOWLEVEL_NAME;
const char *driver = SIM->get_param_string(BXPN_SOUND_DRIVER)->getptr();
const char *waveout = SIM->get_param_string(BXPN_SOUND_WAVEOUT)->getptr();
const char *wavein = SIM->get_param_string(BXPN_SOUND_WAVEIN)->getptr();
if (!strcmp(driver, "default")) {
soundmod = new BX_SOUND_LOWLEVEL_C();
if (strcmp(driver, "default") == 0) {
driver = default_name;
}
if (strcmp(driver, "dummy") == 0) {
soundmod = new bx_sound_lowlevel_c();
#if BX_HAVE_ALSASOUND
} else if (!strcmp(driver, "alsa")) {
soundmod = new bx_sound_alsa_c();
@ -104,8 +110,6 @@ void bx_soundmod_ctl_c::init()
} else if (!strcmp(driver, "win")) {
soundmod = new bx_sound_windows_c();
#endif
} else if (!strcmp(driver, "dummy")) {
soundmod = new bx_sound_lowlevel_c();
} else {
BX_PANIC(("unknown lowlevel sound driver '%s'", driver));
return;