Mercurial > hg > xmms-sid
diff src/xs_sidplay2.cpp @ 847:5b93bd8c7814
Cleanups, adjust backend configuration sequences, more error checking,
improved debug output.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 08 Nov 2012 22:44:36 +0200 |
parents | ae1f6418d093 |
children | 2663b1ac9ce6 |
line wrap: on
line diff
--- a/src/xs_sidplay2.cpp Thu Nov 08 22:43:45 2012 +0200 +++ b/src/xs_sidplay2.cpp Thu Nov 08 22:44:36 2012 +0200 @@ -113,6 +113,8 @@ gint i; assert(state); + XSDEBUG("SIDPlay2 backend initializing.\n"); + /* Allocate internal structures */ engine = new XSSIDPlay2(); state->internal = engine; @@ -120,6 +122,7 @@ return FALSE; /* Get current configuration */ + XSDEBUG("SIDPlay2 emulation configuration\n"); engine->config = engine->emu.config(); /* Configure channels and stuff */ @@ -225,67 +228,6 @@ tmpFilter.cutoff[i][1] = f->points[i].y; } - /* Initialize builder object */ - XSDEBUG("init builder #%i, maxsids=%i\n", xs_cfg.sid2Builder, (engine->emu.info()).maxsids); - - switch (xs_cfg.sid2Builder) - { -#ifdef HAVE_RESID_BUILDER - case XS_BLD_RESID: - { - ReSIDBuilder *rs = new ReSIDBuilder("ReSID builder"); - if (rs) - { - engine->config.sidEmulation = rs; - if (!*rs) return FALSE; - rs->create((engine->emu.info()).maxsids); - if (!*rs) return FALSE; - } - } - break; -#endif - -#ifdef HAVE_HARDSID_BUILDER - case XS_BLD_HARDSID: - { - HardSIDBuilder *hs = new HardSIDBuilder("HardSID builder (FP)"); - engine->config.sidEmulation = (sidbuilder *) hs; - if (hs) - { - hs->create((engine->emu.info()).maxsids); - if (!*hs) - { - xs_error("hardSID->create() failed.\n"); - return FALSE; - } - } - } - break; -#endif - - default: - xs_error("[SIDPlay2] Invalid or unsupported builder selected.\n"); - break; - } - - if (!engine->config.sidEmulation) - { - xs_error("[SIDPlay2] Could not initialize SIDBuilder object.\n"); - return FALSE; - } - -#if 0 - // Setup filter - engine->config.sidEmulation->filter(xs_cfg.emulateFilters); - if (!*(engine->config.sidEmulation)) - { - xs_error("builder->filter(%d) failed.\n", xs_cfg.emulateFilters); - return FALSE; - } -#endif - - XSDEBUG("%s\n", engine->config.sidEmulation->credits()); - /* Clockspeed settings */ switch (xs_cfg.clockSpeed) { @@ -327,6 +269,69 @@ engine->config.sidModel = xs_cfg.forceModel ? engine->config.sidDefault : SID2_MODEL_CORRECT; engine->config.sidSamples = TRUE; + + /* Initialize builder object */ + XSDEBUG("init builder #%i, maxsids=%i\n", xs_cfg.sid2Builder, (engine->emu.info()).maxsids); + + switch (xs_cfg.sid2Builder) + { +#ifdef HAVE_RESID_BUILDER + case XS_BLD_RESID: + { + ReSIDBuilder *rs = new ReSIDBuilder("ReSID builder"); + if (rs) + { + engine->config.sidEmulation = rs; + if (!*rs) return FALSE; + rs->create((engine->emu.info()).maxsids); + if (!*rs) return FALSE; + } + } + break; +#endif + +#ifdef HAVE_HARDSID_BUILDER + case XS_BLD_HARDSID: + { + HardSIDBuilder *hs = new HardSIDBuilder("HardSID builder (FP)"); + engine->config.sidEmulation = (sidbuilder *) hs; + if (hs) + { + hs->create((engine->emu.info()).maxsids); + if (!*hs) + { + xs_error("hardSID->create() failed.\n"); + return FALSE; + } + } + } + break; +#endif + + default: + xs_error("[SIDPlay2] Invalid or unsupported builder selected.\n"); + return FALSE; + } + + if (!engine->config.sidEmulation) + { + xs_error("[SIDPlay2] Could not initialize SIDBuilder object.\n"); + return FALSE; + } + +#if 0 + // Setup filter + engine->config.sidEmulation->filter(xs_cfg.emulateFilters); + if (!*(engine->config.sidEmulation)) + { + xs_error("builder->filter(%d) failed.\n", xs_cfg.emulateFilters); + return FALSE; + } +#endif + + XSDEBUG("%s\n", engine->config.sidEmulation->credits()); + + return TRUE; } @@ -337,6 +342,8 @@ { XSSIDPlay2 *engine = (XSSIDPlay2 *) state->internal; + XSDEBUG("SIDPlay2 backend shutdown.\n"); + xs_sidplay2_delete(state); if (engine) @@ -439,4 +446,5 @@ } /* extern "C" */ -#endif /* HAVE_SIDPLAY2 */ +#endif /* HAVE_SIDPLAY2 + */