changeset 838:ae1f6418d093

libSIDPlay2-FP backend interface is now in a separate module. Configuration related things still pending.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 08 Nov 2012 21:24:38 +0200
parents 5b3e2116408f
children 29f3c3f29c0d
files Makefile.am acinclude.m4 configure.ac src/config.h.in src/xs_sidplay.h src/xs_sidplay2.cpp src/xs_sidplayfp.cpp
diffstat 7 files changed, 67 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.am	Thu Nov 08 20:58:45 2012 +0200
+++ b/Makefile.am	Thu Nov 08 21:24:38 2012 +0200
@@ -84,14 +84,14 @@
 
 # Generals
 AM_CFLAGS = -W -Wall -D_REENTRANT @XMMS_CFLAGS@ @SIDPLAY1_CFLAGS@	\
-		@SIDPLAY2_CFLAGS@ @BUILDERS_CFLAGS@			\
+		@SIDPLAY2_CFLAGS@ @BUILDERS_CFLAGS@ @SIDPLAYFP_CFLAGS@	\
 		-DTHEMETUNE_FILE="\"$(pkgdatadir)/$(themetune)\""	\
 		-DLOCALEDIR="\"$(localedir)\""
 
 AM_CXXFLAGS = $(AM_CFLAGS)
 
 libxmmssid_la_LDFLAGS = -module -avoid-version @BUILDERS_LDFLAGS@
-libxmmssid_la_LIBADD  = @XMMS_LIBS@ @SIDPLAY1_LIBS@ @SIDPLAY2_LIBS@ @BUILDERS_LIBS@
+libxmmssid_la_LIBADD  = @XMMS_LIBS@ @SIDPLAY1_LIBS@ @SIDPLAY2_LIBS@ @BUILDERS_LIBS@ @SIDPLAYFP_LIBS@
 
 # Glade-generated sources
 update-glade: xmms-sid.glade
--- a/acinclude.m4	Thu Nov 08 20:58:45 2012 +0200
+++ b/acinclude.m4	Thu Nov 08 21:24:38 2012 +0200
@@ -31,7 +31,10 @@
     AC_LINK_IFELSE(
         [
         AC_LANG_PROGRAM(
-            [#include <$5>],
+            [
+            #include <stdio.h>
+            #include <$5>
+            ],
             [$6]
         )],
         [xs_$1_works="yes"],
@@ -196,6 +199,7 @@
     AC_LANG_PUSH([C++])
     
     PKG_CHECK_EXISTS([libsidplayfp >= 0.3.7], [xs_pkg_sidplayfp="yes"], [])
+    PKG_CHECK_EXISTS([libsidplayfp >= 1.0.0], [xs_pkg_sidplayfp_v1="yes"], [])
 
     if test "x$xs_pkg_sidplayfp" = "xyes"; then
         AC_CACHE_VAL([xs_cv_have_sidplayfp],
@@ -203,14 +207,21 @@
             xs_sidplayfp_cflags=`$PKG_CONFIG --libs libsidplayfp`
             xs_sidplayfp_ldflags=`$PKG_CONFIG --libs libsidplayfp`
 
-            XS_TRY_LIBRARY([sidplayfp],
-                [$xs_sidplayfp_cxxflags -DHAVE_UNIX], [$xs_sidplayfp_ldflags],
-                [sidplayfp], [sidplayfp/sidplay2.h], [sidplay2 *myEngine;])
+            if test "x$xs_pkg_sidplayfp_v1" = "xyes"; then
+                XS_TRY_LIBRARY([sidplayfp],
+                    [$xs_sidplayfp_cxxflags -DHAVE_UNIX], [$xs_sidplayfp_ldflags],
+                    [sidplayfp], [sidplayfp/sidplayfp.h], [sidplayfp *myEngine;])
+            else
+                XS_TRY_LIBRARY([sidplayfp],
+                    [$xs_sidplayfp_cxxflags -DHAVE_UNIX], [$xs_sidplayfp_ldflags],
+                    [sidplayfp], [sidplayfp/sidplay2.h], [sidplay2 *myEngine;])
+            fi
 
             if test "x$xs_sidplayfp_works" = "xyes"; then
               xs_cv_have_sidplayfp="xs_have_sidplayfp=yes  \
                 xs_sidplayfp_cxxflags=\"$xs_sidplayfp_cxxflags\"  \
-                xs_sidplayfp_ldflags=\"$xs_sidplayfp_ldflags\""
+                xs_sidplayfp_ldflags=\"$xs_sidplayfp_ldflags\" \
+                xs_pkg_sidplayfp_v1=\"$xs_pkg_sidplayfp_v1\" "
             fi
         ])
     fi
@@ -224,10 +235,10 @@
             AC_MSG_RESULT([yes])
         fi
 
-        SIDPLAY2_LIBS="$xs_sidplayfp_ldflags"
-        SIDPLAY2_CFLAGS="$xs_sidplayfp_cxxflags"
-        AC_SUBST([SIDPLAY2_LIBS])dnl
-        AC_SUBST([SIDPLAY2_CFLAGS])dnl
+        SIDPLAYFP_LIBS="$xs_sidplayfp_ldflags"
+        SIDPLAYFP_CFLAGS="$xs_sidplayfp_cxxflags"
+        AC_SUBST([SIDPLAYFP_LIBS])dnl
+        AC_SUBST([SIDPLAYFP_CFLAGS])dnl
     else
         AC_MSG_RESULT([no])
     fi
@@ -247,7 +258,6 @@
     PKG_CHECK_EXISTS([libsidplay2 >= 2.1.1], [xs_pkg_sidplay2="yes"], [])
 
     if test "x$xs_pkg_sidplay2" = "xyes"; then
-
         AC_CACHE_VAL([xs_cv_have_sidplay2],
         [
             xs_sidplay2_cflags=`$PKG_CONFIG --libs libsidplay2`
--- a/configure.ac	Thu Nov 08 20:58:45 2012 +0200
+++ b/configure.ac	Thu Nov 08 21:24:38 2012 +0200
@@ -21,7 +21,8 @@
 AH_TEMPLATE([HAVE_SONG_POSITION], [Define if you have XMMS patched with the songpos patch.])
 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_SIDPLAY2_FP], [Define if you have and want to use libSIDPlay 2-FP http://sourceforge.net/projects/sidplay-residfp/])
+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_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.])
 
@@ -116,30 +117,32 @@
 fi
 
 
-xs_have_sidplay2_api=""
 XS_ARG_WITH([sidplayfp], [libSIDPlayFP], [XS_PATH_LIBSIDPLAYFP])
+	if test "x$xs_pkg_sidplayfp_v1" = "xyes"; then
+		AC_DEFINE([HAVE_SIDPLAYFP_V1])
+		xs_have_sidplay2_api="(FP v1.0 (alpha) API)"
+	fi
+fi
 
 if test "x$xs_have_sidplayfp" = "xyes"; then
-	xs_have_sidplay2_api="(FP)"
-	xs_have_sidplay2_lib="yes"
-	AC_DEFINE([HAVE_SIDPLAY2])
-	AC_DEFINE([HAVE_SIDPLAY2_FP])
+	AC_DEFINE([HAVE_SIDPLAYFP])
 	AC_DEFINE([HAVE_HARDSID_BUILDER])
 	AC_DEFINE([HAVE_RESID_BUILDER])
 	AC_DEFINE([HAVE_RESID_FP_BUILDER])
 
-else
+xs_have_sidplay2_api=""
 XS_ARG_WITH([sidplay2], [libSIDPlay2], [XS_PATH_LIBSIDPLAY2])
 if test "x$xs_have_sidplay2" = "xyes"; then
-	xs_have_sidplay2_api="(non-COMI)"
-	xs_have_sidplay2_lib="yes"
+	xs_have_sidplay2_api="(old non-COMI)"
 	AC_DEFINE([HAVE_SIDPLAY2])
 
 	AC_LANG_PUSH([C++])
 	
 	XS_BUILDERS_CHECK
         xs_builders_available="no"
+	dnl This is a faux check, to satisfy things
 	XS_BUILDERS_FIND([reSID_FP], [residfp-builder], [residfp.h], [ReSIDfpBuilder])
+	dnl These checks are real
 	XS_BUILDERS_FIND([reSID], [resid-builder], [resid.h], [ReSIDBuilder])
 	XS_BUILDERS_FIND([HardSID], [hardsid-builder], [hardsid.h], [HardSID])
 	if test "x$xs_builders_available" = "xno"; then
@@ -148,14 +151,13 @@
 
 	AC_LANG_POP([C++])
 fi
-fi
 
 
 dnl ***
 dnl *** Check if we have some emulator library available?
 dnl ***
 if test "x$xs_have_sidplay1" != "xyes" -a "x$xs_have_sidplay2" != "xyes" -a "x$xs_have_sidplayfp" != "xyes"; then
-	AC_MSG_ERROR([Either libSIDPlay1 or libSIDPlay2/libSIDPlay-FP is required! Please read INSTALL for more information!])
+	AC_MSG_ERROR([Either libSIDPlay1, libSIDPlay2 or libSIDPlay2-FP is required! Please read INSTALL for more information!])
 fi
 
 
@@ -208,8 +210,9 @@
 	Plugin installation directory : $libdir
 	Song-position patch           : $xs_have_songpos
 	libSIDPlay 1 support          : $xs_have_sidplay1
-	libSIDPlay 2 support          : $xs_have_sidplay2_lib $xs_have_sidplay2_api
+	libSIDPlay 2 support          : $xs_have_sidplay2 $xs_have_sidplay2_api
 	    Included builders         : $xs_builders
+	libSIDPlay 2-FP support       : $xs_have_sidplayfp
 	XMMS-SID theme SID-tune       : $xs_have_themetune
 	Translations (i18n/nls)       : $USE_NLS
 	Debugging enabled             : $xs_enable_debug
--- a/src/config.h.in	Thu Nov 08 20:58:45 2012 +0200
+++ b/src/config.h.in	Thu Nov 08 21:24:38 2012 +0200
@@ -52,13 +52,12 @@
 /* Define if you have and want to use libSIDPlay2 */
 #undef HAVE_SIDPLAY2
 
-/* Define if you have and want to use libSIDPlay 2-FP
-   http://sourceforge.net/projects/sidplay-residfp/ */
-#undef HAVE_SIDPLAY2_FP
-
 /* 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 have XMMS patched with the songpos patch. */
 #undef HAVE_SONG_POSITION
 
--- a/src/xs_sidplay.h	Thu Nov 08 20:58:45 2012 +0200
+++ b/src/xs_sidplay.h	Thu Nov 08 21:24:38 2012 +0200
@@ -67,7 +67,7 @@
         info.infoString[0], info.infoString[1], info.infoString[2],
         info.loadAddr, info.initAddr, info.playAddr,
         info.dataFileLen, info.formatString,
-#if defined(XS_SIDPLAY2_H) && defined(HAVE_SIDPLAY2_FP)
+#if defined(XS_SIDPLAYFP_H) && defined(HAVE_SIDPLAYFP)
         info.sidModel1
 #else
         info.sidModel
@@ -103,17 +103,18 @@
         return FALSE;
 
     /* Get currently playing tune information */
-#ifdef XS_SIDPLAY1_H
+#if defined(XS_SIDPLAY1_H)
     engine->tune->getInfo(info);
-#endif
-#ifdef XS_SIDPLAY2_H
+#elif defined(XS_SIDPLAY2_H)
+    info = engine->tune.getInfo();
+#elif defined(XS_SIDPLAYFP_H)
     info = engine->tune.getInfo();
 #endif
 
     /* NOTICE! Here we assume that libSIDPlay[12] headers define
      * SIDTUNE_SIDMODEL_* similarly to our enums in xs_config.h ...
      */
-#if defined(XS_SIDPLAY2_H) && defined(HAVE_SIDPLAY2_FP)
+#if defined(XS_SIDPLAYFP_H) && defined(HAVE_SIDPLAYFP)
     state->tuneInfo->sidModel = info.sidModel1;
 #else
     state->tuneInfo->sidModel = info.sidModel;
--- a/src/xs_sidplay2.cpp	Thu Nov 08 20:58:45 2012 +0200
+++ b/src/xs_sidplay2.cpp	Thu Nov 08 21:24:38 2012 +0200
@@ -1,7 +1,7 @@
 /*
    XMMS-SID - SIDPlay input plugin for X MultiMedia System (XMMS)
 
-   libSIDPlay v2 support
+   libSIDPlay2 support
 
    Programmed and designed by Matti 'ccr' Hamalainen <ccr@tnsp.org>
    (C) Copyright 1999-2012 Tecnic Software productions (TNSP)
@@ -418,7 +418,8 @@
  */
 void xs_sidplay2_delete(XSEngineState * state)
 {
-    XSSIDPlay2 *engine = (XSSIDPlay2 *) state->internal;
+    (void) state;
+//    XSSIDPlay2 *engine = (XSSIDPlay2 *) state->internal;
 }
 
 
--- a/src/xs_sidplayfp.cpp	Thu Nov 08 20:58:45 2012 +0200
+++ b/src/xs_sidplayfp.cpp	Thu Nov 08 21:24:38 2012 +0200
@@ -1,7 +1,7 @@
 /*
    XMMS-SID - SIDPlay input plugin for X MultiMedia System (XMMS)
 
-   libSIDPlay v2-FP support
+   libSIDPlay2-FP support
 
    Programmed and designed by Matti 'ccr' Hamalainen <ccr@tnsp.org>
    (C) Copyright 1999-2012 Tecnic Software productions (TNSP)
@@ -22,14 +22,14 @@
 */
 #include "xmms-sid.h"
 
-#ifdef HAVE_SIDPLAY2_FP
+#ifdef HAVE_SIDPLAYFP
 
-#include <stdio.h>
-#include "xs_sidplay2.h"
+#include "xs_sidplayfp.h"
+#include "xs_slsup.h"
 #include "xs_config.h"
 
 
-#ifdef HAVE_SIDPLAY2_FP_V1
+#ifdef HAVE_SIDPLAYFP_V1
 #  include <sidplayfp/SidTune.h>
 #  include <sidplayfp/sidplayfp.h>
 #  include <sidplayfp/event.h>
@@ -44,22 +44,25 @@
 
 class XSSIDPlayFP {
 public:
-#ifdef HAVE_SIDPLAY2_FP_V1
+#ifdef HAVE_SIDPLAYFP_V1
     sidplayfp emu;
     SidConfig config;
 #else
     sidplay2 emu;
     sid2_config_t config;
 #endif
-    SidTune tune;
+    SidTuneMod tune;
 
     XSSIDPlayFP(void);
     virtual ~XSSIDPlayFP(void);
 };
 
 
-#ifdef HAVE_RESID_BUILDER
+#ifdef HAVE_RESID_FP_BUILDER
 #  include <sidplayfp/builders/residfp.h>
+#endif
+
+#ifdef HAVE_RESID_FP_BUILDER
 #  include <sidplayfp/builders/resid.h>
 #endif
 
@@ -91,7 +94,7 @@
 #define TTUNEINFO              SidTuneInfo
 #define TTUNE                  SidTune
 
-#ifdef HAVE_SIDPLAY2_FP_V1
+#ifdef HAVE_SIDPLAYFP_V1
 #define sid2_mono              SidConfig::MONO
 #define sid2_stereo            SidConfig::STEREO
 #define SID2_MOS8580           SidConfig::MOS8580
@@ -160,7 +163,7 @@
         case XS_BLD_RESID:
             {
                 ReSIDBuilder *rs = new ReSIDBuilder("ReSID builder");
-#ifdef HAVE_SIDPLAY2_FP_V1
+#ifdef HAVE_SIDPLAYFP_V1
                 if (rs && rs->getStatus())
                 {
                 }
@@ -173,7 +176,7 @@
                     if (!*rs) return FALSE;
                     rs->bias(0.0f);
                 }
-#endif // HAVE_SIDPLAY2_FP_V1
+#endif // HAVE_SIDPLAYFP_V1
             }
             break;
 #endif // HAVE_RESID_BUILDER
@@ -255,7 +258,7 @@
     engine->config.sidDefault  = xs_cfg.mos8580 ? SID2_MOS8580 : SID2_MOS6581;
     engine->config.clockForced = xs_cfg.forceSpeed;
 
-#ifndef HAVE_SIDPLAY2_FP_V1
+#ifndef HAVE_SIDPLAYFP_V1
     engine->config.sidSamples  = TRUE;
     engine->config.sidModel    = xs_cfg.forceModel ? engine->config.sidDefault : SID2_MODEL_CORRECT;
     engine->config.clockSpeed  = xs_cfg.forceSpeed ? engine->config.clockDefault : SID2_CLOCK_CORRECT;
@@ -359,7 +362,8 @@
  */
 void xs_sidplayfp_delete(XSEngineState * state)
 {
-    XSSIDPlayFP *engine = (XSSIDPlayFP *) state->internal;
+    (void) state;
+//    XSSIDPlayFP *engine = (XSSIDPlayFP *) state->internal;
 }
 
 
@@ -379,4 +383,4 @@
 
 
 }    /* extern "C" */
-#endif    /* HAVE_SIDPLAY2_FP */
+#endif    /* HAVE_SIDPLAYFP */