Rewrite the spu2-x dialog on Linux in wxwidgets. (#3454)

This commit is contained in:
arcum42 2020-06-27 01:00:50 -07:00 committed by GitHub
parent a2c62c30ad
commit 3119e0a2e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 619 additions and 564 deletions

View File

@ -97,12 +97,14 @@ else()
Linux/ConfigDebug.cpp
Linux/ConfigSoundTouch.cpp
Linux/Dialogs.cpp
wx/wxConfig.cpp
)
LIST(APPEND spu2xHeaders
Linux/Alsa.h
Linux/Config.h
Linux/Dialogs.h
wx/wxConfig.h
)
include_directories(Linux)

View File

@ -18,13 +18,13 @@
#include "Dialogs.h"
#include <wx/fileconf.h>
wxFileConfig *spuConfig = NULL;
wxFileConfig *spuConfig = nullptr;
wxString path(L"~/.pcsx2/inis/spu2-x.ini");
bool pathSet = false;
void initIni()
{
if (spuConfig == NULL)
if (spuConfig == nullptr)
spuConfig = new wxFileConfig(L"", L"", path, L"", wxCONFIG_USE_LOCAL_FILE);
}

View File

@ -19,22 +19,11 @@
#include "Dialogs.h"
#include "Config.h"
#ifdef __unix__
#if defined(__unix__) || defined(__APPLE__)
#include <SDL.h>
#include <SDL_audio.h>
#include "wx/wxConfig.h"
#endif
#ifdef __APPLE__
#include <dispatch/dispatch.h>
#endif
#ifdef PCSX2_DEVBUILD
static const int LATENCY_MAX = 3000;
#else
static const int LATENCY_MAX = 750;
#endif
static const int LATENCY_MIN = 3;
static const int LATENCY_MIN_TIMESTRETCH = 15;
int AutoDMAPlayRate[2] = {0, 0};
@ -80,9 +69,9 @@ u32 OutputModule = 0;
int SndOutLatencyMS = 300;
int SynchMode = 0; // Time Stretch, Async or Disabled
#ifdef SPU2X_PORTAUDIO
static u32 OutputAPI = 0;
u32 OutputAPI = 0;
#endif
static u32 SdlOutputAPI = 0;
u32 SdlOutputAPI = 0;
int numSpeakers = 0;
int dplLevel = 0;
@ -179,7 +168,7 @@ void ReadSettings()
Clampify(SndOutLatencyMS, LATENCY_MIN, LATENCY_MAX);
if (mods[OutputModule] == NULL) {
if (mods[OutputModule] == nullptr) {
fwprintf(stderr, L"* SPU2-X: Unknown output module '%s' specified in configuration file.\n", temp.wc_str());
fprintf(stderr, "* SPU2-X: Defaulting to SDL (%S).\n", SDLOut->GetIdent());
OutputModule = FindOutputModuleById(SDLOut->GetIdent());
@ -228,303 +217,15 @@ void WriteSettings()
DebugConfig::WriteSettings();
}
void advanced_dialog()
{
SoundtouchCfg::DisplayDialog();
}
void debug_dialog()
{
DebugConfig::DisplayDialog();
}
#if defined(__unix__) || defined(__APPLE__)
// Format the slider with ms.
static gchar *cb_scale_format_ms(GtkScale *scale, gdouble value)
{
return g_strdup_printf("%g ms (avg)", value);
}
// Format the slider with a % sign.
static gchar *cb_scale_format_percent(GtkScale *scale, gdouble value)
{
return g_strdup_printf("%g %%", value);
}
// Disables and reenables the debug button.
static void cb_toggle_sensitivity(GtkWidget *widget, gpointer data)
{
GtkButton *btn = static_cast<GtkButton *>(data);
temp_debug_state = !temp_debug_state;
gtk_widget_set_sensitive(GTK_WIDGET(btn), temp_debug_state);
}
static void cb_adjust_latency(GtkComboBox *widget, gpointer data)
{
GtkRange *range = static_cast<GtkRange *>(data);
// Minimum latency for timestretch is 15ms. Everything else is 3ms.
const int min_latency = gtk_combo_box_get_active(widget) == 0 ? LATENCY_MIN_TIMESTRETCH : LATENCY_MIN;
gtk_range_set_range(range, min_latency, LATENCY_MAX);
}
void DisplayDialog()
{
int return_value;
GtkWidget *dialog;
GtkWidget *main_box;
GtkWidget *mixing_frame, *mixing_box;
GtkWidget *int_label, *int_box;
GtkWidget *effects_check;
GtkWidget *dealias_filter;
GtkWidget *debug_check, *debug_button, *debug_frame, *debug_box;
GtkWidget *output_frame, *output_box;
GtkWidget *mod_label, *mod_box;
#ifdef SPU2X_PORTAUDIO
GtkWidget *api_label, *api_box;
#endif
#if SDL_MAJOR_VERSION >= 2
GtkWidget *sdl_api_label, *sdl_api_box;
#endif
GtkWidget *latency_label, *latency_slide;
GtkWidget *volume_label, *volume_slide;
GtkWidget *sync_label, *sync_box;
GtkWidget *advanced_button;
/* Create the widgets */
dialog = gtk_dialog_new_with_buttons(
"SPU2-X Config",
NULL, /* parent window*/
(GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
"Cancel", GTK_RESPONSE_REJECT,
"OK", GTK_RESPONSE_ACCEPT,
NULL);
int_label = gtk_label_new("Interpolation:");
int_box = gtk_combo_box_text_new();
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(int_box), "0 - Nearest (Fastest/bad quality)");
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(int_box), "1 - Linear (Simple/okay sound)");
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(int_box), "2 - Cubic (Artificial highs)");
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(int_box), "3 - Hermite (Better highs)");
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(int_box), "4 - Catmull-Rom (PS2-like/slow)");
gtk_combo_box_set_active(GTK_COMBO_BOX(int_box), Interpolation);
effects_check = gtk_check_button_new_with_label("Disable Effects Processing");
dealias_filter = gtk_check_button_new_with_label("Use the de-alias filter (Overemphasizes the highs)");
debug_check = gtk_check_button_new_with_label("Enable Debug Options");
debug_button = gtk_button_new_with_label("Configure...");
mod_label = gtk_label_new("Module:");
mod_box = gtk_combo_box_text_new();
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(mod_box), "0 - No Sound (Emulate SPU2 only)");
#ifdef SPU2X_PORTAUDIO
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(mod_box), "1 - PortAudio (Cross-platform)");
#endif
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(mod_box), "2 - SDL Audio (Recommended for PulseAudio)");
//gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(mod_box), "3 - Alsa (probably doesn't work)");
gtk_combo_box_set_active(GTK_COMBO_BOX(mod_box), OutputModule);
#ifdef SPU2X_PORTAUDIO
api_label = gtk_label_new("PortAudio API:");
api_box = gtk_combo_box_text_new();
#ifdef __linux__
// In order to keep it the menu light, I only put linux major api
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(api_box), "0 - ALSA (recommended)");
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(api_box), "1 - OSS (legacy)");
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(api_box), "2 - JACK");
#elif defined(__APPLE__)
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(api_box), "CoreAudio");
#else
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(api_box), "OSS");
#endif
gtk_combo_box_set_active(GTK_COMBO_BOX(api_box), OutputAPI);
#endif
#if SDL_MAJOR_VERSION >= 2
sdl_api_label = gtk_label_new("SDL API:");
sdl_api_box = gtk_combo_box_text_new();
// YES It sucks ...
for (int i = 0; i < SDL_GetNumAudioDrivers(); ++i) {
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(sdl_api_box), SDL_GetAudioDriver(i));
}
gtk_combo_box_set_active(GTK_COMBO_BOX(sdl_api_box), SdlOutputAPI);
#endif
latency_label = gtk_label_new("Latency:");
const int min_latency = SynchMode == 0 ? LATENCY_MIN_TIMESTRETCH : LATENCY_MIN;
latency_slide = ps_gtk_hscale_new_with_range(min_latency, LATENCY_MAX, 5);
gtk_range_set_value(GTK_RANGE(latency_slide), SndOutLatencyMS);
volume_label = gtk_label_new("Volume:");
volume_slide = ps_gtk_hscale_new_with_range(0, 100, 5);
gtk_range_set_value(GTK_RANGE(volume_slide), FinalVolume * 100);
sync_label = gtk_label_new("Synchronization Mode:");
sync_box = gtk_combo_box_text_new();
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(sync_box), "TimeStretch (Recommended)");
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(sync_box), "Async Mix (Breaks some games!)");
gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(sync_box), "None (Audio can skip.)");
gtk_combo_box_set_active(GTK_COMBO_BOX(sync_box), SynchMode);
advanced_button = gtk_button_new_with_label("Advanced...");
main_box = ps_gtk_hbox_new(5);
mixing_box = ps_gtk_vbox_new(5);
mixing_frame = gtk_frame_new("Mixing Settings:");
gtk_container_add(GTK_CONTAINER(mixing_frame), mixing_box);
output_box = ps_gtk_vbox_new(5);
output_frame = gtk_frame_new("Output Settings:");
debug_box = ps_gtk_vbox_new(5);
debug_frame = gtk_frame_new("Debug Settings:");
gtk_container_add(GTK_CONTAINER(debug_box), debug_check);
gtk_container_add(GTK_CONTAINER(debug_box), debug_button);
gtk_container_add(GTK_CONTAINER(debug_frame), debug_box);
gtk_container_add(GTK_CONTAINER(output_frame), output_box);
gtk_container_add(GTK_CONTAINER(mixing_box), int_label);
gtk_container_add(GTK_CONTAINER(mixing_box), int_box);
gtk_container_add(GTK_CONTAINER(mixing_box), effects_check);
gtk_container_add(GTK_CONTAINER(mixing_box), dealias_filter);
gtk_container_add(GTK_CONTAINER(mixing_box), debug_frame);
gtk_container_add(GTK_CONTAINER(output_box), mod_label);
gtk_container_add(GTK_CONTAINER(output_box), mod_box);
#ifdef SPU2X_PORTAUDIO
gtk_container_add(GTK_CONTAINER(output_box), api_label);
gtk_container_add(GTK_CONTAINER(output_box), api_box);
#endif
#if SDL_MAJOR_VERSION >= 2
gtk_container_add(GTK_CONTAINER(output_box), sdl_api_label);
gtk_container_add(GTK_CONTAINER(output_box), sdl_api_box);
#endif
gtk_container_add(GTK_CONTAINER(output_box), sync_label);
gtk_container_add(GTK_CONTAINER(output_box), sync_box);
gtk_container_add(GTK_CONTAINER(output_box), latency_label);
gtk_container_add(GTK_CONTAINER(output_box), latency_slide);
gtk_container_add(GTK_CONTAINER(output_box), volume_label);
gtk_container_add(GTK_CONTAINER(output_box), volume_slide);
gtk_container_add(GTK_CONTAINER(output_box), advanced_button);
gtk_box_pack_start(GTK_BOX(main_box), mixing_frame, TRUE, TRUE, 5);
gtk_box_pack_start(GTK_BOX(main_box), output_frame, TRUE, TRUE, 5);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(effects_check), EffectsDisabled);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dealias_filter), postprocess_filter_dealias);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(debug_check), DebugEnabled);
gtk_widget_set_sensitive(GTK_WIDGET(debug_button), DebugEnabled);
temp_debug_state = DebugEnabled;
gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), main_box);
gtk_widget_show_all(dialog);
g_signal_connect(volume_slide, "format_value", G_CALLBACK(cb_scale_format_percent), volume_slide);
g_signal_connect(latency_slide, "format_value", G_CALLBACK(cb_scale_format_ms), latency_slide);
g_signal_connect(sync_box, "changed", G_CALLBACK(cb_adjust_latency), latency_slide);
g_signal_connect(debug_check, "clicked", G_CALLBACK(cb_toggle_sensitivity), debug_button);
g_signal_connect_swapped(advanced_button, "clicked", G_CALLBACK(advanced_dialog), advanced_button);
g_signal_connect_swapped(debug_button, "clicked", G_CALLBACK(debug_dialog), debug_button);
return_value = gtk_dialog_run(GTK_DIALOG(dialog));
if (return_value == GTK_RESPONSE_ACCEPT) {
DebugEnabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(debug_check));
postprocess_filter_dealias = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dealias_filter));
if (gtk_combo_box_get_active(GTK_COMBO_BOX(int_box)) != -1)
Interpolation = gtk_combo_box_get_active(GTK_COMBO_BOX(int_box));
EffectsDisabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(effects_check));
if (gtk_combo_box_get_active(GTK_COMBO_BOX(mod_box)) != -1)
OutputModule = gtk_combo_box_get_active(GTK_COMBO_BOX(mod_box));
#ifdef SPU2X_PORTAUDIO
if (gtk_combo_box_get_active(GTK_COMBO_BOX(api_box)) != -1) {
OutputAPI = gtk_combo_box_get_active(GTK_COMBO_BOX(api_box));
#ifdef __linux__
switch (OutputAPI) {
case 0:
PortaudioOut->SetApiSettings(L"ALSA");
break;
case 1:
PortaudioOut->SetApiSettings(L"OSS");
break;
case 2:
PortaudioOut->SetApiSettings(L"JACK");
break;
default:
PortaudioOut->SetApiSettings(L"Unknown");
}
#else
switch (OutputAPI) {
case 0:
#ifdef __APPLE__
PortaudioOut->SetApiSettings(L"CoreAudio");
#else
PortaudioOut->SetApiSettings(L"OSS");
#endif
break;
default:
PortaudioOut->SetApiSettings(L"Unknown");
}
#endif
}
#endif
#if SDL_MAJOR_VERSION >= 2
if (gtk_combo_box_get_active(GTK_COMBO_BOX(sdl_api_box)) != -1) {
SdlOutputAPI = gtk_combo_box_get_active(GTK_COMBO_BOX(sdl_api_box));
// YES It sucks ...
SDLOut->SetApiSettings(wxString(SDL_GetAudioDriver(SdlOutputAPI), wxConvUTF8));
}
#endif
FinalVolume = gtk_range_get_value(GTK_RANGE(volume_slide)) / 100;
SndOutLatencyMS = gtk_range_get_value(GTK_RANGE(latency_slide));
if (gtk_combo_box_get_active(GTK_COMBO_BOX(sync_box)) != -1)
SynchMode = gtk_combo_box_get_active(GTK_COMBO_BOX(sync_box));
}
gtk_widget_destroy(dialog);
}
#else
void DisplayDialog()
{
}
#endif
void configure()
{
#ifdef __APPLE__
// Rest of macOS UI doesn't use GTK so we need to init it now
gtk_init(nullptr, nullptr);
// GTK expects us to be using its event loop, rather than Cocoa's
// If we call its stuff right now, it'll attempt to drain a static autorelease pool that was already drained by Cocoa (see https://github.com/GNOME/gtk/blob/8c1072fad1cb6a2e292fce2441b4a571f173ce0f/gdk/quartz/gdkeventloop-quartz.c#L640-L646)
// We can convince it that touching that pool would be unsafe by running all GTK calls within a CFRunLoop
// (Blocks submitted to the main queue by dispatch_async are run by its CFRunLoop)
dispatch_async(dispatch_get_main_queue(), ^{
#endif
auto *dialog = new Dialog;
initIni();
ReadSettings();
DisplayDialog();
dialog->Display();
WriteSettings();
delete spuConfig;
spuConfig = NULL;
#ifdef __APPLE__
// End of `dispatch_async(...` above
});
#endif
spuConfig = nullptr;
wxDELETE(dialog);
}

View File

@ -18,10 +18,6 @@
#ifndef CONFIG_H_INCLUDED
#define CONFIG_H_INCLUDED
#if defined(__unix__)
#include <gtk/gtk.h>
#endif
#include <string>
#include <wx/fileconf.h>
@ -87,15 +83,43 @@ extern int dspPluginModule;
extern bool dspPluginEnabled;
extern int SynchMode;
#ifdef SPU2X_PORTAUDIO
extern u32 OutputAPI;
#endif
extern u32 SdlOutputAPI;
#ifdef PCSX2_DEVBUILD
const int LATENCY_MAX = 3000;
#else
const int LATENCY_MAX = 750;
#endif
const int LATENCY_MIN = 3;
const int LATENCY_MIN_TIMESTRETCH = 15;
namespace SoundtouchCfg
{
extern const int SequenceLen_Min;
extern const int SequenceLen_Max;
extern const int SeekWindow_Min;
extern const int SeekWindow_Max;
extern const int Overlap_Min;
extern const int Overlap_Max;
extern int SequenceLenMS;
extern int SeekWindowMS;
extern int OverlapMS;
void ReadSettings();
void WriteSettings();
void DisplayDialog();
}; // namespace SoundtouchCfg
void ReadSettings();
void WriteSettings();
void DisplayDialog();
void configure();
extern wxFileConfig *spuConfig;
extern bool pathSet;

View File

@ -154,137 +154,4 @@ void WriteSettings()
CfgWriteStr(Section, L"Reg_Dump_Filename", RegDumpFileName);
}
#if defined(__unix__) || defined(__APPLE__)
void DisplayDialog()
{
GtkWidget *dialog;
int return_value;
GtkWidget *msg_box, *log_box, *dump_box, *main_box;
GtkWidget *msg_frame, *log_frame, *dump_frame;
GtkWidget *msg_console_check, *msg_key_check, *msg_voice_check, *msg_dma_check;
GtkWidget *msg_autodma_check, *msg_overrun_check, *msg_cache_check;
GtkWidget *log_access_check, *log_dma_check, *log_wave_check;
GtkWidget *dump_core_check, *dump_mem_check, *dump_reg_check;
ReadSettings();
// Create the widgets
dialog = gtk_dialog_new_with_buttons(
"Spu2-X Config",
NULL, // parent window
(GtkDialogFlags)(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT),
"Cancel", GTK_RESPONSE_REJECT,
"OK", GTK_RESPONSE_ACCEPT,
NULL);
main_box = ps_gtk_hbox_new(5);
// Message Section
msg_box = ps_gtk_vbox_new(5);
msg_console_check = gtk_check_button_new_with_label("Show In Console");
msg_key_check = gtk_check_button_new_with_label("KeyOn/Off Events");
msg_voice_check = gtk_check_button_new_with_label("Voice Stop Events");
msg_dma_check = gtk_check_button_new_with_label("DMA Operations");
msg_autodma_check = gtk_check_button_new_with_label("AutoDMA Operations");
msg_overrun_check = gtk_check_button_new_with_label("Buffer Over/Underruns");
msg_cache_check = gtk_check_button_new_with_label("ADPCM Cache Statistics");
gtk_container_add(GTK_CONTAINER(msg_box), msg_console_check);
gtk_container_add(GTK_CONTAINER(msg_box), msg_key_check);
gtk_container_add(GTK_CONTAINER(msg_box), msg_voice_check);
gtk_container_add(GTK_CONTAINER(msg_box), msg_dma_check);
gtk_container_add(GTK_CONTAINER(msg_box), msg_autodma_check);
gtk_container_add(GTK_CONTAINER(msg_box), msg_overrun_check);
gtk_container_add(GTK_CONTAINER(msg_box), msg_cache_check);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(msg_console_check), _MsgToConsole);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(msg_key_check), _MsgKeyOnOff);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(msg_voice_check), _MsgVoiceOff);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(msg_dma_check), _MsgDMA);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(msg_autodma_check), _MsgAutoDMA);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(msg_overrun_check), _MsgOverruns);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(msg_cache_check), _MsgCache);
msg_frame = gtk_frame_new("Message/Log Options");
gtk_container_add(GTK_CONTAINER(msg_frame), msg_box);
// Log Section
log_box = ps_gtk_vbox_new(5);
log_access_check = gtk_check_button_new_with_label("Log Register/DMA Actions");
log_dma_check = gtk_check_button_new_with_label("Log DMA Writes");
log_wave_check = gtk_check_button_new_with_label("Log Audio Output");
gtk_container_add(GTK_CONTAINER(log_box), log_access_check);
gtk_container_add(GTK_CONTAINER(log_box), log_dma_check);
gtk_container_add(GTK_CONTAINER(log_box), log_wave_check);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(log_access_check), _AccessLog);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(log_dma_check), _DMALog);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(log_wave_check), _WaveLog);
log_frame = gtk_frame_new("Log Options");
gtk_container_add(GTK_CONTAINER(log_frame), log_box);
// Dump Section
dump_box = ps_gtk_vbox_new(5);
dump_core_check = gtk_check_button_new_with_label("Dump Core and Voice State");
dump_mem_check = gtk_check_button_new_with_label("Dump Memory Contents");
dump_reg_check = gtk_check_button_new_with_label("Dump Register Data");
gtk_container_add(GTK_CONTAINER(dump_box), dump_core_check);
gtk_container_add(GTK_CONTAINER(dump_box), dump_mem_check);
gtk_container_add(GTK_CONTAINER(dump_box), dump_reg_check);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dump_core_check), _CoresDump);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dump_mem_check), _MemDump);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dump_reg_check), _RegDump);
dump_frame = gtk_frame_new("Dumps (on close)");
gtk_container_add(GTK_CONTAINER(dump_frame), dump_box);
// Add everything
gtk_container_add(GTK_CONTAINER(main_box), msg_frame);
gtk_container_add(GTK_CONTAINER(main_box), log_frame);
gtk_container_add(GTK_CONTAINER(main_box), dump_frame);
// Add all our widgets, and show everything we've added to the dialog.
gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), main_box);
gtk_widget_show_all(dialog);
return_value = gtk_dialog_run(GTK_DIALOG(dialog));
if (return_value == GTK_RESPONSE_ACCEPT) {
_MsgToConsole = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(msg_console_check));
_MsgKeyOnOff = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(msg_key_check));
_MsgVoiceOff = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(msg_voice_check));
_MsgDMA = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(msg_dma_check));
_MsgAutoDMA = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(msg_autodma_check));
_MsgOverruns = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(msg_overrun_check));
_MsgCache = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(msg_cache_check));
_AccessLog = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(log_access_check));
_DMALog = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(log_dma_check));
_WaveLog = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(log_wave_check));
_CoresDump = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dump_core_check));
_MemDump = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dump_mem_check));
_RegDump = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(dump_reg_check));
}
gtk_widget_destroy(dialog);
WriteSettings();
}
#else
void DisplayDialog()
{
}
#endif
} // namespace DebugConfig

View File

@ -27,18 +27,18 @@
namespace SoundtouchCfg
{
// Timestretch Slider Bounds, Min/Max
static const int SequenceLen_Min = 20;
static const int SequenceLen_Max = 100;
const int SequenceLen_Min = 20;
const int SequenceLen_Max = 100;
static const int SeekWindow_Min = 10;
static const int SeekWindow_Max = 30;
const int SeekWindow_Min = 10;
const int SeekWindow_Max = 30;
static const int Overlap_Min = 5;
static const int Overlap_Max = 15;
const int Overlap_Min = 5;
const int Overlap_Max = 15;
static int SequenceLenMS = 30;
static int SeekWindowMS = 20;
static int OverlapMS = 10;
int SequenceLenMS = 30;
int SeekWindowMS = 20;
int OverlapMS = 10;
static void ClampValues()
{
@ -71,90 +71,4 @@ void WriteSettings()
CfgWriteInt(L"SOUNDTOUCH", L"OverlapMS", OverlapMS);
}
#if defined(__unix__) || defined(__APPLE__)
static GtkWidget *seq_label, *seek_label, *over_label;
static GtkWidget *seq_slide, *seek_slide, *over_slide;
void restore_defaults()
{
gtk_range_set_value(GTK_RANGE(seq_slide), 30);
gtk_range_set_value(GTK_RANGE(seek_slide), 20);
gtk_range_set_value(GTK_RANGE(over_slide), 10);
}
void DisplayDialog()
{
int return_value;
GtkWidget *dialog, *main_label, *adv_box;
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),
"Cancel", GTK_RESPONSE_REJECT,
"OK", GTK_RESPONSE_ACCEPT,
NULL);
main_label = gtk_label_new("These are advanced configuration options for fine tuning time stretching behavior. \nLarger values are better for slowdown, while smaller values are better for speedup (more then 60 fps.). \nAll 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 = ps_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 = ps_gtk_hscale_new_with_range(SeekWindow_Min, SeekWindow_Max, 2);
gtk_range_set_value(GTK_RANGE(seek_slide), SeekWindowMS);
over_label = gtk_label_new("Overlap");
over_slide = ps_gtk_hscale_new_with_range(Overlap_Min, Overlap_Max, 2);
gtk_range_set_value(GTK_RANGE(over_slide), OverlapMS);
adv_box = ps_gtk_vbox_new(5);
gtk_box_pack_start(GTK_BOX(adv_box), main_label, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(adv_box), default_button, TRUE, TRUE, 5);
gtk_box_pack_start(GTK_BOX(adv_box), seq_label, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(adv_box), seq_slide, TRUE, TRUE, 5);
gtk_box_pack_start(GTK_BOX(adv_box), seek_label, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(adv_box), seek_slide, TRUE, TRUE, 5);
gtk_box_pack_start(GTK_BOX(adv_box), over_label, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(adv_box), over_slide, TRUE, TRUE, 5);
gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), adv_box);
g_signal_connect_swapped(default_button, "clicked", G_CALLBACK(restore_defaults), default_button);
gtk_widget_show_all(dialog);
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();
}
#else
void DisplayDialog()
{
}
void restore_defaults()
{
}
#endif
} // namespace SoundtouchCfg

View File

@ -21,7 +21,7 @@
#include <cstring>
#if defined(__unix__)
#include <gtk/gtk.h>
#include <wx/wx.h>
void SysMessage(const char *fmt, ...)
{
@ -35,14 +35,8 @@ void SysMessage(const char *fmt, ...)
if (msg[strlen(msg) - 1] == '\n')
msg[strlen(msg) - 1] = 0;
GtkWidget *dialog;
dialog = gtk_message_dialog_new(NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK,
"%s", msg);
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
wxMessageDialog dialog(nullptr, msg, "Info", wxOK);
dialog.ShowModal();
}
void SysMessage(const wchar_t *fmt, ...)
@ -53,14 +47,8 @@ void SysMessage(const wchar_t *fmt, ...)
msg.PrintfV(fmt, list);
va_end(list);
GtkWidget *dialog;
dialog = gtk_message_dialog_new(NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK,
"%s", msg.ToUTF8().data());
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
wxMessageDialog dialog(nullptr, msg, "Info", wxOK);
dialog.ShowModal();
}
#endif

View File

@ -20,13 +20,11 @@
#include "../Global.h"
#include "../Config.h"
#include "Utilities/gtkGuiTools.h"
namespace DebugConfig
{
extern void ReadSettings();
extern void WriteSettings();
extern void DisplayDialog();
} // namespace DebugConfig
extern void CfgSetSettingsDir(const char *dir);

View File

@ -0,0 +1,469 @@
/* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2
* Developed and maintained by the Pcsx2 Development Team.
*
* Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz]
*
* SPU2-X is free software: you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* SPU2-X is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with SPU2-X. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Global.h"
#include "wxConfig.h"
Dialog::Dialog()
: wxDialog(nullptr, wxID_ANY, "SPU2-X Config", wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX)
{
m_top_box = new wxBoxSizer(wxHORIZONTAL);
m_left_box = new wxBoxSizer(wxVERTICAL);
m_right_box = new wxBoxSizer(wxVERTICAL);
m_portaudio_box = new wxBoxSizer(wxVERTICAL);
m_sdl_box = new wxBoxSizer(wxVERTICAL);
m_mix_box = new wxStaticBoxSizer(wxVERTICAL, this, "Mixing Settings");
m_debug_box = new wxStaticBoxSizer(wxVERTICAL, this, "Debug Settings");
m_output_box = new wxStaticBoxSizer(wxVERTICAL, this, "Output Settings");
// Mixing Settings
m_mix_box->Add(new wxStaticText(this, wxID_ANY, "Interpolation"), wxSizerFlags().Centre());
m_interpolation.Add("Nearest (Fastest/bad quality)");
m_interpolation.Add("Linear (Simple/okay sound)");
m_interpolation.Add("Cubic (Artificial highs)");
m_interpolation.Add("Hermite (Better highs)");
m_interpolation.Add("Catmull-Rom (PS2-like/slow)");
m_inter_select = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_interpolation);
effect_check = new wxCheckBox(this, wxID_ANY, "Disable Effects Processing (Speedup)");
dealias_check = new wxCheckBox(this, wxID_ANY, "Use the de-alias filter (Overemphasizes the highs)");
m_mix_box->Add(m_inter_select, wxSizerFlags().Centre());
m_mix_box->Add(effect_check, wxSizerFlags().Centre());
m_mix_box->Add(dealias_check, wxSizerFlags().Centre());
// Debug Settings
debug_check = new wxCheckBox(this, wxID_ANY, "Enable Debug Options");
launch_debug_dialog = new wxButton(this, wxID_ANY, "Configure...");
m_debug_box->Add(debug_check, wxSizerFlags().Expand());
m_debug_box->Add(launch_debug_dialog, wxSizerFlags().Expand());
// Output Settings
// Module
m_output_box->Add(new wxStaticText(this, wxID_ANY, "Module"), wxSizerFlags().Centre());
m_module.Add("No Sound (Emulate SPU2 only)");
m_module.Add("PortAudio (Cross-platform)");
m_module.Add("SDL Audio (Recommended for PulseAudio)");
m_module_select = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_module);
m_output_box->Add(m_module_select, wxSizerFlags().Centre());
// Portaudio
m_portaudio_text = new wxStaticText(this, wxID_ANY, "Portaudio API");
m_portaudio_box->Add(m_portaudio_text, wxSizerFlags().Centre());
#ifdef __linux__
m_portaudio.Add("ALSA (recommended)");
m_portaudio.Add("OSS (legacy)");
m_portaudio.Add("JACK");
#elif defined(__APPLE__)
m_portaudio.Add("CoreAudio");
#else
m_portaudio.Add("OSS");
#endif
m_portaudio_select = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_portaudio);
m_portaudio_box->Add(m_portaudio_select, wxSizerFlags().Centre());
// SDL
m_sdl_text = new wxStaticText(this, wxID_ANY, "SDL API");
m_sdl_box->Add(m_sdl_text, wxSizerFlags().Centre());
for (int i = 0; i < SDL_GetNumAudioDrivers(); ++i)
m_sdl.Add(SDL_GetAudioDriver(i));
m_sdl_select = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_sdl);
m_sdl_box->Add(m_sdl_select, wxSizerFlags().Centre());
m_output_box->Add(m_portaudio_box, wxSizerFlags().Expand());
m_output_box->Add(m_sdl_box, wxSizerFlags().Expand());
// Synchronization Mode
m_sync_box = new wxStaticBoxSizer(wxHORIZONTAL, this, "Synchronization ");
m_sync.Add("TimeStretch (Recommended)");
m_sync.Add("Async Mix (Breaks some games!)");
m_sync.Add("None (Audio can skip.)");
m_sync_select = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_sync);
m_sync_box->Add(m_sync_select, wxSizerFlags().Centre());
launch_adv_dialog = new wxButton(this, wxID_ANY, "Advanced...");
m_sync_box->Add(launch_adv_dialog);
m_left_box->Add(m_output_box, wxSizerFlags().Expand());
m_left_box->Add(m_mix_box, wxSizerFlags().Expand());
m_left_box->Add(m_sync_box, wxSizerFlags().Expand().Border(wxALL, 5));
// Latency Slider
const int min_latency = SynchMode == 0 ? LATENCY_MIN_TIMESTRETCH : LATENCY_MIN;
m_latency_box = new wxStaticBoxSizer(wxVERTICAL, this, "Latency");
m_latency_slider = new wxSlider(this, wxID_ANY, SndOutLatencyMS, min_latency, LATENCY_MAX, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
m_latency_box->Add(m_latency_slider, wxSizerFlags().Expand());
// Volume Slider
m_volume_box = new wxStaticBoxSizer(wxVERTICAL, this, "Volume");
m_volume_slider = new wxSlider(this, wxID_ANY, FinalVolume * 100, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
m_volume_box->Add(m_volume_slider, wxSizerFlags().Expand());
m_right_box->Add(m_latency_box, wxSizerFlags().Expand());
m_right_box->Add(m_volume_box, wxSizerFlags().Expand());
m_audio_box = new wxBoxSizer(wxVERTICAL);
m_audio_box->Add(new wxStaticText(this, wxID_ANY, "Audio Expansion Mode"));
m_audio.Add("Stereo (None, Default)");
m_audio.Add("Quadrafonic");
m_audio.Add("Surround 5.1");
m_audio.Add("Surround 7.1");
m_audio_select = new wxChoice(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_audio);
m_audio_box->Add(m_audio_select, wxSizerFlags().Expand());
m_right_box->Add(m_audio_box);
m_right_box->Add(m_debug_box);
m_top_box->Add(m_left_box, wxSizerFlags().Left());
m_top_box->Add(m_right_box, wxSizerFlags().Right());
SetSizerAndFit(m_top_box);
Bind(wxEVT_BUTTON, &Dialog::OnButtonClicked, this);
Bind(wxEVT_CHOICE, &Dialog::CallReconfigure, this);
Bind(wxEVT_CHECKBOX, &Dialog::CallReconfigure, this);
}
Dialog::~Dialog()
{
}
void Dialog::Reconfigure()
{
const int mod = m_module_select->GetCurrentSelection();
bool show_portaudio = false, show_sdl = false;
switch (mod) {
case 0:
show_portaudio = false;
show_sdl = false;
break;
case 1:
show_portaudio = true;
show_sdl = false;
break;
case 2:
show_portaudio = false;
show_sdl = true;
break;
default:
show_portaudio = false;
show_sdl = false;
break;
}
m_output_box->Show(m_portaudio_box, show_portaudio, true);
m_output_box->Show(m_sdl_box, show_sdl, true);
// Recalculating both of these accounts for if neither was showing initially.
m_top_box->Layout();
SetSizerAndFit(m_top_box);
launch_debug_dialog->Enable(debug_check->GetValue());
launch_adv_dialog->Enable(m_sync_select->GetCurrentSelection() == 0);
}
void Dialog::CallReconfigure(wxCommandEvent &event)
{
Reconfigure();
}
void Dialog::OnButtonClicked(wxCommandEvent &event)
{
wxButton *bt = (wxButton *)event.GetEventObject();
if (bt == launch_debug_dialog)
{
auto debug_dialog = new DebugDialog;
debug_dialog->Display();
wxDELETE(debug_dialog);
}
if (bt == launch_adv_dialog)
{
auto adv_dialog = new SoundtouchCfg::AdvDialog;
adv_dialog->Display();
wxDELETE(adv_dialog);
}
}
void Dialog::ResetToValues()
{
m_inter_select->SetSelection(Interpolation);
m_module_select->SetSelection(OutputModule);
m_portaudio_select->SetSelection(OutputAPI);
m_sdl_select->SetSelection(SdlOutputAPI);
m_sync_select->SetSelection(SynchMode);
m_audio_select->SetSelection(numSpeakers);
effect_check->SetValue(EffectsDisabled);
dealias_check->SetValue(postprocess_filter_dealias);
debug_check->SetValue(DebugEnabled);
m_volume_slider->SetValue(FinalVolume * 100);
m_latency_slider->SetValue(SndOutLatencyMS);
Reconfigure();
}
void Dialog::SaveValues()
{
Interpolation = m_inter_select->GetSelection();
OutputModule = m_module_select->GetSelection();
OutputAPI = m_portaudio_select->GetSelection();
SdlOutputAPI = m_sdl_select->GetSelection();
SynchMode = m_sync_select->GetSelection();
numSpeakers = m_audio_select->GetSelection();
EffectsDisabled = effect_check->GetValue();
postprocess_filter_dealias = dealias_check->GetValue();
DebugEnabled = debug_check->GetValue();
FinalVolume = m_volume_slider->GetValue() / 100.0;
SndOutLatencyMS = m_latency_slider->GetValue();
}
// Main
void Dialog::Display()
{
ResetToValues();
ShowModal();
SaveValues();
}
// Debug dialog box
DebugDialog::DebugDialog()
: wxDialog(nullptr, wxID_ANY, "SPU2-X Debug", wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX)
{
m_debug_top_box = new wxBoxSizer(wxHORIZONTAL);
m_together_box = new wxBoxSizer(wxVERTICAL);
show_check = new wxCheckBox(this, wxID_ANY, "Show in console");
m_together_box->Add(show_check);
m_console_box = new wxStaticBoxSizer(wxVERTICAL, this, "Events");
key_check = new wxCheckBox(this, wxID_ANY, "Key On/Off");
voice_check = new wxCheckBox(this, wxID_ANY, "Voice Stop");
dma_check = new wxCheckBox(this, wxID_ANY, "DMA Operations");
autodma_check = new wxCheckBox(this, wxID_ANY, "AutoDMA Operations");
buffer_check = new wxCheckBox(this, wxID_ANY, "Buffer Over/Underruns");
adpcm_check = new wxCheckBox(this, wxID_ANY, "ADPCM Cache");
m_console_box->Add(key_check);
m_console_box->Add(voice_check);
m_console_box->Add(dma_check);
m_console_box->Add(autodma_check);
m_console_box->Add(buffer_check);
m_console_box->Add(adpcm_check);
m_log_only_box = new wxStaticBoxSizer(wxVERTICAL, this, "Log Only");
dma_actions_check = new wxCheckBox(this, wxID_ANY, "Register/DMA Actions");
dma_writes_check = new wxCheckBox(this, wxID_ANY, "DMA Writes");
auto_output_check = new wxCheckBox(this, wxID_ANY, "Audio Output");
m_log_only_box->Add(dma_actions_check);
m_log_only_box->Add(dma_writes_check);
m_log_only_box->Add(auto_output_check);
dump_box = new wxStaticBoxSizer(wxVERTICAL, this, "Dump on Close");
core_voice_check = new wxCheckBox(this, wxID_ANY, "Core && Voice Stats");
memory_check = new wxCheckBox(this, wxID_ANY, "Memory Contents");
register_check = new wxCheckBox(this, wxID_ANY, "Register Data");
dump_box->Add(core_voice_check);
dump_box->Add(memory_check);
dump_box->Add(register_check);
m_together_box->Add(m_console_box);
m_debug_top_box->Add(m_together_box, wxSizerFlags().Expand());
m_debug_top_box->Add(m_log_only_box, wxSizerFlags().Expand());
m_debug_top_box->Add(dump_box, wxSizerFlags().Expand());
SetSizerAndFit(m_debug_top_box);
Bind(wxEVT_CHECKBOX, &DebugDialog::CallReconfigure, this);
}
DebugDialog::~DebugDialog()
{
}
void DebugDialog::Reconfigure()
{
if (show_check->GetValue()) {
_MsgKeyOnOff = key_check->Enable();
_MsgVoiceOff = voice_check->Enable();
_MsgDMA = dma_check->Enable();
_MsgAutoDMA = autodma_check->Enable();
_MsgOverruns = buffer_check->Enable();
_MsgCache = adpcm_check->Enable();
} else {
_MsgKeyOnOff = key_check->Disable();
_MsgVoiceOff = voice_check->Disable();
_MsgDMA = dma_check->Disable();
_MsgAutoDMA = autodma_check->Disable();
_MsgOverruns = buffer_check->Disable();
_MsgCache = adpcm_check->Disable();
}
}
void DebugDialog::CallReconfigure(wxCommandEvent &event)
{
Reconfigure();
}
void DebugDialog::ResetToValues()
{
show_check->SetValue(_MsgToConsole);
key_check->SetValue(_MsgKeyOnOff);
voice_check->SetValue(_MsgVoiceOff);
dma_check->SetValue(_MsgDMA);
autodma_check->SetValue(_MsgAutoDMA);
buffer_check->SetValue(_MsgOverruns);
adpcm_check->SetValue(_MsgCache);
dma_actions_check->SetValue(_AccessLog);
dma_writes_check->SetValue(_DMALog);
auto_output_check->SetValue(_WaveLog);
core_voice_check->SetValue(_CoresDump);
memory_check->SetValue(_MemDump);
register_check->SetValue(_RegDump);
Reconfigure();
}
void DebugDialog::SaveValues()
{
_MsgToConsole = show_check->GetValue();
_MsgKeyOnOff = key_check->GetValue();
_MsgVoiceOff = voice_check->GetValue();
_MsgDMA = dma_check->GetValue();
_MsgAutoDMA = autodma_check->GetValue();
_MsgOverruns = buffer_check->GetValue();
_MsgCache = adpcm_check->GetValue();
_AccessLog = dma_actions_check->GetValue();
_DMALog = dma_writes_check->GetValue();
_WaveLog = auto_output_check->GetValue();
_CoresDump = core_voice_check->GetValue();
_MemDump = memory_check->GetValue();
_RegDump = register_check->GetValue();
}
void DebugDialog::Display()
{
ResetToValues();
ShowModal();
SaveValues();
WriteSettings();
}
namespace SoundtouchCfg
{
AdvDialog::AdvDialog()
: wxDialog(nullptr, wxID_ANY, "Soundtouch Config", wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX)
{
m_adv_box = new wxBoxSizer(wxVERTICAL);
m_babble_box = new wxBoxSizer(wxVERTICAL);
m_adv_text = new wxStaticText(this, wxID_ANY, "These are advanced configuration options for fine tuning time stretching behavior.", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE_HORIZONTAL);
m_adv_text2 = new wxStaticText(this, wxID_ANY, "Larger values are better for slowdown, while smaller values are better for speedup (more then 60 fps.).", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE_HORIZONTAL);
m_adv_text3 = new wxStaticText(this, wxID_ANY, "All options are in microseconds.", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE_HORIZONTAL);
m_adv_text->Wrap(200);
m_adv_text2->Wrap(200);
m_adv_text2->Wrap(200);
m_babble_box->Add(m_adv_text, wxSizerFlags().Expand().Border(wxALL, 5).Centre());
m_babble_box->Add(m_adv_text2, wxSizerFlags().Expand().Border(wxALL, 5).Centre());
m_babble_box->Add(m_adv_text3, wxSizerFlags().Expand().Border(wxALL, 5).Centre());
m_adv_box->Add(m_babble_box, wxSizerFlags().Expand().Centre());
reset_button = new wxButton(this, wxID_ANY, "Reset To Defaults");
m_adv_box->Add(reset_button, wxSizerFlags().Expand().Centre().Border(wxALL, 5));
// Volume Slider
seq_box = new wxStaticBoxSizer(wxVERTICAL, this, "Sequence Length");
seq_slider = new wxSlider(this, wxID_ANY, SoundtouchCfg::SequenceLenMS, SoundtouchCfg::SequenceLen_Min, SoundtouchCfg::SequenceLen_Max, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
seq_box->Add(seq_slider, wxSizerFlags().Expand());
m_adv_box->Add(seq_box, wxSizerFlags().Expand().Centre().Border(wxALL, 5));
// Volume Slider
seek_box = new wxStaticBoxSizer(wxVERTICAL, this, "Seek Window Size");
seek_slider = new wxSlider(this, wxID_ANY, SoundtouchCfg::SeekWindowMS, SoundtouchCfg::SeekWindow_Min, SoundtouchCfg::SeekWindow_Max, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
seek_box->Add(seek_slider, wxSizerFlags().Expand());
m_adv_box->Add(seek_box, wxSizerFlags().Expand().Centre().Border(wxALL, 5));
// Volume Slider
overlap_box = new wxStaticBoxSizer(wxVERTICAL, this, "Overlap");
overlap_slider = new wxSlider(this, wxID_ANY, SoundtouchCfg::OverlapMS, SoundtouchCfg::Overlap_Min, SoundtouchCfg::Overlap_Max, wxDefaultPosition, wxDefaultSize, wxSL_LABELS);
overlap_box->Add(overlap_slider, wxSizerFlags().Expand().Centre());
m_adv_box->Add(overlap_box, wxSizerFlags().Expand().Centre().Border(wxALL, 5));
SetSizerAndFit(m_adv_box);
Bind(wxEVT_BUTTON, &AdvDialog::CallReset, this);
}
AdvDialog::~AdvDialog()
{
}
void AdvDialog::Reset()
{
seq_slider->SetValue(30);
seek_slider->SetValue(20);
overlap_slider->SetValue(10);
}
void AdvDialog::CallReset(wxCommandEvent &event)
{
Reset();
}
void AdvDialog::LoadValues()
{
SoundtouchCfg::ReadSettings();
seq_slider->SetValue(SoundtouchCfg::SequenceLenMS);
seek_slider->SetValue(SoundtouchCfg::SeekWindowMS);
overlap_slider->SetValue(SoundtouchCfg::OverlapMS);
}
void AdvDialog::SaveValues()
{
SoundtouchCfg::SequenceLenMS = seq_slider->GetValue();
SoundtouchCfg::SeekWindowMS = seek_slider->GetValue();
SoundtouchCfg::OverlapMS = overlap_slider->GetValue();
SoundtouchCfg::WriteSettings();
}
void AdvDialog::Display()
{
LoadValues();
ShowModal();
SaveValues();
}
}; // namespace SoundtouchCfg

View File

@ -0,0 +1,92 @@
/* SPU2-X, A plugin for Emulating the Sound Processing Unit of the Playstation 2
* Developed and maintained by the Pcsx2 Development Team.
*
* Original portions from SPU2ghz are (c) 2008 by David Quintana [gigaherz]
*
* SPU2-X is free software: you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* SPU2-X is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with SPU2-X. If not, see <http://www.gnu.org/licenses/>.
*/
#include <wx/wx.h>
#include <wx/panel.h>
#include <wx/wrapsizer.h>
#if defined(__unix__) || defined(__APPLE__)
#include <SDL.h>
#include <SDL_audio.h>
#include "Linux/Config.h"
#endif
namespace SoundtouchCfg
{
class AdvDialog : public wxDialog
{
wxBoxSizer *m_adv_box, *m_babble_box;
wxButton *reset_button;
wxStaticText *m_adv_text, *m_adv_text2, *m_adv_text3;
wxSlider *seq_slider, *seek_slider, *overlap_slider;
wxStaticBoxSizer *seq_box, *seek_box, *overlap_box;
public:
AdvDialog();
~AdvDialog();
void Display();
void LoadValues();
void SaveValues();
void Reset();
void CallReset(wxCommandEvent &event);
};
}; // namespace SoundtouchCfg
class DebugDialog : public wxDialog
{
wxBoxSizer *m_debug_top_box;
wxBoxSizer *m_together_box;
wxStaticBoxSizer *m_console_box, *m_log_only_box, *dump_box;
wxCheckBox *show_check;
wxCheckBox *key_check, *voice_check, *dma_check, *autodma_check, *buffer_check, *adpcm_check;
wxCheckBox *dma_actions_check, *dma_writes_check, *auto_output_check;
wxCheckBox *core_voice_check, *memory_check, *register_check;
public:
DebugDialog();
~DebugDialog();
void Display();
void ResetToValues();
void SaveValues();
void Reconfigure();
void CallReconfigure(wxCommandEvent &event);
};
class Dialog : public wxDialog
{
wxBoxSizer *m_top_box, *m_left_box, *m_right_box;
wxBoxSizer *m_portaudio_box, *m_sdl_box, *m_audio_box;
wxStaticBoxSizer *m_mix_box, *m_debug_box, *m_output_box, *m_volume_box, *m_latency_box, *m_sync_box;
wxArrayString m_interpolation, m_module, m_portaudio, m_sdl, m_sync, m_audio;
wxChoice *m_inter_select, *m_module_select, *m_portaudio_select, *m_sdl_select, *m_sync_select, *m_audio_select;
wxStaticText *m_portaudio_text, *m_sdl_text;
wxCheckBox *effect_check, *dealias_check, *debug_check;
wxSlider *m_latency_slider, *m_volume_slider;
wxButton *launch_debug_dialog, *launch_adv_dialog;
public:
Dialog();
~Dialog();
void Display();
void ResetToValues();
void SaveValues();
void Reconfigure();
void CallReconfigure(wxCommandEvent &event);
void OnButtonClicked(wxCommandEvent &event);
};