# HG changeset patch # User Matti Hamalainen # Date 1352400328 -7200 # Node ID c0e892fa914ab53cb1ed66394dce6558156e051d # Parent b158abe91a7593ced4c3c41b2569fc368d7858d9 Begin moving libSIDPlay2-FP stuff to a separete module by removing the relevant parts from the libSIDPlay2 backend interface. diff -r b158abe91a75 -r c0e892fa914a src/xs_sidplay2.cc --- a/src/xs_sidplay2.cc Thu Nov 08 20:44:55 2012 +0200 +++ b/src/xs_sidplay2.cc Thu Nov 08 20:45:28 2012 +0200 @@ -1,7 +1,7 @@ /* XMMS-SID - SIDPlay input plugin for X MultiMedia System (XMMS) - libSIDPlay v2 and libSIDPlay v2-FP support + libSIDPlay v2 support Programmed and designed by Matti 'ccr' Hamalainen (C) Copyright 1999-2012 Tecnic Software productions (TNSP) @@ -28,22 +28,15 @@ #include "xs_slsup.h" #include "xs_config.h" - -#ifdef HAVE_SIDPLAY2_FP -# include -# include -# include +#include +#if G_BYTE_ORDER == G_BIG_ENDIAN +# define SID2_NATIVE_UNSIGNED SID2_BIG_UNSIGNED +# define SID2_NATIVE_SIGNED SID2_BIG_SIGNED +#elif G_BYTE_ORDER == G_LITTLE_ENDIAN +# define SID2_NATIVE_UNSIGNED SID2_LITTLE_UNSIGNED +# define SID2_NATIVE_SIGNED SID2_LITTLE_SIGNED #else -# include -# if G_BYTE_ORDER == G_BIG_ENDIAN -# define SID2_NATIVE_UNSIGNED SID2_BIG_UNSIGNED -# define SID2_NATIVE_SIGNED SID2_BIG_SIGNED -# elif G_BYTE_ORDER == G_LITTLE_ENDIAN -# define SID2_NATIVE_UNSIGNED SID2_LITTLE_UNSIGNED -# define SID2_NATIVE_SIGNED SID2_LITTLE_SIGNED -# else -# error Unsupported endianess! -# endif +# error Unsupported endianess! #endif @@ -59,20 +52,11 @@ #ifdef HAVE_RESID_BUILDER -# ifdef HAVE_SIDPLAY2_FP -# include -# include -# else -# include -# endif +# include #endif #ifdef HAVE_HARDSID_BUILDER -# ifdef HAVE_SIDPLAY2_FP -# include -# else -# include -# endif +# include #endif @@ -124,11 +108,9 @@ gboolean xs_sidplay2_init(XSEngineState * state) { XSSIDPlay2 *engine; -#ifndef HAVE_SIDPLAY2_FP sid_filter_t tmpFilter; xs_sid_filter_t *f; gint i; -#endif assert(state); /* Allocate internal structures */ @@ -183,30 +165,19 @@ /* Audio parameters sanity checking and setup */ -#ifdef HAVE_SIDPLAY2_FP - state->audioBitsPerSample = XS_RES_16BIT; - engine->config.samplingMethod = SID2_RESAMPLE_INTERPOLATE; -#else engine->config.precision = state->audioBitsPerSample; -#endif - engine->config.frequency = state->audioFrequency; switch (state->audioBitsPerSample) { -#ifndef HAVE_SIDPLAY2_FP case XS_RES_8BIT: state->audioFormat = FMT_U8; engine->config.sampleFormat = SID2_LITTLE_UNSIGNED; break; -#endif case XS_RES_16BIT: default: -#ifdef HAVE_SIDPLAY2_FP - state->audioFormat = FMT_S16_NE; -#else switch (state->audioFormat) { case FMT_U16_LE: @@ -234,11 +205,9 @@ engine->config.sampleFormat = SID2_NATIVE_SIGNED; break; } -#endif break; } -#if !defined(HAVE_SIDPLAY2_FP) /* Convert filter */ f = &(xs_cfg.sid2Filter); XSDEBUG("using filter '%s', %d points\n", f->name, f->npoints); @@ -255,7 +224,6 @@ tmpFilter.cutoff[i][0] = f->points[i].x; tmpFilter.cutoff[i][1] = f->points[i].y; } -#endif /* Initialize builder object */ XSDEBUG("init builder #%i, maxsids=%i\n", xs_cfg.sid2Builder, (engine->emu.info()).maxsids); @@ -272,27 +240,6 @@ if (!*rs) return FALSE; rs->create((engine->emu.info()).maxsids); if (!*rs) return FALSE; -#ifdef HAVE_SIDPLAY2_FP - rs->bias(0.0f); -#endif - } - } - break; -#endif - -#ifdef HAVE_RESID_FP_BUILDER - case XS_BLD_RESID_FP: - { - ReSIDfpBuilder *rs = new ReSIDfpBuilder("ReSID builder FP!"); - if (rs) - { - engine->config.sidEmulation = rs; - if (!*rs) return FALSE; - rs->create((engine->emu.info()).maxsids); - if (!*rs) return FALSE; - - rs->filter6581Curve(0.0); - rs->filter8580Curve(0.0); } } break; @@ -327,7 +274,7 @@ return FALSE; } -#ifdef HAVE_SIDPLAY2_FP +#if 0 // Setup filter engine->config.sidEmulation->filter(xs_cfg.emulateFilters); if (!*(engine->config.sidEmulation)) @@ -367,7 +314,6 @@ } -#ifndef HAVE_SIDPLAY2_FP if (xs_cfg.sid2OptLevel < 0 || xs_cfg.sid2OptLevel > SID2_MAX_OPTIMISATION) { xs_error("Invalid sid2OptLevel=%d, falling back to %d.\n", @@ -376,7 +322,6 @@ xs_cfg.sid2OptLevel = SID2_DEFAULT_OPTIMISATION; } engine->config.optimisation = xs_cfg.sid2OptLevel; -#endif engine->config.sidDefault = xs_cfg.mos8580 ? SID2_MOS8580 : SID2_MOS6581; engine->config.sidModel = xs_cfg.forceModel ? engine->config.sidDefault : SID2_MODEL_CORRECT; @@ -444,18 +389,7 @@ if (!engine) return 0; -#if 1 -#ifdef HAVE_SIDPLAY2_FP - int nsamples = audioBufSize / sizeof(short); - return engine->emu.play((short *) audioBuffer, nsamples) * sizeof(short); -#else return engine->emu.play(audioBuffer, audioBufSize); -#endif -#else - int nsamples = audioBufSize / sizeof(short); - fprintf(stderr, "%p, %d -> %d\n", audioBuffer, audioBufSize, nsamples); - return 0; -#endif } @@ -497,13 +431,7 @@ #ifdef HAVE_HARDSID_BUILDER if (xs_cfg.sid2Builder == XS_BLD_HARDSID) { -#ifdef HSID_SID2_COM - IfPtr hs(engine->config.sidEmulation); - if (hs) - hs->flush(); -#else ((HardSIDBuilder *) engine->config.sidEmulation)->flush(); -#endif } #endif }