mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-10 22:28:03 -05:00
yuzu: Mute audio when in background
This commit is contained in:
@ -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() {
|
||||
|
Reference in New Issue
Block a user