changeset 3134:354e90c81253

crossfade: more cleanups
author Michal Lipski <tallica@o2.pl>
date Thu, 07 May 2009 13:13:54 +0200
parents 005959102811
children 85b7dcee821f
files src/crossfade/cfgutil.c src/crossfade/configure.c src/crossfade/crossfade.c src/crossfade/crossfade.h
diffstat 4 files changed, 5 insertions(+), 72 deletions(-) [+]
line wrap: on
line diff
--- a/src/crossfade/cfgutil.c	Thu May 07 00:36:39 2009 -0500
+++ b/src/crossfade/cfgutil.c	Thu May 07 13:13:54 2009 +0200
@@ -313,10 +313,6 @@
 	{
 		/* *INDENT-OFF* */
 		/* config items used in v0.1 */
-		xmms_cfg_read_int    (cfgfile, section, "audio_device",         &config->oss_audio_device);
-		xmms_cfg_read_boolean(cfgfile, section, "use_alt_audio_device", &config->oss_use_alt_audio_device);
-		xmms_cfg_read_string (cfgfile, section, "alt_audio_device",     &config->oss_alt_audio_device);
-		xmms_cfg_read_int    (cfgfile, section, "mixer_device",         &config->oss_mixer_device);
 		xmms_cfg_read_string (cfgfile, section, "output_plugin",        &config->op_name);
 		xmms_cfg_read_string (cfgfile, section, "op_config_string",     &config->op_config_string);
 		xmms_cfg_read_int    (cfgfile, section, "buffer_size",          &config->mix_size_ms);
@@ -353,7 +349,6 @@
 		xmms_cfg_read_boolean(cfgfile, section, "effect_enable",        &config->ep_enable);
 
 		/* config items introduced by v0.3.0 */
-		xmms_cfg_read_boolean(cfgfile, section, "use_alt_mixer_device", &config->oss_use_alt_mixer_device);
 		xmms_cfg_read_boolean(cfgfile, section, "volnorm_enable",       &config->volnorm_enable);
 		xmms_cfg_read_boolean(cfgfile, section, "volnorm_use_qa",       &config->volnorm_use_qa);
 		xmms_cfg_read_int    (cfgfile, section, "volnorm_target",       &config->volnorm_target);
@@ -366,7 +361,7 @@
 		xmms_cfg_read_boolean(cfgfile, section, "no_xfade_if_same_file",&config->no_xfade_if_same_file);
 
 		/* config items introduced by v0.3.3 */
-		xmms_cfg_read_string (cfgfile, section, "alt_mixer_device",     &config->oss_alt_mixer_device);
+		//xmms_cfg_read_string (cfgfile, section, "alt_mixer_device",     &config->oss_alt_mixer_device);
 		xmms_cfg_read_boolean(cfgfile, section, "gap_crossing",         &config->gap_crossing);
 
 		/* fade configs */
@@ -413,10 +408,6 @@
 		xmms_cfg_remove_key(cfgfile, section, "gap_lead_length");
 
 		/* config items used in v0.1 */
-		xmms_cfg_write_int    (cfgfile, section, "audio_device",         config->oss_audio_device);
-		xmms_cfg_write_boolean(cfgfile, section, "use_alt_audio_device", config->oss_use_alt_audio_device);
-		xmms_cfg_write_string (cfgfile, section, "alt_audio_device",     config->oss_alt_audio_device ? config->oss_alt_audio_device : DEFAULT_OSS_ALT_AUDIO_DEVICE);
-		xmms_cfg_write_int    (cfgfile, section, "mixer_device",         config->oss_mixer_device);
 		xmms_cfg_write_string (cfgfile, section, "output_plugin",        config->op_name ? config->op_name : DEFAULT_OP_NAME);
 		xmms_cfg_write_string (cfgfile, section, "op_config_string",     config->op_config_string ? config->op_config_string : DEFAULT_OP_CONFIG_STRING);
 		xmms_cfg_write_int    (cfgfile, section, "buffer_size",          config->mix_size_ms);
@@ -449,7 +440,6 @@
 		xmms_cfg_write_int    (cfgfile, section, "op_max_used_ms",       config->op_max_used_ms);
 
 		/* config items introduced by v0.3.0 */
-		xmms_cfg_write_boolean(cfgfile, section, "use_alt_mixer_device", config->oss_use_alt_mixer_device);
 #ifdef VOLUME_NORMALIZER
 		xmms_cfg_write_boolean(cfgfile, section, "volnorm_enable",       config->volnorm_enable);
 		xmms_cfg_write_boolean(cfgfile, section, "volnorm_use_qa",       config->volnorm_use_qa);
@@ -464,7 +454,6 @@
 		xmms_cfg_write_boolean(cfgfile, section, "no_xfade_if_same_file",config->no_xfade_if_same_file);
 
 		/* config items introduced by v0.3.2 */
-		xmms_cfg_write_string (cfgfile, section, "alt_mixer_device",     config->oss_alt_mixer_device ? config->oss_alt_mixer_device : DEFAULT_OSS_ALT_MIXER_DEVICE);
 		xmms_cfg_write_boolean(cfgfile, section, "gap_crossing",         config->gap_crossing);
 
 		/* fade configs */
@@ -490,8 +479,6 @@
 void
 xfade_free_config()
 {
-	SAFE_FREE(xfg->oss_alt_audio_device);
-	SAFE_FREE(xfg->oss_alt_mixer_device);
 	SAFE_FREE(xfg->op_config_string);
 	SAFE_FREE(xfg->op_name);
 
--- a/src/crossfade/configure.c	Thu May 07 00:36:39 2009 -0500
+++ b/src/crossfade/configure.c	Thu May 07 13:13:54 2009 +0200
@@ -1002,16 +1002,12 @@
 	MUTEX_LOCK(&buffer_mutex);
 
 	/* free existing strings */
-	if (config->oss_alt_audio_device) g_free(config->oss_alt_audio_device);
-	if (config->oss_alt_mixer_device) g_free(config->oss_alt_mixer_device);
 	if (config->op_config_string)     g_free(config->op_config_string);
 	if (config->op_name)              g_free(config->op_name);
 	if (config->ep_name)              g_free(config->ep_name);
 
 	/* copy current settings (dupping the strings) */
 	*config = *xfg;
-	config->oss_alt_audio_device = g_strdup(xfg->oss_alt_audio_device);
-	config->oss_alt_mixer_device = g_strdup(xfg->oss_alt_mixer_device);
 	config->op_config_string = g_strdup(xfg->op_config_string);
 	config->op_name = g_strdup(xfg->op_name);
 	config->ep_name = g_strdup(xfg->ep_name);
@@ -1054,16 +1050,12 @@
 		gtk_signal_connect(GTK_OBJECT(config_win), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &config_win);
 
 		/* free any strings that might be left in our local copy of the config */
-		if (xfg->oss_alt_audio_device) g_free(xfg->oss_alt_audio_device);
-		if (xfg->oss_alt_mixer_device) g_free(xfg->oss_alt_mixer_device);
 		if (xfg->op_config_string)     g_free(xfg->op_config_string);
 		if (xfg->op_name)              g_free(xfg->op_name);
 		if (xfg->ep_name)              g_free(xfg->ep_name);
 
 		/* copy current settings (dupping the strings) */
 		*xfg = *config;
-		xfg->oss_alt_audio_device = g_strdup(config->oss_alt_audio_device);
-		xfg->oss_alt_mixer_device = g_strdup(config->oss_alt_mixer_device);
 		xfg->op_config_string     = g_strdup(config->op_config_string);
 		xfg->op_name              = g_strdup(config->op_name);
 		xfg->ep_name              = g_strdup(config->ep_name);
--- a/src/crossfade/crossfade.c	Thu May 07 00:36:39 2009 -0500
+++ b/src/crossfade/crossfade.c	Thu May 07 13:13:54 2009 +0200
@@ -347,7 +347,7 @@
 	DEBUG(("\n"));
 
 	/* setup sample rate (note that OUTPUT_RATE is #defined as the_rate) */
-	the_rate = config->output_rate;
+	//the_rate = config->output_rate;
 
 	/* setup out_format. use host byte order for easy math */
 	setup_format(FMT_S16_NE, OUTPUT_RATE, OUTPUT_NCH, &out_format);
@@ -378,7 +378,7 @@
 	       B2MS(buffer->preload_size),
 	       B2MS(buffer->sync_size),
 	       B2MS(buffer->size),
-	       the_rate));
+	       OUTPUT_RATE));
 
 	/* allocate buffer */
 	if (!(buffer->data = g_malloc0(buffer->size)))
@@ -421,9 +421,6 @@
 	xfade_load_config();
 
 	/* set default strings if there is no existing config */
-	if (!config->oss_alt_audio_device) config->oss_alt_audio_device = g_strdup(DEFAULT_OSS_ALT_AUDIO_DEVICE);
-	if (!config->oss_alt_mixer_device) config->oss_alt_mixer_device = g_strdup(DEFAULT_OSS_ALT_MIXER_DEVICE);
-	if (!config->op_config_string)     config->op_config_string     = g_strdup(DEFAULT_OP_CONFIG_STRING);
 	if (!config->op_name)              config->op_name              = g_strdup(DEFAULT_OP_NAME);
 
 	/* check for realtime priority, it needs some special attention */
--- a/src/crossfade/crossfade.h	Thu May 07 00:36:39 2009 -0500
+++ b/src/crossfade/crossfade.h	Thu May 07 13:13:54 2009 +0200
@@ -46,7 +46,7 @@
 
 #undef  VOLUME_NORMALIZER
 
-#define OUTPUT_RATE the_rate
+#define OUTPUT_RATE 44100 /*FIXME I know...*/
 #define OUTPUT_NCH  2
 #define OUTPUT_BPS (OUTPUT_RATE * OUTPUT_NCH * 2)
 
@@ -58,10 +58,6 @@
 
 #define SYNC_OUTPUT_TIMEOUT 2000
 
-#define OUTPUT_METHOD_BUILTIN_OSS  0
-#define OUTPUT_METHOD_PLUGIN       1
-#define OUTPUT_METHOD_BUILTIN_NULL 2
-
 #define FADE_CONFIG_XFADE   0
 #define FADE_CONFIG_MANUAL  1
 #define FADE_CONFIG_ALBUM   2
@@ -123,8 +119,6 @@
 #define FC_OFFSET_LOCK_OUT 2
 #define FC_OFFSET_CUSTOM   3
 
-#define DEFAULT_OSS_ALT_AUDIO_DEVICE "/dev/dsp"
-#define DEFAULT_OSS_ALT_MIXER_DEVICE "/dev/mixer"
 #define DEFAULT_OP_CONFIG_STRING     "OSS.so=0,1,2304,0; filewriter.so=1,0,2304,1"
 #define DEFAULT_OP_NAME              "ALSA.so"
 
@@ -132,22 +126,7 @@
 { FALSE, FALSE, 2304, FALSE }
 
 #define CONFIG_DEFAULT							\
-{ 1,                            /* output_method */			\
-  44100,                        /* output_rate */			\
-  2,                            /* output_quality */			\
-  0,                            /* oss_audio_device */			\
-  FALSE,                        /* oss_use_alt_audio_device */		\
-  NULL,                         /* oss_alt_audio_device */		\
-  0,                            /* oss_mixer_device */			\
-  FALSE,                        /* oss_use_alt_mixer_device */		\
-  NULL,                         /* oss_alt_mixer_device */		\
-  FALSE,                        /* oss_mixer_use_master */		\
-  0,                            /* oss_buffer_size_ms */		\
-  250,                          /* oss_preload_size_ms */		\
-  22,                           /* oss_fragments */			\
-  12,                           /* oss_fragment_size */			\
-  FALSE,                        /* oss_maxbuf_enable */			\
-  NULL,                         /* op_config_string */			\
+{ NULL,                         /* op_config_string */			\
   NULL,                         /* op_name */				\
   NULL,                         /* ep_name */				\
   FALSE,                        /* ep_enable */				\
@@ -454,28 +433,6 @@
 
 typedef struct
 {
-	/* output: method */
-	gint output_method;
-	gint output_rate;
-	gint output_quality;
-
-	/* output: builtin OSS */
-	gint oss_audio_device;
-	gboolean oss_use_alt_audio_device;
-	gchar *oss_alt_audio_device;
-
-	gint oss_mixer_device;
-	gboolean oss_use_alt_mixer_device;
-	gchar *oss_alt_mixer_device;
-	gboolean oss_mixer_use_master;
-
-	gint oss_buffer_size_ms;
-	gint oss_preload_size_ms;
-
-	gint oss_fragments;
-	gint oss_fragment_size;
-	gboolean oss_maxbuf_enable;
-
 	/* output: plugin */
 	gchar *op_config_string;  /* stores configs for all plugins */
 	gchar *op_name;           /* name of the current plugin */