mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-11 08:34:34 +02:00
Add some variables in preparation for eventual per-source weighting
This commit is contained in:
@@ -48,6 +48,8 @@ using namespace Tomahawk;
|
|||||||
|
|
||||||
#define AUDIO_VOLUME_STEP 5
|
#define AUDIO_VOLUME_STEP 5
|
||||||
|
|
||||||
|
static const uint_fast8_t UNDERRUNTHRESHOLD = 2;
|
||||||
|
|
||||||
static QString s_aeInfoIdentifier = QString( "AUDIOENGINE" );
|
static QString s_aeInfoIdentifier = QString( "AUDIOENGINE" );
|
||||||
|
|
||||||
AudioEngine* AudioEngine::s_instance = 0;
|
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.
|
// We don't emit this state to listeners - yet.
|
||||||
m_state = Loading;
|
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 )
|
if ( newState == Phonon::ErrorState )
|
||||||
{
|
{
|
||||||
stop( UnknownError );
|
stop( UnknownError );
|
||||||
@@ -763,7 +775,11 @@ AudioEngine::onStateChanged( Phonon::State newState, Phonon::State oldState )
|
|||||||
if ( newState == Phonon::PlayingState )
|
if ( newState == Phonon::PlayingState )
|
||||||
{
|
{
|
||||||
if ( state() != Paused && state() != Playing )
|
if ( state() != Paused && state() != Playing )
|
||||||
|
{
|
||||||
|
m_underrunCount = 0;
|
||||||
|
m_underrunNotified = false;
|
||||||
emit started( m_currentTrack );
|
emit started( m_currentTrack );
|
||||||
|
}
|
||||||
|
|
||||||
setState( Playing );
|
setState( Playing );
|
||||||
}
|
}
|
||||||
|
@@ -173,6 +173,9 @@ private:
|
|||||||
QQueue< AudioState > m_stateQueue;
|
QQueue< AudioState > m_stateQueue;
|
||||||
QTimer m_stateQueueTimer;
|
QTimer m_stateQueueTimer;
|
||||||
|
|
||||||
|
uint_fast8_t m_underrunCount;
|
||||||
|
bool m_underrunNotified;
|
||||||
|
|
||||||
static AudioEngine* s_instance;
|
static AudioEngine* s_instance;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user