PowerSaver: close audio during PS when possible

If SDL audio device is paused, deinit audio when PS mode kicks in
so that full power savings can be achieved.
This commit is contained in:
Conn O'Griofa 2017-09-14 02:33:21 +01:00
parent c08c24e615
commit 1bfcfb1f16

View file

@ -1,4 +1,5 @@
#include "PowerSaver.h"
#include "AudioManager.h"
#include "Settings.h"
#include <string.h>
@ -17,6 +18,9 @@ void PowerSaver::init()
int PowerSaver::getTimeout()
{
if (SDL_GetAudioStatus() == SDL_AUDIO_PAUSED)
AudioManager::getInstance()->deinit();
// Used only for SDL_WaitEventTimeout. Use `getMode()` for modes.
return mRunningScreenSaver ? mWakeupTimeout : mScreenSaverTimeout;
}