diff --git a/src/core/host_interface.cpp b/src/core/host_interface.cpp
index 3f229c00f..5464ff9c9 100644
--- a/src/core/host_interface.cpp
+++ b/src/core/host_interface.cpp
@@ -543,6 +543,7 @@ void HostInterface::SetDefaultSettings(SettingsInterface& si)
si.SetIntValue("Audio", "OutputVolume", 100);
si.SetIntValue("Audio", "FastForwardVolume", 100);
si.SetIntValue("Audio", "BufferSize", DEFAULT_AUDIO_BUFFER_SIZE);
+ si.SetBoolValue("Audio", "Resampling", false);
si.SetIntValue("Audio", "OutputMuted", false);
si.SetBoolValue("Audio", "Sync", true);
si.SetBoolValue("Audio", "DumpOnBoot", false);
diff --git a/src/core/settings.cpp b/src/core/settings.cpp
index ea637ffcc..8d3a288fe 100644
--- a/src/core/settings.cpp
+++ b/src/core/settings.cpp
@@ -206,6 +206,7 @@ void Settings::Load(SettingsInterface& si)
audio_output_volume = si.GetIntValue("Audio", "OutputVolume", 100);
audio_fast_forward_volume = si.GetIntValue("Audio", "FastForwardVolume", 100);
audio_buffer_size = si.GetIntValue("Audio", "BufferSize", HostInterface::DEFAULT_AUDIO_BUFFER_SIZE);
+ audio_resampling = si.GetBoolValue("Audio", "Resampling", false);
audio_output_muted = si.GetBoolValue("Audio", "OutputMuted", false);
audio_sync_enabled = si.GetBoolValue("Audio", "Sync", true);
audio_dump_on_boot = si.GetBoolValue("Audio", "DumpOnBoot", false);
@@ -357,6 +358,7 @@ void Settings::Save(SettingsInterface& si) const
si.SetIntValue("Audio", "OutputVolume", audio_output_volume);
si.SetIntValue("Audio", "FastForwardVolume", audio_fast_forward_volume);
si.SetIntValue("Audio", "BufferSize", audio_buffer_size);
+ si.SetBoolValue("Audio", "Resampling", audio_resampling);
si.SetBoolValue("Audio", "OutputMuted", audio_output_muted);
si.SetBoolValue("Audio", "Sync", audio_sync_enabled);
si.SetBoolValue("Audio", "DumpOnBoot", audio_dump_on_boot);
diff --git a/src/core/settings.h b/src/core/settings.h
index c188deed8..196bed78a 100644
--- a/src/core/settings.h
+++ b/src/core/settings.h
@@ -146,6 +146,7 @@ struct Settings
s32 audio_output_volume = 100;
s32 audio_fast_forward_volume = 100;
u32 audio_buffer_size = 2048;
+ bool audio_resampling = false;
bool audio_output_muted = false;
bool audio_sync_enabled = true;
bool audio_dump_on_boot = true;
diff --git a/src/duckstation-qt/audiosettingswidget.cpp b/src/duckstation-qt/audiosettingswidget.cpp
index 819ea2f50..28b528d24 100644
--- a/src/duckstation-qt/audiosettingswidget.cpp
+++ b/src/duckstation-qt/audiosettingswidget.cpp
@@ -24,6 +24,7 @@ AudioSettingsWidget::AudioSettingsWidget(QtHostInterface* host_interface, QWidge
SettingWidgetBinder::BindWidgetToIntSetting(m_host_interface, m_ui.bufferSize, "Audio", "BufferSize");
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.startDumpingOnBoot, "Audio", "DumpOnBoot");
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.muteCDAudio, "CDROM", "MuteCDAudio");
+ SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.resampling, "Audio", "Resampling", false);
m_ui.volume->setValue(m_host_interface->GetIntSettingValue("Audio", "OutputVolume", 100));
m_ui.fastForwardVolume->setValue(m_host_interface->GetIntSettingValue("Audio", "FastForwardVolume", 100));
diff --git a/src/duckstation-qt/audiosettingswidget.ui b/src/duckstation-qt/audiosettingswidget.ui
index e83d034e7..bdc7608ee 100644
--- a/src/duckstation-qt/audiosettingswidget.ui
+++ b/src/duckstation-qt/audiosettingswidget.ui
@@ -105,6 +105,13 @@
-
+
+
+ Resampling
+
+
+
+ -
Start Dumping On Boot
diff --git a/src/frontend-common/common_host_interface.cpp b/src/frontend-common/common_host_interface.cpp
index 8d28a7a01..0cee32314 100644
--- a/src/frontend-common/common_host_interface.cpp
+++ b/src/frontend-common/common_host_interface.cpp
@@ -619,6 +619,10 @@ void CommonHostInterface::UpdateSpeedLimiterState()
if (m_audio_stream)
{
+ const u32 input_sample_rate = (!is_non_standard_speed || target_speed == 0.0f || !g_settings.audio_resampling) ?
+ AUDIO_SAMPLE_RATE :
+ static_cast(static_cast(AUDIO_SAMPLE_RATE) * target_speed);
+ m_audio_stream->SetInputSampleRate(input_sample_rate);
m_audio_stream->SetOutputVolume(GetAudioOutputVolume());
m_audio_stream->SetSync(audio_sync_enabled);
if (audio_sync_enabled)
@@ -1495,9 +1499,9 @@ void CommonHostInterface::RegisterGeneralHotkeys()
#else
RegisterHotkey(StaticString(TRANSLATABLE("Hotkeys", "General")), StaticString("TogglePatchCodes"),
StaticString(TRANSLATABLE("Hotkeys", "Toggle Patch Codes")), [this](bool pressed) {
- if (pressed)
- DoToggleCheats();
- });
+ if (pressed)
+ DoToggleCheats();
+ });
#endif
RegisterHotkey(StaticString(TRANSLATABLE("Hotkeys", "General")), StaticString("Reset"),
@@ -2190,7 +2194,8 @@ void CommonHostInterface::CheckForSettingsChanges(const Settings& old_settings)
g_settings.increase_timer_resolution != old_settings.increase_timer_resolution ||
g_settings.emulation_speed != old_settings.emulation_speed ||
g_settings.fast_forward_speed != old_settings.fast_forward_speed ||
- g_settings.display_max_fps != old_settings.display_max_fps)
+ g_settings.display_max_fps != old_settings.display_max_fps ||
+ g_settings.audio_resampling != old_settings.audio_resampling)
{
UpdateSpeedLimiterState();
}