changeset 1378:27d9eb18c7cf trunk

[svn] - some improvements to song_change, still sucky - jackd volume saving stuff (via galiyosha)
author nenolod
date Mon, 10 Jul 2006 01:18:38 -0700
parents 61d78065b630
children 5767c05ce900
files ChangeLog Plugins/General/song_change/song_change.c Plugins/Output/jack/jack.c Plugins/Output/jack/jack.h
diffstat 4 files changed, 35 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Jul 09 22:59:20 2006 -0700
+++ b/ChangeLog	Mon Jul 10 01:18:38 2006 -0700
@@ -1,3 +1,13 @@
+2006-07-10 05:59:20 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [1668]
+  - properly respect signedness in get_spc_info_().
+  
+
+  Changes:        Modified:
+  +2 -3           trunk/Plugins/Input/console/Audacious_Driver.cpp  
+  +1 -1           trunk/Plugins/Input/console/Spc_Emu.h  
+
+
 2006-07-08 15:29:18 +0000  Tony Vroon <chainsaw@gentoo.org>
   revision [1666]
   Security fixes from AdPlug CVS (their July 7 commit shortly before the secunia announcement).
--- a/Plugins/General/song_change/song_change.c	Sun Jul 09 22:59:20 2006 -0700
+++ b/Plugins/General/song_change/song_change.c	Mon Jul 10 01:18:38 2006 -0700
@@ -170,7 +170,6 @@
 }
 #endif
 
-#if 0
 static int check_command(char *command)
 {
 	const char *dangerous = "fns";
@@ -186,7 +185,6 @@
 	}
 	return 0;
 }
-#endif
 
 static void configure_ok_cb(GtkWidget *w, gpointer data)
 {
@@ -196,12 +194,10 @@
 	cmd_after = g_strdup(gtk_entry_get_text(GTK_ENTRY(cmd_after_entry)));
 	cmd_end = g_strdup(gtk_entry_get_text(GTK_ENTRY(cmd_end_entry)));
 
-#if 0
 	if (check_command(cmd) < 0 || check_command(cmd_after) < 0
 	                           || check_command(cmd_end) < 0)
-		warn_user();
+		;
 	else
-#endif
 		save_and_close(NULL, NULL);
 	g_free(cmd);
 	g_free(cmd_after);
@@ -223,7 +219,6 @@
 	read_config();
 
 	configure_vbox = gtk_vbox_new(FALSE, 10);
-	gtk_container_add(GTK_CONTAINER(configure_win), configure_vbox);
 
 	song_frame = gtk_frame_new(_("Commands"));
 	gtk_box_pack_start(GTK_BOX(configure_vbox), song_frame, FALSE, FALSE, 0);
@@ -232,7 +227,7 @@
 	gtk_container_add(GTK_CONTAINER(song_frame), song_vbox);
 	
 	cmd_desc = gtk_label_new(_(
-		   "Shell-command to run when Audacious starts a new song."));
+		   "Command to run when Audacious starts a new song."));
 	gtk_label_set_justify(GTK_LABEL(cmd_desc), GTK_JUSTIFY_LEFT);
 	gtk_misc_set_alignment(GTK_MISC(cmd_desc), 0, 0.5);
 	gtk_box_pack_start(GTK_BOX(song_vbox), cmd_desc, FALSE, FALSE, 0);
@@ -255,7 +250,7 @@
 
 
 	cmd_after_desc = gtk_label_new(_(
-		   "Shell-command to run toward the end of a song."));
+		   "Command to run toward the end of a song."));
 	gtk_label_set_justify(GTK_LABEL(cmd_after_desc), GTK_JUSTIFY_LEFT);
 	gtk_misc_set_alignment(GTK_MISC(cmd_after_desc), 0, 0.5);
 	gtk_box_pack_start(GTK_BOX(song_vbox), cmd_after_desc, FALSE, FALSE, 0);
@@ -277,7 +272,7 @@
 
 
 	cmd_end_desc = gtk_label_new(_(
-		"Shell-command to run when Audacious reaches the end "
+		"Command to run when Audacious reaches the end "
 		"of the playlist."));
 	gtk_label_set_justify(GTK_LABEL(cmd_end_desc), GTK_JUSTIFY_LEFT);
 	gtk_misc_set_alignment(GTK_MISC(cmd_end_desc), 0, 0.5);
--- a/Plugins/Output/jack/jack.c	Sun Jul 09 22:59:20 2006 -0700
+++ b/Plugins/Output/jack/jack.c	Mon Jul 10 01:18:38 2006 -0700
@@ -206,11 +206,17 @@
   {
       jack_cfg.isTraceEnabled = FALSE;
       jack_cfg.port_connection_mode = "CONNECT_ALL"; /* default to connect all */
+      jack_cfg.volume_left = 25; /* set default volume to 25 % */
+      jack_cfg.volume_right = 25;
   } else
   {
       bmp_cfg_db_get_bool(cfgfile, "jack", "isTraceEnabled", &jack_cfg.isTraceEnabled);
       if(!bmp_cfg_db_get_string(cfgfile, "jack", "port_connection_mode", &jack_cfg.port_connection_mode))
           jack_cfg.port_connection_mode = "CONNECT_ALL";
+      if(!bmp_cfg_db_get_int(cfgfile, "jack", "volume_left", &jack_cfg.volume_left))
+          jack_cfg.volume_left = 25;
+      if(!bmp_cfg_db_get_int(cfgfile, "jack", "volume_right", &jack_cfg.volume_right))
+          jack_cfg.volume_right = 25;
   }
 
   bmp_cfg_db_close(cfgfile);
@@ -308,6 +314,13 @@
 /* Close the device */
 void jack_close(void)
 {
+  ConfigDb *cfgfile;
+
+  cfgfile = bmp_cfg_db_open();
+  bmp_cfg_db_set_int(cfgfile, "jack", "volume_left", jack_cfg.volume_left); /* stores the volume setting */
+  bmp_cfg_db_set_int(cfgfile, "jack", "volume_right", jack_cfg.volume_right);
+  bmp_cfg_db_close(cfgfile);
+
   TRACE("\n");
 
   JACK_Reset(driver); /* flush buffers, reset position and set state to STOPPED */
@@ -401,6 +414,7 @@
     return 0;
   }
 
+  jack_set_volume(jack_cfg.volume_left, jack_cfg.volume_right); /* sets the volume to stored value */
   output_opened = TRUE;
 
   return 1;
@@ -530,10 +544,14 @@
     TRACE("l(%d), r(%d)\n", l, r);
   }
 
-  if(output.channels > 0)
+  if(output.channels > 0) {
       JACK_SetVolumeForChannel(driver, 0, l);
-  if(output.channels > 1)
+      jack_cfg.volume_left = l;
+  }
+  if(output.channels > 1) {
       JACK_SetVolumeForChannel(driver, 1, r);
+      jack_cfg.volume_right = r;
+  }
 }
 
 
--- a/Plugins/Output/jack/jack.h	Sun Jul 09 22:59:20 2006 -0700
+++ b/Plugins/Output/jack/jack.h	Mon Jul 10 01:18:38 2006 -0700
@@ -8,6 +8,7 @@
 typedef struct
 {
     gboolean isTraceEnabled; /* if true we will print debug information to the console */
+    int volume_left, volume_right; /* for loading the stored volume setting */
     char *port_connection_mode; /* the port connection mode setting */
 } jackconfig;