diff --git a/plugins/spu2-x/src/Linux/Config.cpp b/plugins/spu2-x/src/Linux/Config.cpp index 6338750770..f914006d54 100644 --- a/plugins/spu2-x/src/Linux/Config.cpp +++ b/plugins/spu2-x/src/Linux/Config.cpp @@ -18,7 +18,6 @@ #include "Global.h" #include "Dialogs.h" #include "Config.h" -#include #ifdef PCSX2_DEVBUILD static const int LATENCY_MAX = 3000; @@ -29,10 +28,6 @@ static const int LATENCY_MAX = 750; static const int LATENCY_MIN = 40; int AutoDMAPlayRate[2] = {0,0}; - -CONFIG_DSOUNDOUT Config_DSoundOut; -CONFIG_WAVEOUT Config_WaveOut; -CONFIG_XAUDIO2 Config_XAudio2; // Default settings. @@ -94,17 +89,13 @@ void WriteSettings() SoundtouchCfg::WriteSettings(); //DebugConfig::WriteSettings(); } - -void displayDialog(); - -void configure() -{ - ReadSettings(); - displayDialog(); - WriteSettings(); + +void advanced_dialog() +{ + SoundtouchCfg::DisplayDialog(); } -void displayDialog() +void DisplayDialog() { GtkWidget *dialog, *main_label; int return_value; @@ -170,14 +161,12 @@ void displayDialog() else gtk_combo_box_set_active(GTK_COMBO_BOX(mod_box), 1); - - // latency slider latency_slide = gtk_hscale_new_with_range(LATENCY_MIN, LATENCY_MAX, 5); gtk_range_set_value(GTK_RANGE(latency_slide), SndOutLatencyMS); time_check = gtk_check_button_new_with_label("Disable Time Stretch"); - // Advanced button + advanced_button = gtk_button_new_with_label("Advanced..."); mixing_vbox = gtk_vbox_new(false, 5); output_vbox = gtk_vbox_new(false, 5); @@ -194,6 +183,7 @@ void displayDialog() gtk_container_add(GTK_CONTAINER(output_vbox), mod_label); gtk_container_add(GTK_CONTAINER(output_vbox), mod_box); gtk_container_add(GTK_CONTAINER(output_vbox), latency_slide); + gtk_container_add(GTK_CONTAINER(output_vbox), advanced_button); gtk_container_add(GTK_CONTAINER(output_vbox), time_check); gtk_container_add(GTK_CONTAINER(main_hbox), mixing_vbox); @@ -207,6 +197,8 @@ void displayDialog() gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), main_hbox); gtk_widget_show_all (dialog); + g_signal_connect_swapped(GTK_OBJECT (advanced_button), "clicked", G_CALLBACK(advanced_dialog), advanced_button); + return_value = gtk_dialog_run (GTK_DIALOG (dialog)); if (return_value == GTK_RESPONSE_ACCEPT) @@ -231,3 +223,10 @@ void displayDialog() gtk_widget_destroy (dialog); } + +void configure() +{ + ReadSettings(); + DisplayDialog(); + WriteSettings(); +} diff --git a/plugins/spu2-x/src/Linux/Config.h b/plugins/spu2-x/src/Linux/Config.h index 1efd4efbb3..042bfada48 100644 --- a/plugins/spu2-x/src/Linux/Config.h +++ b/plugins/spu2-x/src/Linux/Config.h @@ -18,6 +18,7 @@ #ifndef CONFIG_H_INCLUDED #define CONFIG_H_INCLUDED +#include #include extern bool DebugEnabled; @@ -96,66 +97,18 @@ namespace SoundtouchCfg static int SeekWindowMS = 16; static int OverlapMS = 7; - /*static*/ void ReadSettings(); - /*static*/ void WriteSettings(); - /*static*/ void OpenDialog( uptr hWnd ); + void ReadSettings(); + void WriteSettings(); + void DisplayDialog(); static void ClampValues(); }; - -// *** BEGIN DRIVER-SPECIFIC CONFIGURATION *** -// ------------------------------------------- - -// DSOUND -struct CONFIG_XAUDIO2 -{ - std::wstring Device; - s8 NumBuffers; - - CONFIG_XAUDIO2() : - Device(), - NumBuffers( 2 ) - { - } -}; - -// DSOUND -struct CONFIG_DSOUNDOUT -{ - std::wstring Device; - s8 NumBuffers; - - CONFIG_DSOUNDOUT() : - Device(), - NumBuffers( 3 ) - { - } -}; - -// WAVEOUT -struct CONFIG_WAVEOUT -{ - std::wstring Device; - s8 NumBuffers; - - CONFIG_WAVEOUT() : - Device(), - NumBuffers( 4 ) - { - } -}; - -/*extern CONFIG_DSOUNDOUT Config_DSoundOut; -extern CONFIG_WAVEOUT Config_WaveOut; -extern CONFIG_XAUDIO2 Config_XAudio2;*/ - -////// - void ReadSettings(); void WriteSettings(); void configure(); void AboutBox(); +extern void advanced_dialog(); #endif // CONFIG_H_INCLUDED diff --git a/plugins/spu2-x/src/Linux/ConfigSoundTouch.cpp b/plugins/spu2-x/src/Linux/ConfigSoundTouch.cpp index 5a90ca0666..2ff35fcbff 100644 --- a/plugins/spu2-x/src/Linux/ConfigSoundTouch.cpp +++ b/plugins/spu2-x/src/Linux/ConfigSoundTouch.cpp @@ -57,13 +57,75 @@ void WriteSettings() CfgWriteInt( L"SOUNDTOUCH", L"OverlapMS", OverlapMS ); } -/*bool CALLBACK SoundtouchCfg::DialogProc(uptr hWnd,u32 uMsg,uptr wParam,uptr lParam) -{ -}*/ +static GtkWidget *seq_label, *seek_label, *over_label; +static GtkWidget *seq_slide, *seek_slide, *over_slide; -void OpenDialog( uptr hWnd ) +void restore_defaults() { + gtk_range_set_value(GTK_RANGE(seq_slide), 63); + gtk_range_set_value(GTK_RANGE(seek_slide), 16); + gtk_range_set_value(GTK_RANGE(over_slide), 7); +} + +void DisplayDialog() +{ + int return_value; + GtkWidget *dialog, *main_label; + GtkWidget *default_button; + ReadSettings(); + + /* Create the widgets */ + dialog = gtk_dialog_new_with_buttons ( + "Advanced Settings", + NULL, /* parent window*/ + (GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT), + GTK_STOCK_OK, + GTK_RESPONSE_ACCEPT, + GTK_STOCK_CANCEL, + GTK_RESPONSE_REJECT, + NULL); + + main_label = gtk_label_new ("These are advanced configuration options fine tuning time stretching behavior. Larger values are better for slowdown, while smaller values are better for speedup (more then 60 fps.). All options are in microseconds."); + gtk_label_set_line_wrap (GTK_LABEL(main_label), true); + + default_button = gtk_button_new_with_label("Reset to Defaults"); + + seq_label = gtk_label_new("Sequence Length"); + seq_slide = gtk_hscale_new_with_range(SequenceLen_Min, SequenceLen_Max, 2); + gtk_range_set_value(GTK_RANGE(seq_slide), SequenceLenMS); + + seek_label = gtk_label_new("Seek Window Size"); + seek_slide = gtk_hscale_new_with_range(SeekWindow_Min, SeekWindow_Max, 1); + gtk_range_set_value(GTK_RANGE(seek_slide), SeekWindowMS); + + over_label = gtk_label_new("Overlap"); + over_slide = gtk_hscale_new_with_range(Overlap_Min, Overlap_Max, 1); + gtk_range_set_value(GTK_RANGE(over_slide), OverlapMS); + + gtk_container_add(GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), main_label); + gtk_container_add(GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), default_button); + gtk_container_add(GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), seq_label); + gtk_container_add(GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), seq_slide); + gtk_container_add(GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), seek_label); + gtk_container_add(GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), seek_slide); + gtk_container_add(GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), over_label); + gtk_container_add(GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), over_slide); + gtk_widget_show_all (dialog); + + g_signal_connect_swapped(GTK_OBJECT (default_button), "clicked", G_CALLBACK(restore_defaults), default_button); + + return_value = gtk_dialog_run (GTK_DIALOG (dialog)); + + if (return_value == GTK_RESPONSE_ACCEPT) + { + SequenceLenMS = gtk_range_get_value(GTK_RANGE(seq_slide));; + SeekWindowMS = gtk_range_get_value(GTK_RANGE(seek_slide));; + OverlapMS = gtk_range_get_value(GTK_RANGE(over_slide));; + } + + gtk_widget_destroy (dialog); + WriteSettings(); } }