Config: Add SPU2 options to global struct

This commit is contained in:
Connor McLaughlin 2021-12-19 00:23:43 +10:00 committed by refractionpcsx2
parent b3b7c55b9a
commit af2b9e3a4c
2 changed files with 114 additions and 0 deletions

View File

@ -378,6 +378,82 @@ struct Pcsx2Config
}
};
struct SPU2Options
{
enum class InterpolationMode
{
Nearest,
Linear,
Cubic,
Hermite,
CatmullRom,
Gaussian
};
enum class SynchronizationMode
{
TimeStretch,
ASync,
NoSync,
};
BITFIELD32()
bool
AdvancedVolumeControl : 1;
BITFIELD_END
InterpolationMode Interpolation = InterpolationMode::Gaussian;
SynchronizationMode SynchMode = SynchronizationMode::TimeStretch;
s32 FinalVolume = 100;
s32 Latency{100};
s32 SpeakerConfiguration{0};
double VolumeAdjustC{ 0.0f };
double VolumeAdjustFL{ 0.0f };
double VolumeAdjustFR{ 0.0f };
double VolumeAdjustBL{ 0.0f };
double VolumeAdjustBR{ 0.0f };
double VolumeAdjustSL{ 0.0f };
double VolumeAdjustSR{ 0.0f };
double VolumeAdjustLFE{ 0.0f };
std::string OutputModule;
SPU2Options();
void LoadSave(SettingsWrapper& wrap);
bool operator==(const SPU2Options& right) const
{
return OpEqu(bitset) &&
OpEqu(Interpolation) &&
OpEqu(SynchMode) &&
OpEqu(FinalVolume) &&
OpEqu(Latency) &&
OpEqu(SpeakerConfiguration) &&
OpEqu(VolumeAdjustC) &&
OpEqu(VolumeAdjustFL) &&
OpEqu(VolumeAdjustFR) &&
OpEqu(VolumeAdjustBL) &&
OpEqu(VolumeAdjustBR) &&
OpEqu(VolumeAdjustSL) &&
OpEqu(VolumeAdjustSR) &&
OpEqu(VolumeAdjustLFE) &&
OpEqu(OutputModule);
}
bool operator!=(const SPU2Options& right) const
{
return !this->operator==(right);
}
};
// ------------------------------------------------------------------------
// NOTE: The GUI's GameFixes panel is dependent on the order of bits in this structure.
struct GamefixOptions
@ -576,6 +652,7 @@ struct Pcsx2Config
ProfilerOptions Profiler;
DebugOptions Debugger;
FramerateOptions Framerate;
SPU2Options SPU2;
TraceLogFilters Trace;

View File

@ -306,6 +306,39 @@ int Pcsx2Config::GSOptions::GetVsync() const
}
}
Pcsx2Config::SPU2Options::SPU2Options()
{
OutputModule = "cubeb";
}
void Pcsx2Config::SPU2Options::LoadSave(SettingsWrapper& wrap)
{
{
SettingsWrapSection("SPU2/Mixing");
Interpolation = static_cast<InterpolationMode>(wrap.EntryBitfield(CURRENT_SETTINGS_SECTION, "Interpolation", static_cast<int>(Interpolation), static_cast<int>(Interpolation)));
SettingsWrapEntry(FinalVolume);
SettingsWrapEntry(VolumeAdjustC);
SettingsWrapEntry(VolumeAdjustFL);
SettingsWrapEntry(VolumeAdjustFR);
SettingsWrapEntry(VolumeAdjustBL);
SettingsWrapEntry(VolumeAdjustBR);
SettingsWrapEntry(VolumeAdjustSL);
SettingsWrapEntry(VolumeAdjustSR);
SettingsWrapEntry(VolumeAdjustLFE);
}
{
SettingsWrapSection("SPU2/Output");
SettingsWrapEntry(OutputModule);
SettingsWrapEntry(Latency);
SynchMode = static_cast<SynchronizationMode>(wrap.EntryBitfield(CURRENT_SETTINGS_SECTION, "SynchMode", static_cast<int>(SynchMode), static_cast<int>(SynchMode)));
SettingsWrapEntry(SpeakerConfiguration);
}
}
const char* const tbl_GamefixNames[] =
{
"FpuMul",
@ -591,6 +624,10 @@ void Pcsx2Config::LoadSave(SettingsWrapper& wrap)
Speedhacks.LoadSave(wrap);
Cpu.LoadSave(wrap);
GS.LoadSave(wrap);
#ifdef PCSX2_CORE
// SPU2 is in a separate ini in wx.
SPU2.LoadSave(wrap);
#endif
Gamefixes.LoadSave(wrap);
Profiler.LoadSave(wrap);