changeset 1405:cb985fe460cd trunk

[svn] - libconsole: added an option to ignore length information from spc tags
author giacomo
date Fri, 14 Jul 2006 14:07:10 -0700
parents 383c2527a84b
children f40d0496fda5
files ChangeLog Plugins/Input/console/Audacious_Config.cpp Plugins/Input/console/Audacious_Config.h Plugins/Input/console/Audacious_Driver.cpp
diffstat 4 files changed, 36 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Jul 14 13:13:46 2006 -0700
+++ b/ChangeLog	Fri Jul 14 14:07:10 2006 -0700
@@ -1,3 +1,12 @@
+2006-07-14 20:13:46 +0000  Giacomo Lozito <james@develia.org>
+  revision [1722]
+  - preferences window for libconsole plugin (added missing files)
+
+  Changes:        Modified:
+  +248 -0         trunk/Plugins/Input/console/Audacious_Config.cpp  
+  +34 -0          trunk/Plugins/Input/console/Audacious_Config.h  
+
+
 2006-07-14 20:12:45 +0000  Giacomo Lozito <james@develia.org>
   revision [1720]
   - preferences window for libconsole plugin
--- a/Plugins/Input/console/Audacious_Config.cpp	Fri Jul 14 13:13:46 2006 -0700
+++ b/Plugins/Input/console/Audacious_Config.cpp	Fri Jul 14 14:07:10 2006 -0700
@@ -24,6 +24,7 @@
 	bmp_cfg_db_get_bool(db, "console", "nsfe_playlist", &audcfg.nsfe_playlist);
 	bmp_cfg_db_get_int(db, "console", "treble", &audcfg.treble);
 	bmp_cfg_db_get_int(db, "console", "bass", &audcfg.bass);
+	bmp_cfg_db_get_bool(db, "console", "ignore_spc_length", &audcfg.ignore_spc_length);
 	bmp_cfg_db_close(db);
 }
 
@@ -37,6 +38,7 @@
 	bmp_cfg_db_set_bool(db, "console", "nsfe_playlist", audcfg.nsfe_playlist);
 	bmp_cfg_db_set_int(db, "console", "treble", audcfg.treble);
 	bmp_cfg_db_set_int(db, "console", "bass", audcfg.bass);
+	bmp_cfg_db_set_bool(db, "console", "ignore_spc_length", audcfg.ignore_spc_length);
 	bmp_cfg_db_close(db);
 }
 
@@ -73,6 +75,11 @@
   audcfg.nsfe_playlist = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(cbt) );
 }
 
+static void i_cfg_ev_ignorespclen_enable_commit( gpointer cbt )
+{
+  audcfg.ignore_spc_length = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(cbt) );
+}
+
 static void i_cfg_ev_bok( gpointer configwin )
 {
   console_cfg_save();
@@ -90,7 +97,7 @@
 {
 	static GtkWidget *configwin = NULL;
 	GtkWidget *configwin_vbox;
-	GtkWidget *configwin_gen_vbox, *configwin_nsf_vbox;
+	GtkWidget *configwin_gen_vbox, *configwin_nsf_vbox, *configwin_spc_vbox;
 	GtkWidget *configwin_gen_resample_frame, *configwin_gen_resample_vbox;
 	GtkWidget *configwin_gen_resample_cbt, *configwin_gen_resample_val_hbox;
 	GtkWidget *configwin_gen_resample_val_spbt;
@@ -100,6 +107,7 @@
 	GtkWidget *configwin_gen_playback_tb_treble_hbox, *configwin_gen_playback_tb_treble_spbt;
 	GtkWidget *configwin_gen_playback_deflen_hbox, *configwin_gen_playback_deflen_spbt;
 	GtkWidget *configwin_nsf_nsfeoptpl_cbt;
+	GtkWidget *configwin_spc_ignorespclen_cbt;
 	GtkWidget *hseparator, *hbuttonbox, *button_ok, *button_cancel;
 	GtkWidget *configwin_notebook;
 	GtkTooltips *tips;
@@ -227,6 +235,18 @@
 	gtk_box_pack_start( GTK_BOX(configwin_nsf_vbox) ,
 		configwin_nsf_nsfeoptpl_cbt , FALSE , FALSE , 0 );
 
+	// SPC PAGE
+	configwin_spc_vbox = gtk_vbox_new( FALSE , 3 );
+	gtk_container_set_border_width( GTK_CONTAINER(configwin_spc_vbox), 5 );
+	gtk_notebook_append_page( GTK_NOTEBOOK(configwin_notebook) ,
+		configwin_spc_vbox , gtk_label_new( _("SPC") ) );
+	configwin_spc_ignorespclen_cbt = gtk_check_button_new_with_label( _("Ignore length from SPC tags") );
+	gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(configwin_spc_ignorespclen_cbt) , audcfg.ignore_spc_length );
+	g_signal_connect_swapped( G_OBJECT(button_ok) , "clicked" ,
+		G_CALLBACK(i_cfg_ev_ignorespclen_enable_commit) , configwin_spc_ignorespclen_cbt );
+	gtk_box_pack_start( GTK_BOX(configwin_spc_vbox) ,
+		configwin_spc_ignorespclen_cbt , FALSE , FALSE , 0 );
+
 	// horizontal separator and buttons
 	hbuttonbox = gtk_hbutton_box_new();
 	gtk_button_box_set_layout( GTK_BUTTON_BOX(hbuttonbox) , GTK_BUTTONBOX_END );
--- a/Plugins/Input/console/Audacious_Config.h	Fri Jul 14 13:13:46 2006 -0700
+++ b/Plugins/Input/console/Audacious_Config.h	Fri Jul 14 14:07:10 2006 -0700
@@ -20,6 +20,7 @@
 	gboolean nsfe_playlist; // if true, use optional NSFE playlist
 	gint treble; // -100 to +100
 	gint bass;   // -100 to +100
+	gboolean ignore_spc_length; // if true, ignore length from SPC tags
 }
 AudaciousConsoleConfig;
 
--- a/Plugins/Input/console/Audacious_Driver.cpp	Fri Jul 14 13:13:46 2006 -0700
+++ b/Plugins/Input/console/Audacious_Driver.cpp	Fri Jul 14 14:07:10 2006 -0700
@@ -39,7 +39,7 @@
 //typedef Vfs_File_Reader Audacious_Reader; // will use VFS once it handles gzip transparently
 typedef Gzip_File_Reader Audacious_Reader;
 
-AudaciousConsoleConfig audcfg = { 180, FALSE, 32000, TRUE, 0, 0 };
+AudaciousConsoleConfig audcfg = { 180, FALSE, 32000, TRUE, 0, 0, FALSE };
 static GThread* decode_thread;
 static GStaticMutex playback_mutex = G_STATIC_MUTEX_INIT;
 static int console_ip_is_going;
@@ -671,6 +671,10 @@
 	// set info
 	int length = -1;
 	bool has_length = false;
+	
+	if (( type == type_spc ) && ( audcfg.ignore_spc_length == TRUE ))
+		info.length = -1;
+	
 	char* title = end_get_info( info, &length, &has_length );
 	if ( title )
 	{