summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2020-06-27 08:47:13 +0200
committerGitHub <noreply@github.com>2020-06-27 08:47:13 +0200
commit9eaccac6744ab3f48d9f11c677616f0f40c03209 (patch)
tree81e078cdb01c58652055573829572e988491fe28 /src
parentMerge pull request #4158 from Morph1984/caps (diff)
parentAdd a "Mute Audio" hotkey (diff)
downloadyuzu-9eaccac6744ab3f48d9f11c677616f0f40c03209.tar
yuzu-9eaccac6744ab3f48d9f11c677616f0f40c03209.tar.gz
yuzu-9eaccac6744ab3f48d9f11c677616f0f40c03209.tar.bz2
yuzu-9eaccac6744ab3f48d9f11c677616f0f40c03209.tar.lz
yuzu-9eaccac6744ab3f48d9f11c677616f0f40c03209.tar.xz
yuzu-9eaccac6744ab3f48d9f11c677616f0f40c03209.tar.zst
yuzu-9eaccac6744ab3f48d9f11c677616f0f40c03209.zip
Diffstat (limited to 'src')
-rw-r--r--src/audio_core/stream.cpp2
-rw-r--r--src/core/settings.cpp7
-rw-r--r--src/core/settings.h3
-rw-r--r--src/yuzu/configuration/config.cpp3
-rw-r--r--src/yuzu/configuration/config.h2
-rw-r--r--src/yuzu/main.cpp3
6 files changed, 17 insertions, 3 deletions
diff --git a/src/audio_core/stream.cpp b/src/audio_core/stream.cpp
index 4ca98f8ea..ca7cfb030 100644
--- a/src/audio_core/stream.cpp
+++ b/src/audio_core/stream.cpp
@@ -67,7 +67,7 @@ s64 Stream::GetBufferReleaseCycles(const Buffer& buffer) const {
}
static void VolumeAdjustSamples(std::vector<s16>& samples, float game_volume) {
- const float volume{std::clamp(Settings::values.volume - (1.0f - game_volume), 0.0f, 1.0f)};
+ const float volume{std::clamp(Settings::Volume() - (1.0f - game_volume), 0.0f, 1.0f)};
if (volume == 1.0f) {
return;
diff --git a/src/core/settings.cpp b/src/core/settings.cpp
index 4edff9cd8..56df5e925 100644
--- a/src/core/settings.cpp
+++ b/src/core/settings.cpp
@@ -127,6 +127,13 @@ void LogSettings() {
LogSetting("Services_BCATBoxcatLocal", Settings::values.bcat_boxcat_local);
}
+float Volume() {
+ if (values.audio_muted) {
+ return 0.0f;
+ }
+ return values.volume;
+}
+
bool IsGPULevelExtreme() {
return values.gpu_accuracy == GPUAccuracy::Extreme;
}
diff --git a/src/core/settings.h b/src/core/settings.h
index 33e1e06cd..a598ccbc1 100644
--- a/src/core/settings.h
+++ b/src/core/settings.h
@@ -459,6 +459,7 @@ struct Values {
bool use_dev_keys;
// Audio
+ bool audio_muted;
std::string sink_id;
bool enable_audio_stretching;
std::string audio_device_id;
@@ -490,6 +491,8 @@ struct Values {
std::map<u64, std::vector<std::string>> disabled_addons;
} extern values;
+float Volume();
+
bool IsGPULevelExtreme();
bool IsGPULevelHigh();
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index 32c81dc70..bbbd96113 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -211,7 +211,7 @@ const std::array<int, Settings::NativeKeyboard::NumKeyboardMods> Config::default
// This must be in alphabetical order according to action name as it must have the same order as
// UISetting::values.shortcuts, which is alphabetically ordered.
// clang-format off
-const std::array<UISettings::Shortcut, 15> Config::default_hotkeys{{
+const std::array<UISettings::Shortcut, 16> Config::default_hotkeys{{
{QStringLiteral("Capture Screenshot"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+P"), Qt::ApplicationShortcut}},
{QStringLiteral("Change Docked Mode"), QStringLiteral("Main Window"), {QStringLiteral("F10"), Qt::ApplicationShortcut}},
{QStringLiteral("Continue/Pause Emulation"), QStringLiteral("Main Window"), {QStringLiteral("F4"), Qt::WindowShortcut}},
@@ -222,6 +222,7 @@ const std::array<UISettings::Shortcut, 15> Config::default_hotkeys{{
{QStringLiteral("Increase Speed Limit"), QStringLiteral("Main Window"), {QStringLiteral("+"), Qt::ApplicationShortcut}},
{QStringLiteral("Load Amiibo"), QStringLiteral("Main Window"), {QStringLiteral("F2"), Qt::ApplicationShortcut}},
{QStringLiteral("Load File"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+O"), Qt::WindowShortcut}},
+ {QStringLiteral("Mute Audio"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+M"), Qt::WindowShortcut}},
{QStringLiteral("Restart Emulation"), QStringLiteral("Main Window"), {QStringLiteral("F6"), Qt::WindowShortcut}},
{QStringLiteral("Stop Emulation"), QStringLiteral("Main Window"), {QStringLiteral("F5"), Qt::WindowShortcut}},
{QStringLiteral("Toggle Filter Bar"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+F"), Qt::WindowShortcut}},
diff --git a/src/yuzu/configuration/config.h b/src/yuzu/configuration/config.h
index 5cd2a5feb..09316382c 100644
--- a/src/yuzu/configuration/config.h
+++ b/src/yuzu/configuration/config.h
@@ -27,7 +27,7 @@ public:
default_mouse_buttons;
static const std::array<int, Settings::NativeKeyboard::NumKeyboardKeys> default_keyboard_keys;
static const std::array<int, Settings::NativeKeyboard::NumKeyboardMods> default_keyboard_mods;
- static const std::array<UISettings::Shortcut, 15> default_hotkeys;
+ static const std::array<UISettings::Shortcut, 16> default_hotkeys;
private:
void ReadValues();
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 4dedb2549..ba69139e5 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -737,6 +737,9 @@ void GMainWindow::InitializeHotkeys() {
Settings::values.use_docked_mode);
dock_status_button->setChecked(Settings::values.use_docked_mode);
});
+ connect(hotkey_registry.GetHotkey(main_window, QStringLiteral("Mute Audio"), this),
+ &QShortcut::activated, this,
+ [] { Settings::values.audio_muted = !Settings::values.audio_muted; });
}
void GMainWindow::SetDefaultUIGeometry() {