1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-20 15:59:42 +01:00

Add some variables in preparation for eventual per-source weighting

This commit is contained in:
Jeff Mitchell 2013-02-21 10:32:44 -05:00
parent 221a038568
commit 4c300f298d
2 changed files with 19 additions and 0 deletions

View File

@ -48,6 +48,8 @@ using namespace Tomahawk;
#define AUDIO_VOLUME_STEP 5
static const uint_fast8_t UNDERRUNTHRESHOLD = 2;
static QString s_aeInfoIdentifier = QString( "AUDIOENGINE" );
AudioEngine* AudioEngine::s_instance = 0;
@ -751,6 +753,16 @@ AudioEngine::onStateChanged( Phonon::State newState, Phonon::State oldState )
// We don't emit this state to listeners - yet.
m_state = Loading;
}
if ( newState == Phonon::BufferingState )
{
if ( m_underrunCount > UNDERRUNTHRESHOLD && !m_underrunNotified )
{
m_underrunNotified = true;
//FIXME: Actually notify
}
else
m_underrunCount++;
}
if ( newState == Phonon::ErrorState )
{
stop( UnknownError );
@ -763,7 +775,11 @@ AudioEngine::onStateChanged( Phonon::State newState, Phonon::State oldState )
if ( newState == Phonon::PlayingState )
{
if ( state() != Paused && state() != Playing )
{
m_underrunCount = 0;
m_underrunNotified = false;
emit started( m_currentTrack );
}
setState( Playing );
}

View File

@ -173,6 +173,9 @@ private:
QQueue< AudioState > m_stateQueue;
QTimer m_stateQueueTimer;
uint_fast8_t m_underrunCount;
bool m_underrunNotified;
static AudioEngine* s_instance;
};