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: public:
logfunctions(void); logfunctions(void);
logfunctions(class iofunctions *); logfunctions(class iofunctions *);
~logfunctions(void); virtual ~logfunctions(void);
void info(const char *fmt, ...) BX_CPP_AttrPrintf(2, 3); void info(const char *fmt, ...) BX_CPP_AttrPrintf(2, 3);
void error(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 #define BX_SUPPORT_SOUNDLOW 0
#if BX_SUPPORT_SOUNDLOW #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: // Currently the following are available:
// bx_sound_alsa_c Output for Linux with ALSA PCM and sequencer interface // alsa Output for Linux with ALSA PCM and sequencer interface
// bx_sound_linux_c Output for Linux, to /dev/dsp and /dev/midi00 // oss Output for Linux, to /dev/dsp and /dev/midi00
// bx_sound_windows_c Output for Windows midi and wave mappers // win Output for Windows midi and wave mappers
// bx_sound_osx_c Output for MacOSX midi and wave device // osx Output for MacOSX midi and wave device
// bx_sound_sdl_c Wave output with SDL // sdl Wave output with SDL/SDL2
// bx_sound_lowlevel_c Dummy functions, no output // dummy Dummy functions, no output
#define BX_SOUND_LOWLEVEL_C bx_sound_lowlevel_c #define BX_SOUND_LOWLEVEL_NAME "dummy"
// Use ALSA sound interface on Linux // Use ALSA sound interface on Linux
#define BX_HAVE_ALSASOUND 0 #define BX_HAVE_ALSASOUND 0
#endif #endif

View File

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

View File

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