mirror of https://github.com/PCSX2/pcsx2.git
spu2-x: Implement most of the configuration dialog in Linux (minus logging and advanced).
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2640 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
3308fa513f
commit
59459a5df5
|
@ -67,13 +67,15 @@ extern bool EffectsDisabled;
|
|||
|
||||
extern u32 OutputModule;
|
||||
extern int SndOutLatencyMS;
|
||||
extern bool timeStretchDisabled;
|
||||
|
||||
#ifndef __LINUX__
|
||||
extern wchar_t dspPlugin[];
|
||||
extern int dspPluginModule;
|
||||
|
||||
extern bool dspPluginEnabled;
|
||||
extern bool timeStretchDisabled;
|
||||
extern bool StereoExpansionEnabled;
|
||||
#endif
|
||||
|
||||
namespace SoundtouchCfg
|
||||
{
|
||||
|
|
|
@ -91,6 +91,13 @@ int CfgReadInt(const wchar_t* Section, const wchar_t* Name,int Default)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void CfgReadStr(const wchar_t* Section, const wchar_t* Name, wchar_t* Data, int DataSize, const wchar_t* Default)
|
||||
{
|
||||
wxConfig *config = setIni(Section);
|
||||
wcscpy(Data, config->Read(Name, Default));
|
||||
writeIni(config);
|
||||
}
|
||||
|
||||
void CfgReadStr(const wchar_t* Section, const wchar_t* Name, wxString& Data, int DataSize, const wchar_t* Default)
|
||||
{
|
||||
wxConfig *config = setIni(Section);
|
||||
|
@ -104,3 +111,4 @@ void CfgReadStr(const wchar_t* Section, const wchar_t* Name, wstring& Data, int
|
|||
CfgReadStr(Section, Name, temp, DataSize, Default);
|
||||
Data = temp.c_str();
|
||||
}
|
||||
|
||||
|
|
|
@ -17,35 +17,8 @@
|
|||
|
||||
#include "Global.h"
|
||||
#include "Dialogs.h"
|
||||
#include "Config.h"
|
||||
|
||||
bool DebugEnabled=false;
|
||||
bool _MsgToConsole=false;
|
||||
bool _MsgKeyOnOff=false;
|
||||
bool _MsgVoiceOff=false;
|
||||
bool _MsgDMA=false;
|
||||
bool _MsgAutoDMA=false;
|
||||
bool _MsgOverruns=false;
|
||||
bool _MsgCache=false;
|
||||
|
||||
bool _AccessLog=false;
|
||||
bool _DMALog=false;
|
||||
bool _WaveLog=false;
|
||||
|
||||
bool _CoresDump=false;
|
||||
bool _MemDump=false;
|
||||
bool _RegDump=false;
|
||||
|
||||
wchar_t AccessLogFileName[255];
|
||||
wchar_t WaveLogFileName[255];
|
||||
|
||||
wchar_t DMA4LogFileName[255];
|
||||
wchar_t DMA7LogFileName[255];
|
||||
|
||||
wchar_t CoresDumpFileName[255];
|
||||
wchar_t MemDumpFileName[255];
|
||||
wchar_t RegDumpFileName[255];
|
||||
|
||||
#include "Config.h"
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#ifdef PCSX2_DEVBUILD
|
||||
static const int LATENCY_MAX = 3000;
|
||||
|
@ -57,58 +30,43 @@ static const int LATENCY_MIN = 40;
|
|||
|
||||
int AutoDMAPlayRate[2] = {0,0};
|
||||
|
||||
// MIXING
|
||||
int Interpolation = 1;
|
||||
/* values:
|
||||
0: no interpolation (use nearest)
|
||||
1. linear interpolation
|
||||
2. cubic interpolation
|
||||
*/
|
||||
int ReverbBoost = 0;
|
||||
bool EffectsDisabled = false;
|
||||
|
||||
// OUTPUT
|
||||
int SndOutLatencyMS = 160;
|
||||
bool timeStretchDisabled = false;
|
||||
|
||||
u32 OutputModule = FindOutputModuleById( PortaudioOut->GetIdent() );
|
||||
|
||||
CONFIG_DSOUNDOUT Config_DSoundOut;
|
||||
CONFIG_WAVEOUT Config_WaveOut;
|
||||
CONFIG_XAUDIO2 Config_XAudio2;
|
||||
|
||||
// DSP
|
||||
bool dspPluginEnabled = false;
|
||||
int dspPluginModule = 0;
|
||||
wchar_t dspPlugin[256];
|
||||
|
||||
bool StereoExpansionEnabled = false;
|
||||
|
||||
// Default settings.
|
||||
|
||||
// MIXING
|
||||
int Interpolation = 1;
|
||||
/* values:
|
||||
0: no interpolation (use nearest)
|
||||
1. linear interpolation
|
||||
2. cubic interpolation
|
||||
*/
|
||||
bool EffectsDisabled = false;
|
||||
int ReverbBoost = 0;
|
||||
|
||||
// OUTPUT
|
||||
u32 OutputModule = FindOutputModuleById( PortaudioOut->GetIdent() );
|
||||
int SndOutLatencyMS = 160;
|
||||
bool timeStretchDisabled = false;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void ReadSettings()
|
||||
{
|
||||
Interpolation = CfgReadInt( L"MIXING",L"Interpolation", 1 );
|
||||
EffectsDisabled = CfgReadBool( L"MIXING", L"Disable_Effects", false );
|
||||
ReverbBoost = CfgReadInt( L"MIXING",L"Reverb_Boost", 0 );
|
||||
|
||||
timeStretchDisabled = CfgReadBool( L"OUTPUT", L"Disable_Timestretch", false );
|
||||
EffectsDisabled = CfgReadBool( L"MIXING", L"Disable_Effects", false );
|
||||
|
||||
StereoExpansionEnabled = CfgReadBool( L"OUTPUT", L"Enable_StereoExpansion", false );
|
||||
wstring temp;
|
||||
CfgReadStr( L"OUTPUT", L"Output_Module", temp, 127, PortaudioOut->GetIdent() );
|
||||
OutputModule = FindOutputModuleById( temp.c_str() );// find the driver index of this module
|
||||
|
||||
SndOutLatencyMS = CfgReadInt(L"OUTPUT",L"Latency", 150);
|
||||
|
||||
wchar_t omodid[128];
|
||||
//CfgReadStr( L"OUTPUT", L"Output_Module", omodid, 127, PortaudioOut->GetIdent() );
|
||||
|
||||
// find the driver index of this module:
|
||||
//OutputModule = FindOutputModuleById( omodid );
|
||||
|
||||
// Read DSOUNDOUT and WAVEOUT configs:
|
||||
CfgReadStr( L"WAVEOUT", L"Device", Config_WaveOut.Device, 254, L"default" );
|
||||
Config_WaveOut.NumBuffers = CfgReadInt( L"WAVEOUT", L"Buffer_Count", 4 );
|
||||
timeStretchDisabled = CfgReadBool( L"OUTPUT", L"Disable_Timestretch", false );
|
||||
|
||||
PortaudioOut->ReadSettings();
|
||||
|
||||
SoundtouchCfg::ReadSettings();
|
||||
//DebugConfig::ReadSettings();
|
||||
|
||||
|
@ -125,31 +83,147 @@ void ReadSettings()
|
|||
void WriteSettings()
|
||||
{
|
||||
CfgWriteInt(L"MIXING",L"Interpolation",Interpolation);
|
||||
CfgWriteInt(L"MIXING",L"Reverb_Boost",ReverbBoost);
|
||||
|
||||
CfgWriteBool(L"MIXING",L"Disable_Effects",EffectsDisabled);
|
||||
CfgWriteInt(L"MIXING",L"Reverb_Boost",ReverbBoost);
|
||||
|
||||
CfgWriteStr(L"OUTPUT",L"Output_Module", mods[OutputModule]->GetIdent() );
|
||||
CfgWriteInt(L"OUTPUT",L"Latency", SndOutLatencyMS);
|
||||
CfgWriteBool(L"OUTPUT",L"Disable_Timestretch", timeStretchDisabled);
|
||||
CfgWriteBool(L"OUTPUT",L"Enable_StereoExpansion", StereoExpansionEnabled);
|
||||
|
||||
if( Config_WaveOut.Device.empty() ) Config_WaveOut.Device = L"default";
|
||||
CfgWriteStr(L"WAVEOUT",L"Device",Config_WaveOut.Device);
|
||||
CfgWriteInt(L"WAVEOUT",L"Buffer_Count",Config_WaveOut.NumBuffers);
|
||||
|
||||
PortaudioOut->WriteSettings();
|
||||
SoundtouchCfg::WriteSettings();
|
||||
//DebugConfig::WriteSettings();
|
||||
}
|
||||
|
||||
void displayDialog();
|
||||
|
||||
void configure()
|
||||
{
|
||||
ReadSettings();
|
||||
displayDialog();
|
||||
WriteSettings();
|
||||
}
|
||||
|
||||
void MessageBox(char const*, ...)
|
||||
{
|
||||
}
|
||||
|
||||
void displayDialog()
|
||||
{
|
||||
GtkWidget *dialog, *main_label;
|
||||
int return_value;
|
||||
|
||||
GtkWidget *mixing_label;
|
||||
|
||||
GtkWidget *int_label, *int_box;
|
||||
|
||||
GtkWidget *effects_check;
|
||||
|
||||
GtkWidget *reverb_label, *reverb_box;
|
||||
|
||||
GtkWidget *output_label;
|
||||
|
||||
GtkWidget *mod_label, *mod_box;
|
||||
|
||||
GtkWidget *latency_slide;
|
||||
GtkWidget *time_check;
|
||||
GtkWidget *advanced_button;
|
||||
|
||||
GtkWidget *mixing_vbox, *output_vbox, *main_hbox;
|
||||
|
||||
/* Create the widgets */
|
||||
dialog = gtk_dialog_new_with_buttons (
|
||||
"Spu2-X Config",
|
||||
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 ("Spu2-X Config");
|
||||
|
||||
mixing_label = gtk_label_new ("Mixing Settings:");
|
||||
|
||||
int_label = gtk_label_new ("Interpolation:");
|
||||
int_box = gtk_combo_box_new_text ();
|
||||
gtk_combo_box_append_text(GTK_COMBO_BOX(int_box), "0 - Nearest(none/fast)");
|
||||
gtk_combo_box_append_text(GTK_COMBO_BOX(int_box), "1 - Linear (reccommended)");
|
||||
gtk_combo_box_append_text(GTK_COMBO_BOX(int_box), "2 - Cubic (slower/maybe better)");
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(int_box), Interpolation);
|
||||
|
||||
effects_check = gtk_check_button_new_with_label("Disable Effects Processing");
|
||||
|
||||
reverb_label = gtk_label_new ("Reverb Boost Factor:");
|
||||
reverb_box = gtk_combo_box_new_text ();
|
||||
gtk_combo_box_append_text(GTK_COMBO_BOX(reverb_box), "1X - Normal Reverb Volume");
|
||||
gtk_combo_box_append_text(GTK_COMBO_BOX(reverb_box), "2X - Reverb Volume x 2");
|
||||
gtk_combo_box_append_text(GTK_COMBO_BOX(reverb_box), "4X - Reverb Volume x 4");
|
||||
gtk_combo_box_append_text(GTK_COMBO_BOX(reverb_box), "8X - Reverb Volume x 8");
|
||||
gtk_combo_box_set_active(GTK_COMBO_BOX(reverb_box), ReverbBoost);
|
||||
|
||||
output_label = gtk_label_new ("Output Settings:");
|
||||
|
||||
mod_label = gtk_label_new ("Module:");
|
||||
mod_box = gtk_combo_box_new_text ();
|
||||
gtk_combo_box_append_text(GTK_COMBO_BOX(mod_box), "0 - No Sound (emulate SPU2 only)");
|
||||
gtk_combo_box_append_text(GTK_COMBO_BOX(mod_box), "1 - PortAudio (cross-platform)");
|
||||
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
|
||||
|
||||
mixing_vbox = gtk_vbox_new(false, 5);
|
||||
output_vbox = gtk_vbox_new(false, 5);
|
||||
main_hbox = gtk_hbox_new(false, 5);
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(mixing_vbox), mixing_label);
|
||||
gtk_container_add(GTK_CONTAINER(mixing_vbox), int_label);
|
||||
gtk_container_add(GTK_CONTAINER(mixing_vbox), int_box);
|
||||
gtk_container_add(GTK_CONTAINER(mixing_vbox), effects_check);
|
||||
gtk_container_add(GTK_CONTAINER(mixing_vbox), reverb_label);
|
||||
gtk_container_add(GTK_CONTAINER(mixing_vbox), reverb_box);
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(output_vbox), output_label);
|
||||
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), time_check);
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(main_hbox), mixing_vbox);
|
||||
gtk_container_add(GTK_CONTAINER(main_hbox), output_vbox);
|
||||
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(effects_check), EffectsDisabled);
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(time_check), timeStretchDisabled);
|
||||
|
||||
/* Add all our widgets, and show everything we've added to the dialog. */
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), main_label);
|
||||
gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), main_hbox);
|
||||
gtk_widget_show_all (dialog);
|
||||
|
||||
return_value = gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
|
||||
if (return_value == GTK_RESPONSE_ACCEPT)
|
||||
{
|
||||
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(reverb_box)) != -1)
|
||||
ReverbBoost = gtk_combo_box_get_active(GTK_COMBO_BOX(reverb_box));
|
||||
|
||||
if (gtk_combo_box_get_active(GTK_COMBO_BOX(mod_box)) != 1)
|
||||
OutputModule = 0;
|
||||
else
|
||||
OutputModule = FindOutputModuleById( PortaudioOut->GetIdent() );
|
||||
|
||||
SndOutLatencyMS = gtk_range_get_value(GTK_RANGE(latency_slide));
|
||||
timeStretchDisabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(time_check));
|
||||
}
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
|
||||
}
|
||||
|
|
|
@ -15,4 +15,96 @@
|
|||
* along with SPU2-X. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// To be continued...
|
||||
#include "Global.h"
|
||||
#include "Dialogs.h"
|
||||
|
||||
bool DebugEnabled=false;
|
||||
bool _MsgToConsole=false;
|
||||
bool _MsgKeyOnOff=false;
|
||||
bool _MsgVoiceOff=false;
|
||||
bool _MsgDMA=false;
|
||||
bool _MsgAutoDMA=false;
|
||||
bool _MsgOverruns=false;
|
||||
bool _MsgCache=false;
|
||||
|
||||
bool _AccessLog=false;
|
||||
bool _DMALog=false;
|
||||
bool _WaveLog=false;
|
||||
|
||||
bool _CoresDump=false;
|
||||
bool _MemDump=false;
|
||||
bool _RegDump=false;
|
||||
|
||||
wchar_t AccessLogFileName[255];
|
||||
wchar_t WaveLogFileName[255];
|
||||
|
||||
wchar_t DMA4LogFileName[255];
|
||||
wchar_t DMA7LogFileName[255];
|
||||
|
||||
wchar_t CoresDumpFileName[255];
|
||||
wchar_t MemDumpFileName[255];
|
||||
wchar_t RegDumpFileName[255];
|
||||
|
||||
/*namespace DebugConfig {
|
||||
|
||||
static const wchar_t* Section = L"DEBUG";
|
||||
|
||||
void ReadSettings()
|
||||
{
|
||||
DebugEnabled = CfgReadBool(Section, L"Global_Enable",0);
|
||||
_MsgToConsole= CfgReadBool(Section, L"Show_Messages",0);
|
||||
_MsgKeyOnOff = CfgReadBool(Section, L"Show_Messages_Key_On_Off",0);
|
||||
_MsgVoiceOff = CfgReadBool(Section, L"Show_Messages_Voice_Off",0);
|
||||
_MsgDMA = CfgReadBool(Section, L"Show_Messages_DMA_Transfer",0);
|
||||
_MsgAutoDMA = CfgReadBool(Section, L"Show_Messages_AutoDMA",0);
|
||||
_MsgOverruns = CfgReadBool(Section, L"Show_Messages_Overruns",0);
|
||||
_MsgCache = CfgReadBool(Section, L"Show_Messages_CacheStats",0);
|
||||
|
||||
_AccessLog = CfgReadBool(Section, L"Log_Register_Access",0);
|
||||
_DMALog = CfgReadBool(Section, L"Log_DMA_Transfers",0);
|
||||
_WaveLog = CfgReadBool(Section, L"Log_WAVE_Output",0);
|
||||
|
||||
_CoresDump = CfgReadBool(Section, L"Dump_Info",0);
|
||||
_MemDump = CfgReadBool(Section, L"Dump_Memory",0);
|
||||
_RegDump = CfgReadBool(Section, L"Dump_Regs",0);
|
||||
|
||||
CfgReadStr(Section,L"Access_Log_Filename",AccessLogFileName,255,L"logs/SPU2Log.txt");
|
||||
CfgReadStr(Section,L"WaveLog_Filename", WaveLogFileName, 255,L"logs/SPU2log.wav");
|
||||
CfgReadStr(Section,L"DMA4Log_Filename", DMA4LogFileName, 255,L"logs/SPU2dma4.dat");
|
||||
CfgReadStr(Section,L"DMA7Log_Filename", DMA7LogFileName, 255,L"logs/SPU2dma7.dat");
|
||||
|
||||
CfgReadStr(Section,L"Info_Dump_Filename",CoresDumpFileName,255,L"logs/SPU2Cores.txt");
|
||||
CfgReadStr(Section,L"Mem_Dump_Filename", MemDumpFileName, 255,L"logs/SPU2mem.dat");
|
||||
CfgReadStr(Section,L"Reg_Dump_Filename", RegDumpFileName, 255,L"logs/SPU2regs.dat");
|
||||
}
|
||||
|
||||
|
||||
void WriteSettings()
|
||||
{
|
||||
CfgWriteBool(Section,L"Global_Enable",DebugEnabled);
|
||||
|
||||
CfgWriteBool(Section,L"Show_Messages", _MsgToConsole);
|
||||
CfgWriteBool(Section,L"Show_Messages_Key_On_Off", _MsgKeyOnOff);
|
||||
CfgWriteBool(Section,L"Show_Messages_Voice_Off", _MsgVoiceOff);
|
||||
CfgWriteBool(Section,L"Show_Messages_DMA_Transfer",_MsgDMA);
|
||||
CfgWriteBool(Section,L"Show_Messages_AutoDMA", _MsgAutoDMA);
|
||||
CfgWriteBool(Section,L"Show_Messages_Overruns", _MsgOverruns);
|
||||
CfgWriteBool(Section,L"Show_Messages_CacheStats", _MsgCache);
|
||||
|
||||
CfgWriteBool(Section,L"Log_Register_Access",_AccessLog);
|
||||
CfgWriteBool(Section,L"Log_DMA_Transfers", _DMALog);
|
||||
CfgWriteBool(Section,L"Log_WAVE_Output", _WaveLog);
|
||||
|
||||
CfgWriteBool(Section,L"Dump_Info", _CoresDump);
|
||||
CfgWriteBool(Section,L"Dump_Memory",_MemDump);
|
||||
CfgWriteBool(Section,L"Dump_Regs", _RegDump);
|
||||
|
||||
CfgWriteStr(Section,L"Access_Log_Filename",AccessLogFileName);
|
||||
CfgWriteStr(Section,L"WaveLog_Filename", WaveLogFileName);
|
||||
CfgWriteStr(Section,L"DMA4Log_Filename", DMA4LogFileName);
|
||||
CfgWriteStr(Section,L"DMA7Log_Filename", DMA7LogFileName);
|
||||
|
||||
CfgWriteStr(Section,L"Info_Dump_Filename",CoresDumpFileName);
|
||||
CfgWriteStr(Section,L"Mem_Dump_Filename", MemDumpFileName);
|
||||
CfgWriteStr(Section,L"Reg_Dump_Filename", RegDumpFileName);
|
||||
}*/
|
||||
|
|
|
@ -325,7 +325,7 @@ static s32 __forceinline GetNoiseValues()
|
|||
"XOR %%eax,%%ebx\n"
|
||||
"ROR %%eax,3\n"
|
||||
"MOV %0,%%eax\n"
|
||||
".att_syntax\n" : "r="(Seed) :"r"(Seed));
|
||||
".att_syntax\n" : "=r"(Seed) :"r"(Seed));
|
||||
#endif
|
||||
return retval;
|
||||
}
|
||||
|
|
|
@ -405,7 +405,9 @@ EXPORT_C_(s32) SPU2open(void *pDsp)
|
|||
{
|
||||
SndBuffer::Init();
|
||||
spdif_init();
|
||||
#ifndef __LINUX__
|
||||
DspLoadLibrary(dspPlugin,dspPluginModule);
|
||||
#endif
|
||||
WaveDump::Open();
|
||||
}
|
||||
catch( std::exception& ex )
|
||||
|
|
Loading…
Reference in New Issue