// Create the sid emulation bool ConsolePlayer::createSidEmu (SIDEMUS emu) { // Remove old driver and emulation if (m_engCfg.sidEmulation) { sidbuilder *builder = m_engCfg.sidEmulation; m_engCfg.sidEmulation = NULL; m_engine.config (m_engCfg); delete builder; } // Now setup the sid emulation switch (emu) { #ifdef HAVE_SIDPLAYFP_BUILDERS_RESIDFP_H case EMU_RESIDFP: { #ifdef HAVE_EXCEPTIONS ReSIDfpBuilder *rs = new(std::nothrow) ReSIDfpBuilder( RESIDFP_ID ); #else ReSIDfpBuilder *rs = new ReSIDfpBuilder( RESIDFP_ID ); #endif if (rs) { m_engCfg.sidEmulation = rs; if (!rs->getStatus()) goto createSidEmu_error; rs->create ((m_engine.info ()).maxsids()); if (!rs->getStatus()) goto createSidEmu_error; if (m_filter.filterCurve6581) rs->filter6581Curve(m_filter.filterCurve6581); if (m_filter.filterCurve8580) rs->filter8580Curve((double)m_filter.filterCurve8580); } break; } #endif // HAVE_SIDPLAYFP_BUILDERS_RESIDFP_H #ifdef HAVE_SIDPLAYFP_BUILDERS_RESID_H case EMU_RESID: { #ifdef HAVE_EXCEPTIONS ReSIDBuilder *rs = new(std::nothrow) ReSIDBuilder( RESID_ID ); #else ReSIDBuilder *rs = new ReSIDfpBuilder( RESID_ID ); #endif if (rs) { m_engCfg.sidEmulation = rs; if (!rs->getStatus()) goto createSidEmu_error; rs->create ((m_engine.info ()).maxsids()); if (!rs->getStatus()) goto createSidEmu_error; rs->bias(m_filter.bias); } break; } #endif // HAVE_SIDPLAYFP_BUILDERS_RESID_H #ifdef HAVE_SIDPLAYFP_BUILDERS_HARDSID_H case EMU_HARDSID: { #ifdef HAVE_EXCEPTIONS HardSIDBuilder *hs = new(std::nothrow) HardSIDBuilder( HARDSID_ID ); #else HardSIDBuilder *hs = new HardSIDBuilder( HARDSID_ID ); #endif if (hs) { m_engCfg.sidEmulation = hs; if (!hs->getStatus()) goto createSidEmu_error; hs->create ((m_engine.info ()).maxsids()); if (!hs->getStatus()) goto createSidEmu_error; } break; } #endif // HAVE_SIDPLAYFP_BUILDERS_HARDSID_H default: // Emulation Not yet handled // This default case results in the default // emulation break; } if (!m_engCfg.sidEmulation) { if (emu > EMU_DEFAULT) { // No sid emulation? displayError (ERR_NOT_ENOUGH_MEMORY); return false; } } if (m_engCfg.sidEmulation) { /* set up SID filter. HardSID just ignores call with def. */ m_engCfg.sidEmulation->filter(m_filter.enabled); } return true; createSidEmu_error: displayError (m_engCfg.sidEmulation->error ()); delete m_engCfg.sidEmulation; m_engCfg.sidEmulation = NULL; return false; }