mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-01 20:00:13 +02:00
* Fixed automatic track progression.
This commit is contained in:
@@ -15,6 +15,7 @@ AudioEngine::AudioEngine()
|
|||||||
, m_currentTrackPlaylist( 0 )
|
, m_currentTrackPlaylist( 0 )
|
||||||
, m_queue( 0 )
|
, m_queue( 0 )
|
||||||
, m_timeElapsed( 0 )
|
, m_timeElapsed( 0 )
|
||||||
|
, m_expectStop( false )
|
||||||
{
|
{
|
||||||
qDebug() << "Init AudioEngine";
|
qDebug() << "Init AudioEngine";
|
||||||
|
|
||||||
@@ -25,6 +26,7 @@ AudioEngine::AudioEngine()
|
|||||||
Phonon::createPath( m_mediaObject, m_audioOutput );
|
Phonon::createPath( m_mediaObject, m_audioOutput );
|
||||||
|
|
||||||
m_mediaObject->setTickInterval( 150 );
|
m_mediaObject->setTickInterval( 150 );
|
||||||
|
connect( m_mediaObject, SIGNAL( stateChanged( Phonon::State, Phonon::State ) ), SLOT( onStateChanged( Phonon::State, Phonon::State ) ) );
|
||||||
connect( m_mediaObject, SIGNAL( tick( qint64 ) ), SLOT( timerTriggered( qint64 ) ) );
|
connect( m_mediaObject, SIGNAL( tick( qint64 ) ), SLOT( timerTriggered( qint64 ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,6 +74,7 @@ AudioEngine::stop()
|
|||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
|
|
||||||
|
m_expectStop = true;
|
||||||
m_mediaObject->stop();
|
m_mediaObject->stop();
|
||||||
|
|
||||||
if ( !m_input.isNull() )
|
if ( !m_input.isNull() )
|
||||||
@@ -237,6 +240,20 @@ AudioEngine::playItem( PlaylistInterface* playlist, const Tomahawk::result_ptr&
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
AudioEngine::onStateChanged( Phonon::State newState, Phonon::State oldState )
|
||||||
|
{
|
||||||
|
qDebug() << Q_FUNC_INFO << oldState << newState;
|
||||||
|
if ( oldState == Phonon::PlayingState && newState == Phonon::StoppedState )
|
||||||
|
{
|
||||||
|
if ( m_expectStop )
|
||||||
|
return;
|
||||||
|
|
||||||
|
loadNextTrack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AudioEngine::timerTriggered( qint64 time )
|
AudioEngine::timerTriggered( qint64 time )
|
||||||
{
|
{
|
||||||
|
@@ -26,6 +26,7 @@ public:
|
|||||||
~AudioEngine();
|
~AudioEngine();
|
||||||
|
|
||||||
unsigned int volume() const { return m_audioOutput->volume() * 100.0; } // in percent
|
unsigned int volume() const { return m_audioOutput->volume() * 100.0; } // in percent
|
||||||
|
bool isPlaying() const { return m_mediaObject->state() == Phonon::PlayingState; }
|
||||||
bool isPaused() const { return m_mediaObject->state() == Phonon::PausedState; }
|
bool isPaused() const { return m_mediaObject->state() == Phonon::PausedState; }
|
||||||
|
|
||||||
/* Returns the PlaylistInterface of the currently playing track. Note: This might be different to the current playlist! */
|
/* Returns the PlaylistInterface of the currently playing track. Note: This might be different to the current playlist! */
|
||||||
@@ -74,6 +75,7 @@ private slots:
|
|||||||
void loadPreviousTrack();
|
void loadPreviousTrack();
|
||||||
void loadNextTrack();
|
void loadNextTrack();
|
||||||
|
|
||||||
|
void onStateChanged( Phonon::State newState, Phonon::State oldState );
|
||||||
void timerTriggered( qint64 time );
|
void timerTriggered( qint64 time );
|
||||||
|
|
||||||
void setCurrentTrack( const Tomahawk::result_ptr& result );
|
void setCurrentTrack( const Tomahawk::result_ptr& result );
|
||||||
@@ -91,6 +93,7 @@ private:
|
|||||||
Phonon::AudioOutput* m_audioOutput;
|
Phonon::AudioOutput* m_audioOutput;
|
||||||
|
|
||||||
unsigned int m_timeElapsed;
|
unsigned int m_timeElapsed;
|
||||||
|
bool m_expectStop;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AUDIOENGINE_H
|
#endif // AUDIOENGINE_H
|
||||||
|
Reference in New Issue
Block a user