AudioSettingsWidget: Disambiguate overloaded volume name
Some checks failed
🐧 Linux Builds / AppImage (push) Waiting to run
🐧 Linux Builds / Flatpak (push) Waiting to run
🍎 MacOS Builds / Defaults (push) Waiting to run
🖥️ Windows Builds / Lint VS Project Files (push) Waiting to run
🖥️ Windows Builds / SSE4 (push) Blocked by required conditions
🖥️ Windows Builds / AVX2 (push) Blocked by required conditions
🖥️ Windows Builds / CMake (push) Waiting to run
🏭 Update Controller Database / update-controller-db (push) Has been cancelled

This commit is contained in:
TheTechnician27 2025-10-12 04:58:34 -05:00 committed by TellowKrinkle
parent 38cfa9912d
commit ae6e4c98f6
7 changed files with 46 additions and 46 deletions

View File

@ -73,21 +73,21 @@ AudioSettingsWidget::AudioSettingsWidget(SettingsWindow* settings_dialog, QWidge
// for per-game, just use the normal path, since it needs to re-read/apply
if (!dialog()->isPerGameSettings())
{
m_ui.volume->setValue(dialog()->getEffectiveIntValue("SPU2/Output", "OutputVolume", 100));
m_ui.standardVolume->setValue(dialog()->getEffectiveIntValue("SPU2/Output", "StandardVolume", 100));
m_ui.fastForwardVolume->setValue(dialog()->getEffectiveIntValue("SPU2/Output", "FastForwardVolume", 100));
m_ui.muted->setChecked(dialog()->getEffectiveBoolValue("SPU2/Output", "OutputMuted", false));
connect(m_ui.volume, &QSlider::valueChanged, this, &AudioSettingsWidget::onOutputVolumeChanged);
connect(m_ui.standardVolume, &QSlider::valueChanged, this, &AudioSettingsWidget::onStandardVolumeChanged);
connect(m_ui.fastForwardVolume, &QSlider::valueChanged, this, &AudioSettingsWidget::onFastForwardVolumeChanged);
connect(m_ui.muted, &QCheckBox::checkStateChanged, this, &AudioSettingsWidget::onOutputMutedChanged);
updateVolumeLabel();
}
else
{
SettingWidgetBinder::BindWidgetAndLabelToIntSetting(sif, m_ui.volume, m_ui.volumeLabel, tr("%"), "SPU2/Output", "OutputVolume", 100);
SettingWidgetBinder::BindWidgetAndLabelToIntSetting(sif, m_ui.standardVolume, m_ui.standardVolumeLabel, tr("%"), "SPU2/Output", "StandardVolume", 100);
SettingWidgetBinder::BindWidgetAndLabelToIntSetting(sif, m_ui.fastForwardVolume, m_ui.fastForwardVolumeLabel, tr("%"), "SPU2/Output", "FastForwardVolume", 100);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.muted, "SPU2/Output", "OutputMuted", false);
}
connect(m_ui.resetVolume, &QToolButton::clicked, this, [this]() { resetVolume(false); });
connect(m_ui.resetStandardVolume, &QToolButton::clicked, this, [this]() { resetVolume(false); });
connect(m_ui.resetFastForwardVolume, &QToolButton::clicked, this, [this]() { resetVolume(true); });
dialog()->registerWidgetHelp(
@ -103,8 +103,8 @@ AudioSettingsWidget::AudioSettingsWidget(SettingsWindow* settings_dialog, QWidge
m_ui.outputLatencyMS, tr("Output Latency"), tr("%1 ms").arg(AudioStreamParameters::DEFAULT_OUTPUT_LATENCY_MS),
tr("Determines the latency from the buffer to the host audio output. This can be set lower than the target latency "
"to reduce audio delay."));
dialog()->registerWidgetHelp(m_ui.volume, tr("Output Volume"), "100%",
tr("Controls the volume of the audio played on the host."));
dialog()->registerWidgetHelp(m_ui.standardVolume, tr("Standard Volume"), "100%",
tr("Controls the volume of the audio played on the host at normal speed."));
dialog()->registerWidgetHelp(m_ui.fastForwardVolume, tr("Fast Forward Volume"), "100%",
tr("Controls the volume of the audio played on the host when fast forwarding."));
dialog()->registerWidgetHelp(m_ui.muted, tr("Mute All Sound"), tr("Unchecked"),
@ -118,9 +118,9 @@ AudioSettingsWidget::AudioSettingsWidget(SettingsWindow* settings_dialog, QWidge
tr("When running outside of 100% speed, adjusts the tempo on audio instead of dropping frames. Produces much nicer fast-forward/slowdown audio."));
dialog()->registerWidgetHelp(m_ui.stretchSettings, tr("Stretch Settings"), tr("N/A"),
tr("These settings fine-tune the behavior of the SoundTouch audio time stretcher when running outside of 100% speed."));
dialog()->registerWidgetHelp(m_ui.resetVolume, tr("Reset Volume"), tr("N/A"),
dialog()->isPerGameSettings() ? tr("Resets output volume back to the global/inherited setting.") :
tr("Resets output volume back to the default."));
dialog()->registerWidgetHelp(m_ui.resetStandardVolume, tr("Reset Standard Volume"), tr("N/A"),
dialog()->isPerGameSettings() ? tr("Resets standard volume back to the global/inherited setting.") :
tr("Resets standard volume back to the default."));
dialog()->registerWidgetHelp(m_ui.resetFastForwardVolume, tr("Reset Fast Forward Volume"), tr("N/A"),
dialog()->isPerGameSettings() ? tr("Resets fast forward volume back to the global/inherited setting.") :
tr("Resets fast forward volume back to the default."));
@ -292,7 +292,7 @@ void AudioSettingsWidget::updateLatencyLabel()
void AudioSettingsWidget::updateVolumeLabel()
{
m_ui.volumeLabel->setText(tr("%1%").arg(m_ui.volume->value()));
m_ui.standardVolumeLabel->setText(tr("%1%").arg(m_ui.standardVolume->value()));
m_ui.fastForwardVolumeLabel->setText(tr("%1%").arg(m_ui.fastForwardVolume->value()));
}
@ -303,18 +303,18 @@ void AudioSettingsWidget::onMinimalOutputLatencyChanged()
updateLatencyLabel();
}
void AudioSettingsWidget::onOutputVolumeChanged(int new_value)
void AudioSettingsWidget::onStandardVolumeChanged(const int new_value)
{
// only called for base settings
pxAssert(!dialog()->isPerGameSettings());
Host::SetBaseIntSettingValue("SPU2/Output", "OutputVolume", new_value);
Host::SetBaseIntSettingValue("SPU2/Output", "StandardVolume", new_value);
Host::CommitBaseSettingChanges();
g_emu_thread->applySettings();
updateVolumeLabel();
}
void AudioSettingsWidget::onFastForwardVolumeChanged(int new_value)
void AudioSettingsWidget::onFastForwardVolumeChanged(const int new_value)
{
// only called for base settings
pxAssert(!dialog()->isPerGameSettings());
@ -325,7 +325,7 @@ void AudioSettingsWidget::onFastForwardVolumeChanged(int new_value)
updateVolumeLabel();
}
void AudioSettingsWidget::onOutputMutedChanged(int new_state)
void AudioSettingsWidget::onOutputMutedChanged(const int new_state)
{
// only called for base settings
pxAssert(!dialog()->isPerGameSettings());
@ -478,11 +478,11 @@ void AudioSettingsWidget::onStretchSettingsClicked()
dlg.exec();
}
void AudioSettingsWidget::resetVolume(bool fast_forward)
void AudioSettingsWidget::resetVolume(const bool fast_forward)
{
const char* key = fast_forward ? "FastForwardVolume" : "OutputVolume";
QSlider* const slider = fast_forward ? m_ui.fastForwardVolume : m_ui.volume;
QLabel* const label = fast_forward ? m_ui.fastForwardVolumeLabel : m_ui.volumeLabel;
const char* key = fast_forward ? "FastForwardVolume" : "StandardVolume";
QSlider* const slider = fast_forward ? m_ui.fastForwardVolume : m_ui.standardVolume;
QLabel* const label = fast_forward ? m_ui.fastForwardVolumeLabel : m_ui.standardVolumeLabel;
if (dialog()->isPerGameSettings())
{

View File

@ -27,9 +27,9 @@ private Q_SLOTS:
void updateLatencyLabel();
void updateVolumeLabel();
void onMinimalOutputLatencyChanged();
void onOutputVolumeChanged(int new_value);
void onFastForwardVolumeChanged(int new_value);
void onOutputMutedChanged(int new_state);
void onStandardVolumeChanged(const int new_value);
void onFastForwardVolumeChanged(const int new_value);
void onOutputMutedChanged(const int new_state);
void onExpansionSettingsClicked();
void onStretchSettingsClicked();
@ -38,7 +38,7 @@ private:
AudioBackend getEffectiveBackend() const;
AudioExpansionMode getEffectiveExpansionMode() const;
u32 getEffectiveExpansionBlockSize() const;
void resetVolume(bool fast_forward);
void resetVolume(const bool fast_forward);
Ui::AudioSettingsWidget m_ui;
u32 m_output_device_latency = 0;

View File

@ -219,14 +219,14 @@
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Output Volume:</string>
<string>Standard Volume:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QSlider" name="volume">
<widget class="QSlider" name="standardVolume">
<property name="maximum">
<number>200</number>
</property>
@ -245,7 +245,7 @@
</widget>
</item>
<item>
<widget class="QLabel" name="volumeLabel">
<widget class="QLabel" name="standardVolumeLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
@ -261,9 +261,9 @@
</widget>
</item>
<item>
<widget class="QToolButton" name="resetVolume">
<widget class="QToolButton" name="resetStandardVolume">
<property name="toolTip">
<string>Reset Volume</string>
<string>Reset Standard Volume</string>
</property>
<property name="icon">
<iconset theme="restart-line"/>

View File

@ -942,7 +942,7 @@ struct Pcsx2Config
VisualDebugEnabled : 1;
BITFIELD_END
u32 OutputVolume = 100;
u32 StandardVolume = 100;
u32 FastForwardVolume = 100;
bool OutputMuted = false;

View File

@ -4511,8 +4511,8 @@ void FullscreenUI::DrawAudioSettingsPage()
MenuHeading(FSUI_CSTR("Audio Control"));
DrawIntRangeSetting(bsi, FSUI_ICONSTR(ICON_FA_VOLUME_HIGH, "Output Volume"),
FSUI_CSTR("Controls the volume of the audio played on the host."), "SPU2/Output", "OutputVolume", 100,
DrawIntRangeSetting(bsi, FSUI_ICONSTR(ICON_FA_VOLUME_HIGH, "Standard Volume"),
FSUI_CSTR("Controls the volume of the audio played on the host at normal speed."), "SPU2/Output", "StandardVolume", 100,
0, 100, "%d%%");
DrawIntRangeSetting(bsi, FSUI_ICONSTR(ICON_FA_FORWARD_FAST, "Fast Forward Volume"),
FSUI_CSTR("Controls the volume of the audio played on the host when fast forwarding."), "SPU2/Output",
@ -8288,7 +8288,7 @@ TRANSLATE_NOOP("FullscreenUI", "Determines what frame rate NTSC games run at.");
TRANSLATE_NOOP("FullscreenUI", "PAL Frame Rate");
TRANSLATE_NOOP("FullscreenUI", "Determines what frame rate PAL games run at.");
TRANSLATE_NOOP("FullscreenUI", "Audio Control");
TRANSLATE_NOOP("FullscreenUI", "Controls the volume of the audio played on the host.");
TRANSLATE_NOOP("FullscreenUI", "Controls the volume of the audio played on the host at normal speed.");
TRANSLATE_NOOP("FullscreenUI", "Controls the volume of the audio played on the host when fast forwarding.");
TRANSLATE_NOOP("FullscreenUI", "Prevents the emulator from producing any audible sound.");
TRANSLATE_NOOP("FullscreenUI", "Backend Settings");
@ -8839,7 +8839,7 @@ TRANSLATE_NOOP("FullscreenUI", "Shade Boost Brightness");
TRANSLATE_NOOP("FullscreenUI", "Shade Boost Contrast");
TRANSLATE_NOOP("FullscreenUI", "Shade Boost Saturation");
TRANSLATE_NOOP("FullscreenUI", "TV Shaders");
TRANSLATE_NOOP("FullscreenUI", "Output Volume");
TRANSLATE_NOOP("FullscreenUI", "Standard Volume");
TRANSLATE_NOOP("FullscreenUI", "Fast Forward Volume");
TRANSLATE_NOOP("FullscreenUI", "Mute All Sound");
TRANSLATE_NOOP("FullscreenUI", "Audio Backend");

View File

@ -1228,7 +1228,7 @@ void Pcsx2Config::SPU2Options::LoadSave(SettingsWrapper& wrap)
{
SettingsWrapSection("SPU2/Output");
SettingsWrapEntry(OutputVolume);
SettingsWrapEntry(StandardVolume);
SettingsWrapEntry(FastForwardVolume);
SettingsWrapEntry(OutputMuted);
SettingsWrapParsedEnum(Backend, "Backend", &AudioStream::ParseBackendName, &AudioStream::GetBackendName);
@ -1247,7 +1247,7 @@ bool Pcsx2Config::SPU2Options::operator!=(const SPU2Options& right) const
bool Pcsx2Config::SPU2Options::operator==(const SPU2Options& right) const
{
return OpEqu(bitset) &&
OpEqu(OutputVolume) &&
OpEqu(StandardVolume) &&
OpEqu(FastForwardVolume) &&
OpEqu(OutputMuted) &&
OpEqu(Backend) &&

View File

@ -103,7 +103,7 @@ void SPU2::CreateOutputStream()
// Initialize volume and mute settings on new session.
if (!s_output_stream)
{
s_standard_volume = EmuConfig.SPU2.OutputVolume;
s_standard_volume = EmuConfig.SPU2.StandardVolume;
s_fast_forward_volume = EmuConfig.SPU2.FastForwardVolume;
s_output_muted = EmuConfig.SPU2.OutputMuted;
}
@ -318,20 +318,20 @@ bool SPU2::IsRunningPSXMode()
void SPU2::CheckForConfigChanges(const Pcsx2Config& old_config)
{
const Pcsx2Config::SPU2Options& opts = EmuConfig.SPU2;
const Pcsx2Config::SPU2Options& oldopts = old_config.SPU2;
const Pcsx2Config::SPU2Options& old_opts = old_config.SPU2;
// No need to reinit for volume change.
if (opts.OutputMuted != oldopts.OutputMuted)
if (opts.OutputMuted != old_opts.OutputMuted)
SPU2::SetOutputMuted(opts.OutputMuted);
bool volume_settings_changed = false;
if (opts.OutputVolume != oldopts.OutputVolume)
if (opts.StandardVolume != old_opts.StandardVolume)
{
s_standard_volume = opts.OutputVolume;
s_standard_volume = opts.StandardVolume;
volume_settings_changed = true;
}
if (opts.FastForwardVolume != oldopts.FastForwardVolume)
if (opts.FastForwardVolume != old_opts.FastForwardVolume)
{
s_fast_forward_volume = opts.FastForwardVolume;
volume_settings_changed = true;
@ -341,21 +341,21 @@ void SPU2::CheckForConfigChanges(const Pcsx2Config& old_config)
SPU2::UpdateOutputVolume();
// Things which require re-initialzing the output.
if (opts.Backend != oldopts.Backend ||
opts.StreamParameters != oldopts.StreamParameters ||
opts.DriverName != oldopts.DriverName ||
opts.DeviceName != oldopts.DeviceName)
if (opts.Backend != old_opts.Backend ||
opts.StreamParameters != old_opts.StreamParameters ||
opts.DriverName != old_opts.DriverName ||
opts.DeviceName != old_opts.DeviceName)
{
CreateOutputStream();
}
else if (opts.IsTimeStretchEnabled() != oldopts.IsTimeStretchEnabled())
else if (opts.IsTimeStretchEnabled() != old_opts.IsTimeStretchEnabled())
{
s_output_stream->SetStretchEnabled(opts.IsTimeStretchEnabled());
}
#ifdef PCSX2_DEVBUILD
// AccessLog controls file output.
if (opts.AccessLog != oldopts.AccessLog)
if (opts.AccessLog != old_opts.AccessLog)
{
if (AccessLog())
OpenFileLog();