comparison Plugins/Input/console/Audacious_Driver.cpp @ 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 9eaff2f6cd4b
children 790c3a23eea2
comparison
equal deleted inserted replaced
1005:e2f3dddee74c 1006:8f1b7d07bef5
39 struct AudaciousConsoleConfig { 39 struct AudaciousConsoleConfig {
40 gint loop_length; // length of tracks that lack timing information 40 gint loop_length; // length of tracks that lack timing information
41 gboolean resample; // whether or not to resample 41 gboolean resample; // whether or not to resample
42 gint resample_rate; // rate to resample at 42 gint resample_rate; // rate to resample at
43 gboolean nsfe_playlist; // if true, use optional NSFE playlist 43 gboolean nsfe_playlist; // if true, use optional NSFE playlist
44 gint treble; // -100 to +100
45 gint bass; // -100 to +100
44 }; 46 };
45 static AudaciousConsoleConfig audcfg = { 180, FALSE, 32000, TRUE }; 47 static AudaciousConsoleConfig audcfg = { 180, FALSE, 32000, TRUE, 0, 0 };
46 static GThread* decode_thread; 48 static GThread* decode_thread;
47 static GStaticMutex playback_mutex = G_STATIC_MUTEX_INIT; 49 static GStaticMutex playback_mutex = G_STATIC_MUTEX_INIT;
48 static int console_ip_is_going; 50 static int console_ip_is_going;
49 static volatile long pending_seek; 51 static volatile long pending_seek;
50 extern InputPlugin console_ip; 52 extern InputPlugin console_ip;
608 { 610 {
609 console_ip.set_info( title, length, emu->voice_count() * 1000, sample_rate, 2 ); 611 console_ip.set_info( title, length, emu->voice_count() * 1000, sample_rate, 2 );
610 g_free( title ); 612 g_free( title );
611 } 613 }
612 614
615 // set frequency equalization
616 if ( audcfg.treble || audcfg.bass )
617 {
618 Music_Emu::equalizer_t eq = emu->equalizer();
619
620 // bass - logarithmic, 2 to 8194 Hz
621 double bass = 1.0 - (audcfg.bass / 200.0 + 0.5);
622 eq.bass = (long int) pow(2.0, bass * 13.0) + (long int) 2.0;
623
624 // treble - -50 to 0 to +5 dB
625 double treble = audcfg.treble / 100.0;
626 eq.treble = treble * (treble < 0 ? 50.0 : 5.0);
627
628 emu->set_equalizer(eq);
629 }
630
613 // start 631 // start
614 if ( !console_ip.output->open_audio( FMT_S16_NE, sample_rate, 2 ) ) 632 if ( !console_ip.output->open_audio( FMT_S16_NE, sample_rate, 2 ) )
615 return; 633 return;
616 pending_seek = -1; 634 pending_seek = -1;
617 track_ended = 0; 635 track_ended = 0;
659 677
660 bmp_cfg_db_get_int(db, "console", "loop_length", &audcfg.loop_length); 678 bmp_cfg_db_get_int(db, "console", "loop_length", &audcfg.loop_length);
661 bmp_cfg_db_get_bool(db, "console", "resample", &audcfg.resample); 679 bmp_cfg_db_get_bool(db, "console", "resample", &audcfg.resample);
662 bmp_cfg_db_get_int(db, "console", "resample_rate", &audcfg.resample_rate); 680 bmp_cfg_db_get_int(db, "console", "resample_rate", &audcfg.resample_rate);
663 bmp_cfg_db_get_bool(db, "console", "nsfe_playlist", &audcfg.nsfe_playlist); 681 bmp_cfg_db_get_bool(db, "console", "nsfe_playlist", &audcfg.nsfe_playlist);
682 bmp_cfg_db_get_int(db, "console", "treble", &audcfg.treble);
683 bmp_cfg_db_get_int(db, "console", "bass", &audcfg.bass);
664 684
665 bmp_cfg_db_close(db); 685 bmp_cfg_db_close(db);
666 } 686 }
667 687
668 extern "C" void console_aboutbox(void) 688 extern "C" void console_aboutbox(void)