changeset 1498:a1fccf242404

made SPC playback reverb a configuration option till the problem can be solved
author mf0102 <0102@gmx.at>
date Thu, 16 Aug 2007 14:47:14 +0200
parents 318e3bcdf51d
children 799f92d815b2
files src/console/Audacious_Config.cxx src/console/Audacious_Config.h src/console/Audacious_Driver.cxx src/console/Spc_Dsp.cxx
diffstat 4 files changed, 23 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/console/Audacious_Config.cxx	Thu Aug 16 18:22:00 2007 +0300
+++ b/src/console/Audacious_Config.cxx	Thu Aug 16 14:47:14 2007 +0200
@@ -31,6 +31,7 @@
 	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_get_int(db, "console", "echo", &audcfg.echo);
+	bmp_cfg_db_get_bool(db, "console", "inc_spc_reverb", &audcfg.inc_spc_reverb);
 	bmp_cfg_db_close(db);
 }
 
@@ -46,6 +47,7 @@
 	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_set_int(db, "console", "echo", audcfg.echo);
+	bmp_cfg_db_set_bool(db, "console", "inc_spc_reverb", audcfg.inc_spc_reverb);
 	bmp_cfg_db_close(db);
 }
 
@@ -87,6 +89,11 @@
   audcfg.ignore_spc_length = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(cbt) );
 }
 
+static void i_cfg_ev_incspcreverb_enable_commit( gpointer cbt )
+{
+  audcfg.inc_spc_reverb = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(cbt) );
+}
+
 static void i_cfg_ev_bok( gpointer configwin )
 {
   console_cfg_save();
@@ -114,7 +121,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 *configwin_spc_ignorespclen_cbt, *configwin_spc_increverb_cbt;
 	GtkWidget /* *hseparator, */ *hbuttonbox, *button_ok, *button_cancel;
 	GtkWidget *configwin_notebook;
 	GtkTooltips *tips;
@@ -248,11 +255,17 @@
 	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") );
+	configwin_spc_increverb_cbt = gtk_check_button_new_with_label( _("Increase reverb") );
 	gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(configwin_spc_ignorespclen_cbt) , audcfg.ignore_spc_length );
+	gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(configwin_spc_increverb_cbt) , audcfg.inc_spc_reverb );
 	g_signal_connect_swapped( G_OBJECT(button_ok) , "clicked" ,
 		G_CALLBACK(i_cfg_ev_ignorespclen_enable_commit) , configwin_spc_ignorespclen_cbt );
+	g_signal_connect_swapped( G_OBJECT(button_ok) , "clicked" ,
+		G_CALLBACK(i_cfg_ev_incspcreverb_enable_commit) , configwin_spc_increverb_cbt );
 	gtk_box_pack_start( GTK_BOX(configwin_spc_vbox) ,
 		configwin_spc_ignorespclen_cbt , FALSE , FALSE , 0 );
+	gtk_box_pack_start( GTK_BOX(configwin_spc_vbox) ,
+		configwin_spc_increverb_cbt , FALSE , FALSE , 0 );
 
 	// horizontal separator and buttons
 	hbuttonbox = gtk_hbutton_box_new();
--- a/src/console/Audacious_Config.h	Thu Aug 16 18:22:00 2007 +0300
+++ b/src/console/Audacious_Config.h	Thu Aug 16 14:47:14 2007 +0200
@@ -22,6 +22,7 @@
 	gint bass;   // -100 to +100
 	gboolean ignore_spc_length; // if true, ignore length from SPC tags
 	gint echo;   // 0 to +100
+	gboolean inc_spc_reverb; // if true, increases the default reverb
 }
 AudaciousConsoleConfig;
 
--- a/src/console/Audacious_Driver.cxx	Thu Aug 16 18:22:00 2007 +0300
+++ b/src/console/Audacious_Driver.cxx	Thu Aug 16 14:47:14 2007 +0200
@@ -35,7 +35,8 @@
 int const fade_length    = 8 * 1000;
 int const path_max = 4096;
 
-AudaciousConsoleConfig audcfg = { 180, FALSE, 32000, TRUE, 0, 0, FALSE, 0 };
+AudaciousConsoleConfig audcfg =
+{ 180, FALSE, 32000, TRUE, 0, 0, FALSE, 0, FALSE };
 static GThread* decode_thread;
 static GStaticMutex playback_mutex = G_STATIC_MUTEX_INIT;
 static int console_ip_is_going;
--- a/src/console/Spc_Dsp.cxx	Thu Aug 16 18:22:00 2007 +0300
+++ b/src/console/Spc_Dsp.cxx	Thu Aug 16 14:47:14 2007 +0200
@@ -1,5 +1,8 @@
 // snes_spc 0.9.0. http://www.slack.net/~ant/
 
+// TODO: we can remove this as soon as the reverb problem is fixed. -- mf0102
+#include "Audacious_Config.h"
+
 #include "Spc_Dsp.h"
 
 #include "blargg_endian.h"
@@ -589,8 +592,9 @@
 		// Echo out
 		if ( !(REG(flg) & 0x20) )
 		{
-			int l = (echo_out_l >> 7) + ((echo_in_l * (int8_t) REG(efb)) >> 16);
-			int r = (echo_out_r >> 7) + ((echo_in_r * (int8_t) REG(efb)) >> 16);
+			unsigned shift = audcfg.inc_spc_reverb ? 14 : 16;
+			int l = (echo_out_l >> 7) + ((echo_in_l * (int8_t) REG(efb)) >> shift);
+			int r = (echo_out_r >> 7) + ((echo_in_r * (int8_t) REG(efb)) >> shift);
 			
 			// just to help pass more validation tests
 			#if SPC_MORE_ACCURACY