/* * Shut down XMMS-SID */ void xs_close(void) { xs_tuneinfo_free(xs_status.tuneInfo); xs_status.tuneInfo = NULL; xs_sidplayfp_delete (& xs_status); xs_sidplayfp_close (& xs_status); xs_songlen_close(); xs_stil_close(); }
/* * Initialization functions */ void xs_reinit(void) { XSDEBUG("xs_reinit() thread = %p\n", g_thread_self()); XS_MUTEX_LOCK(xs_status); XS_MUTEX_LOCK(xs_cfg); /* Initialize status and sanitize configuration */ memset(&xs_status, 0, sizeof(xs_status)); if (xs_cfg.audioFrequency < 8000) xs_cfg.audioFrequency = 8000; if (xs_cfg.oversampleFactor < XS_MIN_OVERSAMPLE) xs_cfg.oversampleFactor = XS_MIN_OVERSAMPLE; else if (xs_cfg.oversampleFactor > XS_MAX_OVERSAMPLE) xs_cfg.oversampleFactor = XS_MAX_OVERSAMPLE; if (xs_cfg.audioChannels != XS_CHN_MONO) xs_cfg.oversampleEnable = FALSE; xs_status.audioFrequency = xs_cfg.audioFrequency; xs_status.audioBitsPerSample = xs_cfg.audioBitsPerSample; xs_status.audioChannels = xs_cfg.audioChannels; xs_status.audioFormat = -1; xs_status.oversampleEnable = xs_cfg.oversampleEnable; xs_status.oversampleFactor = xs_cfg.oversampleFactor; /* Try to initialize emulator engine */ xs_init_emu_engine(&xs_cfg.playerEngine, &xs_status); /* Get settings back, in case the chosen emulator backend changed them */ xs_cfg.audioFrequency = xs_status.audioFrequency; xs_cfg.audioBitsPerSample = xs_status.audioBitsPerSample; xs_cfg.audioChannels = xs_status.audioChannels; xs_cfg.oversampleEnable = xs_status.oversampleEnable; XS_MUTEX_UNLOCK(xs_status); XS_MUTEX_UNLOCK(xs_cfg); /* Initialize song-length database */ xs_songlen_close(); if (xs_cfg.songlenDBEnable && (xs_songlen_init() != 0)) { xs_error("Error initializing song-length database!\n"); } /* Initialize STIL database */ xs_stil_close(); if (xs_cfg.stilDBEnable && (xs_stil_init() != 0)) { xs_error("Error initializing STIL database!\n"); } }
/* * Initialization functions */ bool_t xs_init(void) { bool_t success; /* Initialize and get configuration */ xs_init_configuration(); pthread_mutex_lock(&xs_status_mutex); pthread_mutex_lock(&xs_cfg_mutex); /* Initialize status and sanitize configuration */ memset(&xs_status, 0, sizeof(xs_status)); if (xs_cfg.audioFrequency < 8000) xs_cfg.audioFrequency = 8000; xs_status.audioFrequency = xs_cfg.audioFrequency; xs_status.audioChannels = xs_cfg.audioChannels; /* Try to initialize emulator engine */ success = xs_sidplayfp_init(&xs_status); /* Get settings back, in case the chosen emulator backend changed them */ xs_cfg.audioFrequency = xs_status.audioFrequency; xs_cfg.audioChannels = xs_status.audioChannels; pthread_mutex_unlock(&xs_status_mutex); pthread_mutex_unlock(&xs_cfg_mutex); if (! success) return FALSE; /* Initialize song-length database */ xs_songlen_close(); if (xs_cfg.songlenDBEnable && (xs_songlen_init() != 0)) { xs_error("Error initializing song-length database!\n"); } /* Initialize STIL database */ xs_stil_close(); if (xs_cfg.stilDBEnable && (xs_stil_init() != 0)) { xs_error("Error initializing STIL database!\n"); } return TRUE; }
/* * Shut down XMMS-SID */ void xs_close(void) { XSDEBUG("xs_close(): shutting down...\n"); xs_tuneinfo_free(xs_status.tuneInfo); xs_status.tuneInfo = NULL; if (xs_status.sidPlayer) { xs_status.sidPlayer->plrDeleteSID (& xs_status); xs_status.sidPlayer->plrClose (& xs_status); } xs_songlen_close(); xs_stil_close(); XSDEBUG("shutdown finished.\n"); }