bool CSoftAE::IsSuspended()
{
+#if defined(TARGET_WINDOWS)
return m_isSuspended;
+#else
+ return false;
+#endif
}
float CSoftAE::GetVolume()
bool CSoftAE::Suspend()
{
CLog::Log(LOGDEBUG, "CSoftAE::Suspend - Suspending AE processing");
+#if defined(TARGET_WINDOWS)
m_isSuspended = true;
-
CSingleLock streamLock(m_streamLock);
for (StreamList::iterator itt = m_playingStreams.begin(); itt != m_playingStreams.end(); ++itt)
CSoftAEStream *stream = *itt;
stream->Flush();
}
+#endif
return true;
}
bool CSoftAE::Resume()
{
CLog::Log(LOGDEBUG, "CSoftAE::Resume - Resuming AE processing");
+#if defined(TARGET_WINDOWS)
m_isSuspended = false;
m_reOpen = true;
+#endif
return true;
}
restart = true;
}
-#if !defined(TARGET_ANDROID)
+#if defined(TARGET_WINDOWS)
/* Handle idle or forced suspend */
ProcessSuspend();
#endif
InternalOpenSink();
m_isSuspended = false; // exit Suspend state
}
+#if defined(TARGET_ANDROID)
+ else if (m_playingStreams.empty()
+ && m_playing_sounds.empty()
+ && !g_advancedSettings.m_streamSilence)
+ {
+ // if we have nothing to do, take a dirt nap.
+ // we do not have to take a lock just to check empty.
+ // this keeps AE from sucking CPU if nothing is going on.
+ m_wake.WaitMSec(SOFTAE_IDLE_WAIT_MSEC);
+ }
+#endif
}
}
inline void CSoftAE::ProcessSuspend()
{
bool sinkIsSuspended = false;
+ unsigned int curSystemClock = 0;
- if (m_playingStreams.empty() && m_playing_sounds.empty() &&
- !m_softSuspend && !g_advancedSettings.m_streamSilence)
+ if (!m_softSuspend && m_playingStreams.empty() && m_playing_sounds.empty() &&
+ !g_advancedSettings.m_streamSilence)
{
m_softSuspend = true;
m_softSuspendTimer = XbmcThreads::SystemClockMillis() + 10000; //10.0 second delay for softSuspend
+ Sleep(10);
}
- unsigned int curSystemClock = XbmcThreads::SystemClockMillis();
+ if (m_softSuspend)
+ curSystemClock = XbmcThreads::SystemClockMillis();
/* idle while in Suspend() state until Resume() called */
/* idle if nothing to play and user hasn't enabled */
#include "system.h"
#include "PowerManager.h"
#include "Application.h"
+#include "cores/AudioEngine/AEFactory.h"
#include "input/KeyboardStat.h"
#include "settings/GUISettings.h"
#include "windowing/WindowingFactory.h"
g_application.StopPlaying();
g_application.StopShutdownTimer();
g_application.StopScreenSaverTimer();
+ CAEFactory::Suspend();
}
void CPowerManager::OnWake()
g_lcd->Initialize();
#endif
+ CAEFactory::Resume();
g_application.UpdateLibraries();
g_weatherManager.Refresh();