mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-25 21:06:58 -05:00
Merge pull request #8656 from german77/audio-step
yuzu: Add incremental steps to volume hotkeys
This commit is contained in:
commit
880006c5ca
1 changed files with 16 additions and 2 deletions
|
@ -1076,12 +1076,26 @@ void GMainWindow::InitializeHotkeys() {
|
||||||
[] { Settings::values.audio_muted = !Settings::values.audio_muted; });
|
[] { Settings::values.audio_muted = !Settings::values.audio_muted; });
|
||||||
connect_shortcut(QStringLiteral("Audio Volume Down"), [] {
|
connect_shortcut(QStringLiteral("Audio Volume Down"), [] {
|
||||||
const auto current_volume = static_cast<int>(Settings::values.volume.GetValue());
|
const auto current_volume = static_cast<int>(Settings::values.volume.GetValue());
|
||||||
const auto new_volume = std::max(current_volume - 5, 0);
|
int step = 5;
|
||||||
|
if (current_volume <= 30) {
|
||||||
|
step = 2;
|
||||||
|
}
|
||||||
|
if (current_volume <= 6) {
|
||||||
|
step = 1;
|
||||||
|
}
|
||||||
|
const auto new_volume = std::max(current_volume - step, 0);
|
||||||
Settings::values.volume.SetValue(static_cast<u8>(new_volume));
|
Settings::values.volume.SetValue(static_cast<u8>(new_volume));
|
||||||
});
|
});
|
||||||
connect_shortcut(QStringLiteral("Audio Volume Up"), [] {
|
connect_shortcut(QStringLiteral("Audio Volume Up"), [] {
|
||||||
const auto current_volume = static_cast<int>(Settings::values.volume.GetValue());
|
const auto current_volume = static_cast<int>(Settings::values.volume.GetValue());
|
||||||
const auto new_volume = std::min(current_volume + 5, 100);
|
int step = 5;
|
||||||
|
if (current_volume < 30) {
|
||||||
|
step = 2;
|
||||||
|
}
|
||||||
|
if (current_volume < 6) {
|
||||||
|
step = 1;
|
||||||
|
}
|
||||||
|
const auto new_volume = std::min(current_volume + step, 100);
|
||||||
Settings::values.volume.SetValue(static_cast<u8>(new_volume));
|
Settings::values.volume.SetValue(static_cast<u8>(new_volume));
|
||||||
});
|
});
|
||||||
connect_shortcut(QStringLiteral("Toggle Framerate Limit"), [] {
|
connect_shortcut(QStringLiteral("Toggle Framerate Limit"), [] {
|
||||||
|
|
Loading…
Reference in a new issue