changeset 991:34259889b2b1 dev-0_9_1

Add support for libSIDPlay-FP v1.1.x.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 11 Oct 2013 14:37:20 +0300
parents 15995c18e410
children 2a23855f9d04
files acinclude.m4 configure.ac src/config.h.in src/xs_sidplayfp.cpp
diffstat 4 files changed, 56 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/acinclude.m4	Fri Oct 11 13:47:41 2013 +0300
+++ b/acinclude.m4	Fri Oct 11 14:37:20 2013 +0300
@@ -194,13 +194,12 @@
 
 
 dnl -------------------------------------------------------------------------
-dnl Try to find SIDPLAY2 library and header files.
-dnl $xs_have_sidplay2 will be "yes" or "no"
-dnl @SIDPLAY_LIBS@ will be substituted with linker parameters
-dnl @SIDPLAY_INCLUDES@ will be substituted with compiler parameters
+dnl Try to find SIDPLAY-FP library and header files.
+dnl $xs_have_sidplayfp will be "yes" or "no"
+dnl @SIDPLAYFP_LIBS@ will be substituted with linker parameters
+dnl @SIDPLAYFP_INCLUDES@ will be substituted with compiler parameters
 dnl -------------------------------------------------------------------------
 
-
 AC_DEFUN([XS_PATH_LIBSIDPLAYFP],
 [
     AC_MSG_CHECKING([for working SIDPlayFP library and headers])
@@ -208,7 +207,8 @@
     AC_LANG_PUSH([C++])
     
     PKG_CHECK_EXISTS([libsidplayfp >= 0.3.5], [xs_pkg_sidplayfp="yes"], [])
-    PKG_CHECK_EXISTS([libsidplayfp >= 1.0.0], [xs_pkg_sidplayfp_v1="yes"], [])
+    PKG_CHECK_EXISTS([libsidplayfp >= 1.0.0], [xs_pkg_sidplayfp_v10="yes"], [])
+    PKG_CHECK_EXISTS([libsidplayfp >= 1.1.0], [xs_pkg_sidplayfp_v11="yes"], [])
 
     if test "x$xs_pkg_sidplayfp" = "xyes"; then
         AC_CACHE_VAL([xs_cv_have_sidplayfp],
@@ -216,7 +216,7 @@
             xs_sidplayfp_cflags=`$PKG_CONFIG --libs libsidplayfp`
             xs_sidplayfp_ldflags=`$PKG_CONFIG --libs libsidplayfp`
 
-            if test "x$xs_pkg_sidplayfp_v1" = "xyes"; then
+            if test "x$xs_pkg_sidplayfp_v10" = "xyes"; then
                 XS_TRY_LIBRARY([sidplayfp],
                     [$xs_sidplayfp_cxxflags -DHAVE_UNIX], [$xs_sidplayfp_ldflags],
                     [sidplayfp], [sidplayfp/sidplayfp.h], [sidplayfp *myEngine;])
@@ -230,7 +230,8 @@
               xs_cv_have_sidplayfp="xs_have_sidplayfp=yes  \
                 xs_sidplayfp_cxxflags=\"$xs_sidplayfp_cxxflags\"  \
                 xs_sidplayfp_ldflags=\"$xs_sidplayfp_ldflags\" \
-                xs_pkg_sidplayfp_v1=\"$xs_pkg_sidplayfp_v1\" "
+                xs_pkg_sidplayfp_v10=\"$xs_pkg_sidplayfp_v10\" \
+                xs_pkg_sidplayfp_v11=\"$xs_pkg_sidplayfp_v11\" "
             fi
         ])
     fi
@@ -256,7 +257,12 @@
 ])
 
 
-
+dnl -------------------------------------------------------------------------
+dnl Try to find SIDPLAY2 library and header files.
+dnl $xs_have_sidplay2 will be "yes" or "no"
+dnl @SIDPLAY2_LIBS@ will be substituted with linker parameters
+dnl @SIDPLAY2_INCLUDES@ will be substituted with compiler parameters
+dnl -------------------------------------------------------------------------
 
 AC_DEFUN([XS_PATH_LIBSIDPLAY2],
 [
--- a/configure.ac	Fri Oct 11 13:47:41 2013 +0300
+++ b/configure.ac	Fri Oct 11 14:37:20 2013 +0300
@@ -22,7 +22,8 @@
 AH_TEMPLATE([HAVE_SIDPLAY1], [Define if you have and want to use libSIDPlay 1.])
 AH_TEMPLATE([HAVE_SIDPLAY2], [Define if you have and want to use libSIDPlay 2.])
 AH_TEMPLATE([HAVE_SIDPLAYFP], [Define if you have and want to use libSIDPlay2-FP http://sourceforge.net/projects/sidplay-residfp/])
-AH_TEMPLATE([HAVE_SIDPLAYFP_V1], [Define if you are using v1.0.0 API of libSIDPlay2-FP.])
+AH_TEMPLATE([HAVE_SIDPLAYFP_V10], [Define if you are using v1.0.x API of libSIDPlay2-FP.])
+AH_TEMPLATE([HAVE_SIDPLAYFP_V11], [Define if you are using v1.1.x API of libSIDPlay2-FP.])
 AH_TEMPLATE([HAVE_THEMETUNE], [Define if you want to build code to play XMMS-SID theme SID-tune. The tune needs to be installed too, though.])
 AH_TEMPLATE([DEBUG], [Define if you wish to enable debug output to terminal.])
 
@@ -134,8 +135,11 @@
 	AC_DEFINE([HAVE_HARDSID_BUILDER])
 	AC_DEFINE([HAVE_RESID_BUILDER])
 	AC_DEFINE([HAVE_RESID_FP_BUILDER])
-	if test "x$xs_pkg_sidplayfp_v1" = "xyes"; then
-		AC_DEFINE([HAVE_SIDPLAYFP_V1])
+	if test "x$xs_pkg_sidplayfp_v10" = "xyes"; then
+		AC_DEFINE([HAVE_SIDPLAYFP_V10])
+	fi
+	if test "x$xs_pkg_sidplayfp_v11" = "xyes"; then
+		AC_DEFINE([HAVE_SIDPLAYFP_V11])
 	fi
 dnl fi
 else
@@ -226,15 +230,3 @@
 	Translations (i18n/nls)       : $USE_NLS
 	Debugging enabled             : $xs_enable_debug
 ])
-
-if test "x$xs_pkg_sidplayfp_v1" = "xyes"; then
-	echo ""
-	echo "WARNING! You seem to be using libSIDPlayFP v1.x, which is, at the"
-	echo "time of this release, still in alpha state. The API may not be compatible."
-	echo "If you experience any problems, downgrade to libSIDPlayFP 0.3.7 or 0.3.5."
-	echo ""
-	echo "Or check if there are any newer releases of XMMS-SID that might support"
-	echo "the newer versions of libSIDPlayFP."
-	echo ""
-	echo "Or just use plain old libSIDPlay2."
-fi
--- a/src/config.h.in	Fri Oct 11 13:47:41 2013 +0300
+++ b/src/config.h.in	Fri Oct 11 14:37:20 2013 +0300
@@ -61,8 +61,11 @@
 /* Define if you have and want to use libSIDPlayFP */
 #undef HAVE_SIDPLAYFP
 
-/* Define if you are using v1.0.0 API of libSIDPlay2-FP. */
-#undef HAVE_SIDPLAYFP_V1
+/* Define if you are using v1.0.x API of libSIDPlay2-FP. */
+#undef HAVE_SIDPLAYFP_V10
+
+/* Define if you are using v1.1.x API of libSIDPlay2-FP. */
+#undef HAVE_SIDPLAYFP_V11
 
 /* Define if you have XMMS patched with the songpos patch. */
 #undef HAVE_SONG_POSITION
--- a/src/xs_sidplayfp.cpp	Fri Oct 11 13:47:41 2013 +0300
+++ b/src/xs_sidplayfp.cpp	Fri Oct 11 14:37:20 2013 +0300
@@ -29,7 +29,7 @@
 #include "xs_config.h"
 
 
-#ifdef HAVE_SIDPLAYFP_V1
+#if defined(HAVE_SIDPLAYFP_V10) || defined(HAVE_SIDPLAYFP_V11)
 #  include <sidplayfp/SidTune.h>
 #  include <sidplayfp/sidplayfp.h>
 #  include <sidplayfp/event.h>
@@ -45,7 +45,7 @@
 
 class XSSIDPlayFP {
 public:
-#ifdef HAVE_SIDPLAYFP_V1
+#if defined(HAVE_SIDPLAYFP_V10) || defined(HAVE_SIDPLAYFP_V11)
     sidplayfp emu;
     SidConfig config;
 #else
@@ -91,7 +91,7 @@
 
 /* Return song information
  */
-#ifdef HAVE_SIDPLAYFP_V1
+#if defined(HAVE_SIDPLAYFP_V10) || defined(HAVE_SIDPLAYFP_V11)
 #define sid2_mono              SidConfig::MONO
 #define sid2_stereo            SidConfig::STEREO
 
@@ -253,7 +253,7 @@
     switch (xs_cfg.clockSpeed)
     {
         case XS_CLOCK_NTSC:
-#ifdef HAVE_SIDPLAYFP_V1
+#if defined(HAVE_SIDPLAYFP_V10) || defined(HAVE_SIDPLAYFP_V11)
             engine->config.defaultC64Model = SID2_CLOCK_NTSC;
 #else
             engine->config.clockDefault = SID2_CLOCK_NTSC;
@@ -262,7 +262,7 @@
 
         default:
         case XS_CLOCK_PAL:
-#ifdef HAVE_SIDPLAYFP_V1
+#if defined(HAVE_SIDPLAYFP_V10) || defined(HAVE_SIDPLAYFP_V11)
 #else
             engine->config.defaultC64Model = SID2_CLOCK_PAL;
 #endif
@@ -273,7 +273,7 @@
 
     /* Configure rest of the emulation */
 
-#ifdef HAVE_SIDPLAYFP_V1
+#if defined(HAVE_SIDPLAYFP_V10) || defined(HAVE_SIDPLAYFP_V11)
     engine->config.forceC64Model   = xs_cfg.forceSpeed;
     engine->config.defaultSidModel = xs_cfg.mos8580 ? SID2_MOS8580 : SID2_MOS6581;
     XSDEBUG("init builder #%i, maxsids=%i\n", xs_cfg.sid2Builder, (engine->emu.info()).maxsids());
@@ -294,7 +294,7 @@
         case XS_BLD_RESID:
             {
                 ReSIDBuilder *rs = new ReSIDBuilder("ReSID builder");
-#ifdef HAVE_SIDPLAYFP_V1
+#if defined(HAVE_SIDPLAYFP_V10) || defined(HAVE_SIDPLAYFP_V11)
                 if (rs && rs->getStatus())
                 {
                     engine->config.sidEmulation = rs;
@@ -321,7 +321,7 @@
         case XS_BLD_RESID_FP:
             {
                 ReSIDfpBuilder *rs = new ReSIDfpBuilder("ReSID builder FP!");
-#ifdef HAVE_SIDPLAYFP_V1
+#if defined(HAVE_SIDPLAYFP_V10) || defined(HAVE_SIDPLAYFP_V11)
                 if (rs && rs->getStatus())
                 {
                     engine->config.sidEmulation = rs;
@@ -349,7 +349,7 @@
             {
                 HardSIDBuilder *hs = new HardSIDBuilder("HardSID builder (FP)");
                 engine->config.sidEmulation = (sidbuilder *) hs;
-#ifdef HAVE_SIDPLAYFP_V1
+#if defined(HAVE_SIDPLAYFP_V10) || defined(HAVE_SIDPLAYFP_V11)
                 if (hs && hs->getStatus())
                 {
                     hs->create((engine->emu.info()).maxsids());
@@ -380,7 +380,7 @@
 
     // Setup filter
     engine->config.sidEmulation->filter(xs_cfg.emulateFilters);
-#ifdef HAVE_SIDPLAYFP_V1
+#if defined(HAVE_SIDPLAYFP_V10) || defined(HAVE_SIDPLAYFP_V11)
     if (!engine->config.sidEmulation->getStatus())
 #else
     if (!*(engine->config.sidEmulation))
@@ -392,7 +392,7 @@
 
     XSDEBUG("%s\n", engine->config.sidEmulation->credits());
 
-#ifdef HAVE_SIDPLAYFP_V1
+#if defined(HAVE_SIDPLAYFP_V10) || defined(HAVE_SIDPLAYFP_V11)
     engine->emu.setRoms(xs_rom_imagedata[0], xs_rom_imagedata[1], xs_rom_imagedata[2]);
 #endif
 
@@ -403,7 +403,7 @@
 
     engine->tune.read(buf, bufSize);
     
-#ifdef HAVE_SIDPLAYFP_V1
+#if defined(HAVE_SIDPLAYFP_V10) || defined(HAVE_SIDPLAYFP_V11)
     if (!engine->tune.getStatus())
 #else
     if (!engine->tune)
@@ -484,7 +484,17 @@
 
     /* Get general tune information */
     {
-#ifdef HAVE_SIDPLAYFP_V1
+#if defined(HAVE_SIDPLAYFP_V11)
+    const SidTuneInfo *info = tune->getInfo();
+
+    res = xs_tuneinfo_new(filename,
+        info->songs(), info->startSong(),
+        info->infoString(0), info->infoString(1), info->infoString(2),
+        info->loadAddr(), info->initAddr(), info->playAddr(),
+        info->dataFileLen(), info->formatString(),
+        info->sidModel(1), info->sidModel(2)
+        );
+#elif defined(HAVE_SIDPLAYFP_V10) || defined(HAVE_SIDPLAYFP_V11)
     const SidTuneInfo *info = tune->getInfo();
 
     res = xs_tuneinfo_new(filename,
@@ -528,14 +538,19 @@
 
     engine = (XSSIDPlayFP *) state->internal;
 
-#ifdef HAVE_SIDPLAYFP_V1
+#if defined(HAVE_SIDPLAYFP_V10) || defined(HAVE_SIDPLAYFP_V11)
     if (!engine->tune.getStatus())
         return FALSE;
 
     const SidTuneInfo *info = engine->tune.getInfo();
 
+#if defined(HAVE_SIDPLAYFP_V11)
+    state->tuneInfo->sidModel1 = info->sidModel(1);
+    state->tuneInfo->sidModel2 = info->sidModel(2);
+#else
     state->tuneInfo->sidModel1 = info->sidModel1();
     state->tuneInfo->sidModel2 = info->sidModel2();
+#endif
 
     if (state->currSong > 0 && state->currSong <= state->tuneInfo->nsubTunes)
     {