2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Allow audio volume up to 200%

This commit is contained in:
Kelebek1 2022-08-12 16:57:29 +01:00
parent e8a59a6931
commit b25090d960
4 changed files with 7 additions and 9 deletions

View file

@ -105,7 +105,7 @@ float Volume() {
if (values.audio_muted) {
return 0.0f;
}
return values.volume.GetValue() / 100.0f;
return values.volume.GetValue() / static_cast<f32>(values.volume.GetDefault());
}
void UpdateRescalingInfo() {

View file

@ -374,7 +374,7 @@ struct Values {
Setting<std::string> audio_output_device_id{"auto", "output_device"};
Setting<std::string> audio_input_device_id{"auto", "input_device"};
Setting<bool> audio_muted{false, "audio_muted"};
SwitchableSetting<u8, true> volume{100, 0, 100, "volume"};
SwitchableSetting<u8, true> volume{100, 0, 200, "volume"};
Setting<bool> dump_audio_commands{false, "dump_audio_commands"};
// Core

View file

@ -73,7 +73,7 @@ const std::array<int, 2> Config::default_ringcon_analogs{{
const std::array<UISettings::Shortcut, 22> Config::default_hotkeys{{
{QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Audio Mute/Unmute")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+M"), QStringLiteral("Home+Dpad_Right"), Qt::WindowShortcut}},
{QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Audio Volume Down")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("-"), QStringLiteral("Home+Dpad_Down"), Qt::ApplicationShortcut}},
{QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Audio Volume Up")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("+"), QStringLiteral("Home+Dpad_Up"), Qt::ApplicationShortcut}},
{QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Audio Volume Up")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("="), QStringLiteral("Home+Dpad_Up"), Qt::ApplicationShortcut}},
{QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Capture Screenshot")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("Ctrl+P"), QStringLiteral("Screenshot"), Qt::WidgetWithChildrenShortcut}},
{QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Change Adapting Filter")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("F8"), QStringLiteral("Home+L"), Qt::ApplicationShortcut}},
{QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Change Docked Mode")), QStringLiteral(QT_TRANSLATE_NOOP("Hotkeys", "Main Window")), {QStringLiteral("F10"), QStringLiteral("Home+X"), Qt::ApplicationShortcut}},

View file

@ -1094,7 +1094,7 @@ void GMainWindow::InitializeHotkeys() {
connect_shortcut(QStringLiteral("Audio Mute/Unmute"),
[] { Settings::values.audio_muted = !Settings::values.audio_muted; });
connect_shortcut(QStringLiteral("Audio Volume Down"), [] {
const auto current_volume = static_cast<int>(Settings::values.volume.GetValue());
const auto current_volume = static_cast<s32>(Settings::values.volume.GetValue());
int step = 5;
if (current_volume <= 30) {
step = 2;
@ -1102,11 +1102,10 @@ void GMainWindow::InitializeHotkeys() {
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(std::max(current_volume - step, 0));
});
connect_shortcut(QStringLiteral("Audio Volume Up"), [] {
const auto current_volume = static_cast<int>(Settings::values.volume.GetValue());
const auto current_volume = static_cast<s32>(Settings::values.volume.GetValue());
int step = 5;
if (current_volume < 30) {
step = 2;
@ -1114,8 +1113,7 @@ void GMainWindow::InitializeHotkeys() {
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(current_volume + step);
});
connect_shortcut(QStringLiteral("Toggle Framerate Limit"), [] {
Settings::values.use_speed_limit.SetValue(!Settings::values.use_speed_limit.GetValue());