mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-22 18:35:45 +00:00
yuzu: Mute audio when in background
This commit is contained in:
parent
49eb78497b
commit
ab93b4c66d
6 changed files with 27 additions and 4 deletions
|
@ -1034,14 +1034,14 @@ void GMainWindow::RestoreUIState() {
|
|||
}
|
||||
|
||||
void GMainWindow::OnAppFocusStateChanged(Qt::ApplicationState state) {
|
||||
if (!UISettings::values.pause_when_in_background) {
|
||||
return;
|
||||
}
|
||||
if (state != Qt::ApplicationHidden && state != Qt::ApplicationInactive &&
|
||||
state != Qt::ApplicationActive) {
|
||||
LOG_DEBUG(Frontend, "ApplicationState unusual flag: {} ", state);
|
||||
}
|
||||
if (emulation_running) {
|
||||
if (!emulation_running) {
|
||||
return;
|
||||
}
|
||||
if (UISettings::values.pause_when_in_background) {
|
||||
if (emu_thread->IsRunning() &&
|
||||
(state & (Qt::ApplicationHidden | Qt::ApplicationInactive))) {
|
||||
auto_paused = true;
|
||||
|
@ -1051,6 +1051,16 @@ void GMainWindow::OnAppFocusStateChanged(Qt::ApplicationState state) {
|
|||
OnStartGame();
|
||||
}
|
||||
}
|
||||
if (UISettings::values.mute_when_in_background) {
|
||||
if (!Settings::values.audio_muted &&
|
||||
(state & (Qt::ApplicationHidden | Qt::ApplicationInactive))) {
|
||||
Settings::values.audio_muted = true;
|
||||
auto_muted = true;
|
||||
} else if (auto_muted && state == Qt::ApplicationActive) {
|
||||
Settings::values.audio_muted = false;
|
||||
auto_muted = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GMainWindow::ConnectWidgetEvents() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue