diff --git a/pcsx2/Config.h b/pcsx2/Config.h index fc0250b8d9..89e2de70c3 100644 --- a/pcsx2/Config.h +++ b/pcsx2/Config.h @@ -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; diff --git a/pcsx2/Pcsx2Config.cpp b/pcsx2/Pcsx2Config.cpp index e9ab9704c7..b11ae4d071 100644 --- a/pcsx2/Pcsx2Config.cpp +++ b/pcsx2/Pcsx2Config.cpp @@ -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(wrap.EntryBitfield(CURRENT_SETTINGS_SECTION, "Interpolation", static_cast(Interpolation), static_cast(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(wrap.EntryBitfield(CURRENT_SETTINGS_SECTION, "SynchMode", static_cast(SynchMode), static_cast(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);