Settings: Add audio resampling when running at non-standard speed
This commit is contained in:
parent
54c7fc6b08
commit
a5f9aa11e1
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -105,6 +105,13 @@
|
|||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="resampling">
|
||||
<property name="text">
|
||||
<string>Resampling</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="startDumpingOnBoot">
|
||||
<property name="text">
|
||||
<string>Start Dumping On Boot</string>
|
||||
|
|
|
@ -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<u32>(static_cast<float>(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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue