1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-17 19:37:09 +02:00

Don't set time on AudioEngine's singleton instance, but emit signals to it.

This commit is contained in:
Christian Muehlhaeuser
2015-04-18 05:34:52 +02:00
parent 391cc821f8
commit 8a7a8bb4f0
4 changed files with 9 additions and 4 deletions

View File

@@ -184,6 +184,7 @@ AudioEngine::AudioEngine()
connect( d->audioOutput, SIGNAL( stateChanged( AudioOutput::AudioState, AudioOutput::AudioState ) ), d_func(), SLOT( onStateChanged( AudioOutput::AudioState, AudioOutput::AudioState ) ) ); connect( d->audioOutput, SIGNAL( stateChanged( AudioOutput::AudioState, AudioOutput::AudioState ) ), d_func(), SLOT( onStateChanged( AudioOutput::AudioState, AudioOutput::AudioState ) ) );
connect( d->audioOutput, SIGNAL( tick( qint64 ) ), SLOT( timerTriggered( qint64 ) ) ); connect( d->audioOutput, SIGNAL( tick( qint64 ) ), SLOT( timerTriggered( qint64 ) ) );
connect( d->audioOutput, SIGNAL( positionChanged( float ) ), SLOT( onPositionChanged( float ) ) );
setVolume( TomahawkSettings::instance()->volume() ); setVolume( TomahawkSettings::instance()->volume() );
@@ -600,7 +601,9 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
} }
} }
void AudioEngine::positionChanged(float new_position)
void
AudioEngine::onPositionChanged( float new_position )
{ {
emit trackPosition( new_position ); emit trackPosition( new_position );
} }

View File

@@ -147,8 +147,6 @@ public slots:
void setRepeatMode( Tomahawk::PlaylistModes::RepeatMode mode ); void setRepeatMode( Tomahawk::PlaylistModes::RepeatMode mode );
void setShuffled( bool enabled ); void setShuffled( bool enabled );
void positionChanged(float new_position);
signals: signals:
void loading( const Tomahawk::result_ptr track ); void loading( const Tomahawk::result_ptr track );
void started( const Tomahawk::result_ptr track ); void started( const Tomahawk::result_ptr track );
@@ -189,6 +187,7 @@ private slots:
void onVolumeChanged( qreal volume ); void onVolumeChanged( qreal volume );
void timerTriggered( qint64 time ); void timerTriggered( qint64 time );
void onPositionChanged( float new_position );
void setCurrentTrack( const Tomahawk::result_ptr& result ); void setCurrentTrack( const Tomahawk::result_ptr& result );
void onNowPlayingInfoReady( const Tomahawk::InfoSystem::InfoType type ); void onNowPlayingInfoReady( const Tomahawk::InfoSystem::InfoType type );

View File

@@ -302,14 +302,16 @@ AudioOutput::currentTime() const
return m_currentTime; return m_currentTime;
} }
void void
AudioOutput::setCurrentPosition( float position ) AudioOutput::setCurrentPosition( float position )
{ {
//tDebug() << Q_FUNC_INFO << position; //tDebug() << Q_FUNC_INFO << position;
AudioEngine::instance()->positionChanged(position); emit positionChanged( position );
m_havePosition = position > 0.0; m_havePosition = position > 0.0;
} }
void void
AudioOutput::setCurrentTime( qint64 time ) AudioOutput::setCurrentTime( qint64 time )
{ {

View File

@@ -74,6 +74,7 @@ public slots:
signals: signals:
void stateChanged( AudioOutput::AudioState, AudioOutput::AudioState ); void stateChanged( AudioOutput::AudioState, AudioOutput::AudioState );
void tick( qint64 ); void tick( qint64 );
void positionChanged( float );
private: private:
void setState( AudioState state ); void setState( AudioState state );