Fix minor glitches with sample tracks (#4666)

Switches some signal-slot connections to Qt::DirectConnection.
Now LMMS can handle loop points correctly and export samples without glitches.
Also tweaks some Mixer-related code to avoid related deadlocks on export.
This commit is contained in:
Hyunjin Song
2018-10-29 16:17:41 +09:00
committed by GitHub
parent 1f7cd3ed5a
commit d8fb07ff52
5 changed files with 20 additions and 13 deletions

View File

@@ -171,10 +171,11 @@ public:
return m_audioDevStartFailed;
}
void setAudioDevice( AudioDevice * _dev );
void setAudioDevice( AudioDevice * _dev , bool startNow );
void setAudioDevice( AudioDevice * _dev,
const struct qualitySettings & _qs,
bool _needs_fifo );
bool _needs_fifo,
bool startNow );
void storeAudioDevice();
void restoreAudioDevice();
inline AudioDevice * audioDev()

View File

@@ -575,7 +575,8 @@ void Mixer::changeQuality( const struct qualitySettings & _qs )
void Mixer::setAudioDevice( AudioDevice * _dev )
void Mixer::setAudioDevice( AudioDevice * _dev,
bool startNow )
{
stopProcessing();
@@ -592,7 +593,7 @@ void Mixer::setAudioDevice( AudioDevice * _dev )
emit sampleRateChanged();
startProcessing();
if (startNow) {startProcessing();}
}
@@ -600,7 +601,8 @@ void Mixer::setAudioDevice( AudioDevice * _dev )
void Mixer::setAudioDevice( AudioDevice * _dev,
const struct qualitySettings & _qs,
bool _needs_fifo )
bool _needs_fifo,
bool startNow )
{
// don't delete the audio-device
stopProcessing();
@@ -621,7 +623,7 @@ void Mixer::setAudioDevice( AudioDevice * _dev,
emit qualitySettingsChanged();
emit sampleRateChanged();
startProcessing( _needs_fifo );
if (startNow) {startProcessing( _needs_fifo );}
}

View File

@@ -146,7 +146,7 @@ void ProjectRenderer::startProcessing()
// make slots connected to sampleRateChanged()-signals being
// called immediately
Engine::mixer()->setAudioDevice( m_fileDev,
m_qualitySettings, false );
m_qualitySettings, false, false );
start(
#ifndef LMMS_BUILD_WIN32
@@ -185,6 +185,9 @@ void ProjectRenderer::run()
tick_t endTick = exportEndpoints.second.getTicks();
tick_t lengthTicks = endTick - startTick;
// Now start processing
Engine::mixer()->startProcessing(false);
// Continually track and emit progress percentage to listeners
while( exportPos.getTicks() < endTick &&
Engine::getSong()->isExporting() == true

View File

@@ -356,9 +356,7 @@ void Song::processNextBuffer()
m_vstSyncController.setAbsolutePosition( ticks );
m_vstSyncController.setPlaybackJumped( true );
}
else if( m_playPos[m_playMode] == tl->loopEnd() - 1 )
{
emit updateSampleTracks();
}
}

View File

@@ -72,13 +72,16 @@ SampleTCO::SampleTCO( Track * _track ) :
connect( timeLine, SIGNAL( positionMarkerMoved() ), this, SLOT( playbackPositionChanged() ) );
}
//playbutton clicked or space key / on Export Song set isPlaying to false
connect( Engine::getSong(), SIGNAL( playbackStateChanged() ), this, SLOT( playbackPositionChanged() ) );
connect( Engine::getSong(), SIGNAL( playbackStateChanged() ),
this, SLOT( playbackPositionChanged() ), Qt::DirectConnection );
//care about loops
connect( Engine::getSong(), SIGNAL( updateSampleTracks() ), this, SLOT( playbackPositionChanged() ) );
connect( Engine::getSong(), SIGNAL( updateSampleTracks() ),
this, SLOT( playbackPositionChanged() ), Qt::DirectConnection );
//care about mute TCOs
connect( this, SIGNAL( dataChanged() ), this, SLOT( playbackPositionChanged() ) );
//care about mute track
connect( getTrack()->getMutedModel(), SIGNAL( dataChanged() ),this, SLOT( playbackPositionChanged() ) );
connect( getTrack()->getMutedModel(), SIGNAL( dataChanged() ),
this, SLOT( playbackPositionChanged() ), Qt::DirectConnection );
//care about TCO position
connect( this, SIGNAL( positionChanged() ), this, SLOT( updateTrackTcos() ) );