mirror of
https://github.com/starr-dusT/yuzu-mainline
synced 2024-03-05 21:12:25 -08:00
Add a "Mute Audio" hotkey
This commit is contained in:
parent
d11baf8bf8
commit
3eb8efc095
@ -67,7 +67,7 @@ s64 Stream::GetBufferReleaseCycles(const Buffer& buffer) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void VolumeAdjustSamples(std::vector<s16>& samples, float game_volume) {
|
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) {
|
if (volume == 1.0f) {
|
||||||
return;
|
return;
|
||||||
|
@ -127,6 +127,13 @@ void LogSettings() {
|
|||||||
LogSetting("Services_BCATBoxcatLocal", Settings::values.bcat_boxcat_local);
|
LogSetting("Services_BCATBoxcatLocal", Settings::values.bcat_boxcat_local);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float Volume() {
|
||||||
|
if (values.audio_muted) {
|
||||||
|
return 0.0f;
|
||||||
|
}
|
||||||
|
return values.volume;
|
||||||
|
}
|
||||||
|
|
||||||
bool IsGPULevelExtreme() {
|
bool IsGPULevelExtreme() {
|
||||||
return values.gpu_accuracy == GPUAccuracy::Extreme;
|
return values.gpu_accuracy == GPUAccuracy::Extreme;
|
||||||
}
|
}
|
||||||
|
@ -459,6 +459,7 @@ struct Values {
|
|||||||
bool use_dev_keys;
|
bool use_dev_keys;
|
||||||
|
|
||||||
// Audio
|
// Audio
|
||||||
|
bool audio_muted;
|
||||||
std::string sink_id;
|
std::string sink_id;
|
||||||
bool enable_audio_stretching;
|
bool enable_audio_stretching;
|
||||||
std::string audio_device_id;
|
std::string audio_device_id;
|
||||||
@ -490,6 +491,8 @@ struct Values {
|
|||||||
std::map<u64, std::vector<std::string>> disabled_addons;
|
std::map<u64, std::vector<std::string>> disabled_addons;
|
||||||
} extern values;
|
} extern values;
|
||||||
|
|
||||||
|
float Volume();
|
||||||
|
|
||||||
bool IsGPULevelExtreme();
|
bool IsGPULevelExtreme();
|
||||||
bool IsGPULevelHigh();
|
bool IsGPULevelHigh();
|
||||||
|
|
||||||
|
@ -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
|
// 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.
|
// UISetting::values.shortcuts, which is alphabetically ordered.
|
||||||
// clang-format off
|
// 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("Capture Screenshot"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+P"), Qt::ApplicationShortcut}},
|
||||||
{QStringLiteral("Change Docked Mode"), QStringLiteral("Main Window"), {QStringLiteral("F10"), Qt::ApplicationShortcut}},
|
{QStringLiteral("Change Docked Mode"), QStringLiteral("Main Window"), {QStringLiteral("F10"), Qt::ApplicationShortcut}},
|
||||||
{QStringLiteral("Continue/Pause Emulation"), QStringLiteral("Main Window"), {QStringLiteral("F4"), Qt::WindowShortcut}},
|
{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("Increase Speed Limit"), QStringLiteral("Main Window"), {QStringLiteral("+"), Qt::ApplicationShortcut}},
|
||||||
{QStringLiteral("Load Amiibo"), QStringLiteral("Main Window"), {QStringLiteral("F2"), Qt::ApplicationShortcut}},
|
{QStringLiteral("Load Amiibo"), QStringLiteral("Main Window"), {QStringLiteral("F2"), Qt::ApplicationShortcut}},
|
||||||
{QStringLiteral("Load File"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+O"), Qt::WindowShortcut}},
|
{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("Restart Emulation"), QStringLiteral("Main Window"), {QStringLiteral("F6"), Qt::WindowShortcut}},
|
||||||
{QStringLiteral("Stop Emulation"), QStringLiteral("Main Window"), {QStringLiteral("F5"), Qt::WindowShortcut}},
|
{QStringLiteral("Stop Emulation"), QStringLiteral("Main Window"), {QStringLiteral("F5"), Qt::WindowShortcut}},
|
||||||
{QStringLiteral("Toggle Filter Bar"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+F"), Qt::WindowShortcut}},
|
{QStringLiteral("Toggle Filter Bar"), QStringLiteral("Main Window"), {QStringLiteral("Ctrl+F"), Qt::WindowShortcut}},
|
||||||
|
@ -27,7 +27,7 @@ public:
|
|||||||
default_mouse_buttons;
|
default_mouse_buttons;
|
||||||
static const std::array<int, Settings::NativeKeyboard::NumKeyboardKeys> default_keyboard_keys;
|
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<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:
|
private:
|
||||||
void ReadValues();
|
void ReadValues();
|
||||||
|
@ -736,6 +736,9 @@ void GMainWindow::InitializeHotkeys() {
|
|||||||
Settings::values.use_docked_mode);
|
Settings::values.use_docked_mode);
|
||||||
dock_status_button->setChecked(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() {
|
void GMainWindow::SetDefaultUIGeometry() {
|
||||||
|
Loading…
Reference in New Issue
Block a user