changeset 1006:8f1b7d07bef5 trunk

[svn] via Shay Green: - add frequency response modifier options for GBS/VGM/GYM to Music_Emu::equalizer_t.
author nenolod
date Thu, 04 May 2006 09:54:53 -0700
parents e2f3dddee74c
children a62f163c319a
files Plugins/Input/console/Audacious_Driver.cpp
diffstat 1 files changed, 21 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/Input/console/Audacious_Driver.cpp	Wed May 03 22:44:03 2006 -0700
+++ b/Plugins/Input/console/Audacious_Driver.cpp	Thu May 04 09:54:53 2006 -0700
@@ -41,8 +41,10 @@
 	gboolean resample;  // whether or not to resample
 	gint resample_rate; // rate to resample at
 	gboolean nsfe_playlist; // if true, use optional NSFE playlist
+	gint treble; // -100 to +100
+	gint bass;   // -100 to +100
 };
-static AudaciousConsoleConfig audcfg = { 180, FALSE, 32000, TRUE };
+static AudaciousConsoleConfig audcfg = { 180, FALSE, 32000, TRUE, 0, 0 };
 static GThread* decode_thread;
 static GStaticMutex playback_mutex = G_STATIC_MUTEX_INIT;
 static int console_ip_is_going;
@@ -610,6 +612,22 @@
 		g_free( title );
 	}
 	
+	// set frequency equalization
+	if ( audcfg.treble || audcfg.bass )
+	{
+		Music_Emu::equalizer_t eq = emu->equalizer();
+		
+		// bass - logarithmic, 2 to 8194 Hz
+		double bass = 1.0 - (audcfg.bass / 200.0 + 0.5);
+		eq.bass = (long int) pow(2.0, bass * 13.0) + (long int) 2.0;
+		
+		// treble - -50 to 0 to +5 dB
+		double treble = audcfg.treble / 100.0;
+		eq.treble = treble * (treble < 0 ? 50.0 : 5.0);
+		
+		emu->set_equalizer(eq);
+	}
+	
 	// start
     if ( !console_ip.output->open_audio( FMT_S16_NE, sample_rate, 2 ) )
 		return;
@@ -661,6 +679,8 @@
 	bmp_cfg_db_get_bool(db, "console", "resample", &audcfg.resample);
 	bmp_cfg_db_get_int(db, "console", "resample_rate", &audcfg.resample_rate);
 	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_close(db);
 }