1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 14:16:32 +02:00

A few improvements regarding VLC's weird mute state on startup.

This commit is contained in:
Christian Muehlhaeuser
2016-02-19 04:11:11 +01:00
parent 978c1e58de
commit 3c9deb6389
2 changed files with 11 additions and 8 deletions

View File

@@ -165,7 +165,7 @@ AudioEngine::AudioEngine()
d->s_instance = this; d->s_instance = this;
tDebug() << "Init AudioEngine"; tDebug() << "Init AudioEngine";
d->audioOutput = new AudioOutput(this); d->audioOutput = new AudioOutput( this );
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 ) ) );
@@ -455,6 +455,8 @@ AudioEngine::mute()
{ {
Q_D( AudioEngine ); Q_D( AudioEngine );
d->audioOutput->setMuted( true ); d->audioOutput->setMuted( true );
emit volumeChanged( volume() );
} }
@@ -463,6 +465,8 @@ AudioEngine::toggleMute()
{ {
Q_D( AudioEngine ); Q_D( AudioEngine );
d->audioOutput->setMuted( !d->audioOutput->isMuted() ); d->audioOutput->setMuted( !d->audioOutput->isMuted() );
emit volumeChanged( volume() );
} }

View File

@@ -128,6 +128,7 @@ AudioOutput::AudioOutput( QObject* parent )
libvlc_event_attach( manager, events[ i ], &AudioOutput::vlcEventCallback, this ); libvlc_event_attach( manager, events[ i ], &AudioOutput::vlcEventCallback, this );
} }
m_muted = isMuted();
tDebug() << Q_FUNC_INFO << "Init OK"; tDebug() << Q_FUNC_INFO << "Init OK";
} }
@@ -456,7 +457,7 @@ AudioOutput::isSeekable() const
bool bool
AudioOutput::isMuted() const AudioOutput::isMuted() const
{ {
return m_muted; return libvlc_audio_get_mute( m_vlcPlayer );
} }
@@ -466,11 +467,9 @@ AudioOutput::setMuted( bool m )
tDebug() << Q_FUNC_INFO; tDebug() << Q_FUNC_INFO;
m_muted = m; m_muted = m;
if ( m_muted ) libvlc_audio_set_mute( m_vlcPlayer, m );
{
libvlc_audio_set_volume( m_vlcPlayer, 0 ); if ( !m_muted )
}
else
{ {
libvlc_audio_set_volume( m_vlcPlayer, m_volume * 100.0 ); libvlc_audio_set_volume( m_vlcPlayer, m_volume * 100.0 );
} }
@@ -487,7 +486,7 @@ AudioOutput::volume() const
void void
AudioOutput::setVolume( qreal vol ) AudioOutput::setVolume( qreal vol )
{ {
tDebug() << Q_FUNC_INFO; tDebug() << Q_FUNC_INFO << vol << m_muted;
m_volume = vol; m_volume = vol;
if ( !m_muted ) if ( !m_muted )