mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 03:10:12 +02:00
* Fixed started() being emitted too often and removed obsolete volume hack.
This commit is contained in:
@@ -212,6 +212,7 @@ AudioControls::onControlStateChanged()
|
|||||||
void
|
void
|
||||||
AudioControls::onPlaybackStarted( const Tomahawk::result_ptr& result )
|
AudioControls::onPlaybackStarted( const Tomahawk::result_ptr& result )
|
||||||
{
|
{
|
||||||
|
tDebug() << "FOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO";
|
||||||
if ( result.isNull() )
|
if ( result.isNull() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@@ -451,6 +451,7 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
|
|||||||
if ( !err )
|
if ( !err )
|
||||||
{
|
{
|
||||||
tLog() << "Starting new song:" << m_currentTrack->url();
|
tLog() << "Starting new song:" << m_currentTrack->url();
|
||||||
|
m_state = Loading;
|
||||||
emit loading( m_currentTrack );
|
emit loading( m_currentTrack );
|
||||||
|
|
||||||
if ( !isHttpResult( m_currentTrack->url() ) && !isLocalResult( m_currentTrack->url() ) )
|
if ( !isHttpResult( m_currentTrack->url() ) && !isLocalResult( m_currentTrack->url() ) )
|
||||||
@@ -736,8 +737,17 @@ AudioEngine::onAboutToFinish()
|
|||||||
void
|
void
|
||||||
AudioEngine::onStateChanged( Phonon::State newState, Phonon::State oldState )
|
AudioEngine::onStateChanged( Phonon::State newState, Phonon::State oldState )
|
||||||
{
|
{
|
||||||
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << oldState << newState << m_expectStop;
|
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << oldState << newState << m_expectStop << state();
|
||||||
|
|
||||||
|
if ( newState == Phonon::LoadingState )
|
||||||
|
{
|
||||||
|
// We don't emit this state to listeners - yet.
|
||||||
|
m_state = Loading;
|
||||||
|
}
|
||||||
|
if ( newState == Phonon::StoppedState )
|
||||||
|
{
|
||||||
|
m_state = Stopped;
|
||||||
|
}
|
||||||
if ( newState == Phonon::ErrorState )
|
if ( newState == Phonon::ErrorState )
|
||||||
{
|
{
|
||||||
stop( UnknownError );
|
stop( UnknownError );
|
||||||
@@ -749,7 +759,9 @@ AudioEngine::onStateChanged( Phonon::State newState, Phonon::State oldState )
|
|||||||
}
|
}
|
||||||
if ( newState == Phonon::PlayingState )
|
if ( newState == Phonon::PlayingState )
|
||||||
{
|
{
|
||||||
emit started( m_currentTrack );
|
if ( state() != Paused && state() != Playing )
|
||||||
|
emit started( m_currentTrack );
|
||||||
|
|
||||||
setState( Playing );
|
setState( Playing );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -982,17 +994,12 @@ AudioEngine::checkStateQueue()
|
|||||||
{
|
{
|
||||||
case Playing:
|
case Playing:
|
||||||
{
|
{
|
||||||
bool paused = isPaused();
|
|
||||||
m_mediaObject->play();
|
m_mediaObject->play();
|
||||||
if ( paused )
|
|
||||||
setVolume( m_volume );
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case Paused:
|
case Paused:
|
||||||
{
|
{
|
||||||
m_volume = volume();
|
|
||||||
m_mediaObject->pause();
|
m_mediaObject->pause();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -42,7 +42,7 @@ Q_OBJECT
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
enum AudioErrorCode { StreamReadError, AudioDeviceError, DecodeError, UnknownError, NoError };
|
enum AudioErrorCode { StreamReadError, AudioDeviceError, DecodeError, UnknownError, NoError };
|
||||||
enum AudioState { Stopped, Playing, Paused, Error };
|
enum AudioState { Stopped, Playing, Paused, Error, Loading };
|
||||||
|
|
||||||
static AudioEngine* instance();
|
static AudioEngine* instance();
|
||||||
|
|
||||||
@@ -171,7 +171,6 @@ private:
|
|||||||
bool m_waitingOnNewTrack;
|
bool m_waitingOnNewTrack;
|
||||||
|
|
||||||
mutable QStringList m_supportedMimeTypes;
|
mutable QStringList m_supportedMimeTypes;
|
||||||
unsigned int m_volume;
|
|
||||||
|
|
||||||
AudioState m_state;
|
AudioState m_state;
|
||||||
QQueue< AudioState > m_stateQueue;
|
QQueue< AudioState > m_stateQueue;
|
||||||
|
Reference in New Issue
Block a user