Mercurial > hg > xmms-sid
changeset 271:eebb38debe35
Separate xs_init_configuration() from xs_read_configuration()
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 23 Dec 2004 17:03:02 +0000 |
parents | 583f5651abff |
children | 4af5e6c1d968 |
files | src/xs_config.c src/xs_config.h |
diffstat | 2 files changed, 24 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/src/xs_config.c Thu Dec 23 17:02:05 2004 +0000 +++ b/src/xs_config.c Thu Dec 23 17:03:02 2004 +0000 @@ -160,18 +160,15 @@ #define XS_SIDPLAY1_FT (0.05f) /* - * Get the configuration (from file or default) + * Reset/initialize the configuration */ -void xs_read_configuration(void) +void xs_init_configuration(void) { - gchar *cfgFilename, *tmpStr; - ConfigFile *cfgFile; - gint i; - + /* Lock configuration mutex */ XSDEBUG("initializing configuration ...\n"); XS_MUTEX_LOCK(xs_cfg); - /* Pre-initialize configuration structure */ + /* Initialize values with sensible defaults */ xs_cfg.audioBitsPerSample = XS_RES_16BIT; xs_cfg.audioChannels = XS_CHN_MONO; xs_cfg.audioFrequency = 44100; @@ -206,7 +203,7 @@ xs_cfg.sid2Builder = XS_BLD_HARDSID; #else #ifdef HAVE_SIDPLAY2 -#error This should not happen! No SIDPlay2 builders! +#error This should not happen! No supported SIDPlay2 builders configured in! #endif #endif #endif @@ -250,8 +247,24 @@ xs_cfg.subAutoMinTime = 15; - /* Try to open the XMMS configuration file */ + /* Unlock the configuration */ + XS_MUTEX_UNLOCK(xs_cfg); +} + + +/* + * Get the configuration (from file or default) + */ +void xs_read_configuration(void) +{ + gchar *cfgFilename, *tmpStr; + ConfigFile *cfgFile; + gint i; + + /* Try to open the XMMS configuration file */ + XS_MUTEX_LOCK(xs_cfg); XSDEBUG("loading from config-file ...\n"); + #ifdef HAVE_NODEFAULTCFG cfgFilename = g_strconcat(g_get_home_dir(), XS_CONFIG_FILE, NULL); cfgFile = xmms_cfg_open_file(cfgFilename); @@ -320,9 +333,7 @@ XSDEBUG("writing configuration ...\n"); XS_MUTEX_LOCK(xs_cfg); - /* - * Try to open the XMMS configuration file - */ + /* Try to open the XMMS configuration file */ #ifdef HAVE_NODEFAULTCFG cfgFilename = g_strconcat(g_get_home_dir(), XS_CONFIG_FILE, NULL); cfgFile = xmms_cfg_open_file(cfgFilename);