spu2x: linux port of Giga lastest update

=> Advanced (per-channel) Volume Adjustment AKA Room Correction

windows: update CfgReadFloat to really return a float
This commit is contained in:
Gregory Hainaut 2014-06-28 11:23:44 +02:00
parent f2e50d4ffd
commit 2084ead56c
5 changed files with 71 additions and 6 deletions

View File

@ -52,6 +52,12 @@ void CfgWriteInt(const wchar_t* Section, const wchar_t* Name, int Value)
spuConfig->Write(Name, Value);
}
void CfgWriteFloat(const wchar_t* Section, const wchar_t* Name, float Value)
{
setIni(Section);
spuConfig->Write(Name, (double)Value);
}
void CfgWriteStr(const wchar_t* Section, const wchar_t* Name, const wxString& Data)
{
setIni(Section);
@ -78,6 +84,16 @@ int CfgReadInt(const wchar_t* Section, const wchar_t* Name,int Default)
return ret;
}
float CfgReadFloat(const wchar_t* Section, const wchar_t* Name, float Default)
{
double ret;
setIni(Section);
spuConfig->Read(Name, &ret, (double)Default);
return (float)ret;
}
void CfgReadStr(const wchar_t* Section, const wchar_t* Name, wchar_t* Data, int DataSize, const wchar_t* Default)
{
setIni(Section);

View File

@ -42,7 +42,25 @@ int Interpolation = 4;
*/
bool EffectsDisabled = false;
float FinalVolume;
float FinalVolume; // global
bool AdvancedVolumeControl;
float VolumeAdjustFLdb; // decibels settings, cos audiophiles love that
float VolumeAdjustCdb;
float VolumeAdjustFRdb;
float VolumeAdjustBLdb;
float VolumeAdjustBRdb;
float VolumeAdjustSLdb;
float VolumeAdjustSRdb;
float VolumeAdjustLFEdb;
float VolumeAdjustFL; // linear coefs calcualted from decibels,
float VolumeAdjustC;
float VolumeAdjustFR;
float VolumeAdjustBL;
float VolumeAdjustBR;
float VolumeAdjustSL;
float VolumeAdjustSR;
float VolumeAdjustLFE;
bool postprocess_filter_enabled = true;
bool postprocess_filter_dealias = false;
bool _visual_debug_enabled = false; // windows only feature
@ -71,7 +89,26 @@ void ReadSettings()
EffectsDisabled = CfgReadBool( L"MIXING", L"Disable_Effects", false );
postprocess_filter_dealias = CfgReadBool( L"MIXING", L"DealiasFilter", false );
FinalVolume = ((float)CfgReadInt( L"MIXING", L"FinalVolume", 100 )) / 100;
if ( FinalVolume > 1.0f) FinalVolume = 1.0f;
if ( FinalVolume > 1.0f) FinalVolume = 1.0f;
AdvancedVolumeControl = CfgReadBool(L"MIXING", L"AdvancedVolumeControl", false);
VolumeAdjustCdb = CfgReadFloat(L"MIXING", L"VolumeAdjustC(dB)", 0);
VolumeAdjustFLdb = CfgReadFloat(L"MIXING", L"VolumeAdjustFL(dB)", 0);
VolumeAdjustFRdb = CfgReadFloat(L"MIXING", L"VolumeAdjustFR(dB)", 0);
VolumeAdjustBLdb = CfgReadFloat(L"MIXING", L"VolumeAdjustBL(dB)", 0);
VolumeAdjustBRdb = CfgReadFloat(L"MIXING", L"VolumeAdjustBR(dB)", 0);
VolumeAdjustSLdb = CfgReadFloat(L"MIXING", L"VolumeAdjustSL(dB)", 0);
VolumeAdjustSRdb = CfgReadFloat(L"MIXING", L"VolumeAdjustSR(dB)", 0);
VolumeAdjustLFEdb = CfgReadFloat(L"MIXING", L"VolumeAdjustLFE(dB)", 0);
VolumeAdjustC = powf(10, VolumeAdjustCdb / 10);
VolumeAdjustFL = powf(10, VolumeAdjustFLdb / 10);
VolumeAdjustFR = powf(10, VolumeAdjustFRdb / 10);
VolumeAdjustBL = powf(10, VolumeAdjustBLdb / 10);
VolumeAdjustBR = powf(10, VolumeAdjustBRdb / 10);
VolumeAdjustSL = powf(10, VolumeAdjustSLdb / 10);
VolumeAdjustSR = powf(10, VolumeAdjustSRdb / 10);
VolumeAdjustLFE = powf(10, VolumeAdjustLFEdb / 10);
wxString temp;
CfgReadStr( L"OUTPUT", L"Output_Module", temp, PortaudioOut->GetIdent() );
@ -109,12 +146,22 @@ void WriteSettings()
FileLog("Write called without the path set.\n");
return;
}
CfgWriteInt(L"MIXING",L"Interpolation",Interpolation);
CfgWriteBool(L"MIXING",L"Disable_Effects",EffectsDisabled);
CfgWriteBool(L"MIXING",L"DealiasFilter",postprocess_filter_dealias);
CfgWriteInt(L"MIXING",L"FinalVolume",(int)(FinalVolume * 100 +0.5f));
CfgWriteBool(L"MIXING", L"AdvancedVolumeControl", AdvancedVolumeControl);
CfgWriteFloat(L"MIXING", L"VolumeAdjustC(dB)", VolumeAdjustCdb);
CfgWriteFloat(L"MIXING", L"VolumeAdjustFL(dB)", VolumeAdjustFLdb);
CfgWriteFloat(L"MIXING", L"VolumeAdjustFR(dB)", VolumeAdjustFRdb);
CfgWriteFloat(L"MIXING", L"VolumeAdjustBL(dB)", VolumeAdjustBLdb);
CfgWriteFloat(L"MIXING", L"VolumeAdjustBR(dB)", VolumeAdjustBRdb);
CfgWriteFloat(L"MIXING", L"VolumeAdjustSL(dB)", VolumeAdjustSLdb);
CfgWriteFloat(L"MIXING", L"VolumeAdjustSR(dB)", VolumeAdjustSRdb);
CfgWriteFloat(L"MIXING", L"VolumeAdjustLFE(dB)", VolumeAdjustLFEdb);
CfgWriteStr(L"OUTPUT",L"Output_Module", mods[OutputModule]->GetIdent() );
CfgWriteInt(L"OUTPUT",L"Latency", SndOutLatencyMS);
CfgWriteInt(L"OUTPUT",L"Synch_Mode", SynchMode);

View File

@ -33,11 +33,13 @@ extern void CfgSetLogDir(const char* dir);
extern void CfgWriteBool(const wchar_t* Section, const wchar_t* Name, bool Value);
extern void CfgWriteInt(const wchar_t* Section, const wchar_t* Name, int Value);
extern void CfgWriteFloat(const wchar_t* Section, const wchar_t* Name, float Value);
extern void CfgWriteStr(const wchar_t* Section, const wchar_t* Name, const wxString& Data);
extern bool CfgReadBool(const wchar_t *Section,const wchar_t* Name, bool Default);
extern void CfgReadStr(const wchar_t* Section, const wchar_t* Name, wxString& Data, const wchar_t* Default);
//extern void CfgReadStr(const wchar_t* Section, const wchar_t* Name, wchar_t* Data, int DataSize, const wchar_t* Default);
extern int CfgReadInt(const wchar_t* Section, const wchar_t* Name,int Default);
extern int CfgReadInt(const wchar_t* Section, const wchar_t* Name,int Default) ;
extern float CfgReadFloat(const wchar_t* Section, const wchar_t* Name, float Default);
#endif

View File

@ -140,7 +140,7 @@ int CfgReadInt(const TCHAR* Section, const TCHAR* Name,int Default)
return _wtoi(Data);
}
int CfgReadFloat(const TCHAR* Section, const TCHAR* Name, float Default)
float CfgReadFloat(const TCHAR* Section, const TCHAR* Name, float Default)
{
TCHAR Data[255] = { 0 };
GetPrivateProfileString(Section, Name, L"", Data, 255, CfgFile);

View File

@ -61,7 +61,7 @@ extern bool CfgReadBool(const TCHAR *Section,const TCHAR* Name, bool Default);
extern void CfgReadStr(const TCHAR* Section, const TCHAR* Name, wxString& Data, const TCHAR* Default);
extern void CfgReadStr(const TCHAR* Section, const TCHAR* Name, TCHAR* Data, int DataSize, const TCHAR* Default);
extern int CfgReadInt(const TCHAR* Section, const TCHAR* Name, int Default);
extern int CfgReadFloat(const TCHAR* Section, const TCHAR* Name, float Default);
extern float CfgReadFloat(const TCHAR* Section, const TCHAR* Name, float Default);
// Items Specific to DirectSound
#define STRFY(x) #x