Fix wrong lengths of exported tracks, when tracks have different lengths. (#5348)

* Fix wrong lengths of exported tracks, when tracks have different lengths.

Song::updateLength() was called in ProjectRenderer::run() after Song::startExport(),
updating m_length too late, resulting in it being used as the length of the wrong track.

* Fix "Export as loop" resetting after rendering the first track

Co-authored-by: Hyunjin Song <tteu.ingog@gmail.com>
This commit is contained in:
Cyp
2020-05-19 05:28:03 +02:00
committed by GitHub
parent 7f9b4c2401
commit 8a190e4e13
3 changed files with 9 additions and 11 deletions

View File

@@ -181,7 +181,6 @@ void ProjectRenderer::run()
PerfLogTimer perfLog("Project Render");
Engine::getSong()->startExport();
Engine::getSong()->updateLength();
// Skip first empty buffer.
Engine::mixer()->nextBuffer();

View File

@@ -80,9 +80,9 @@ void RenderManager::renderNextTrack()
m_tracksToRender.pop_back();
// mute everything but the track we are about to render
for( auto it = m_unmuted.begin(); it != m_unmuted.end(); ++it )
for (auto track : m_unmuted)
{
(*it)->setMuted( (*it) != renderTrack );
track->setMuted(track != renderTrack);
}
// for multi-render, prefix each output file with a different number

View File

@@ -612,16 +612,14 @@ void Song::updateLength()
{
m_length = 0;
m_tracksMutex.lockForRead();
for( TrackList::const_iterator it = tracks().begin();
it != tracks().end(); ++it )
for (auto track : tracks())
{
if( Engine::getSong()->isExporting() &&
( *it )->isMuted() )
if (m_exporting && track->isMuted())
{
continue;
}
const bar_t cur = ( *it )->length();
const bar_t cur = track->length();
if( cur > m_length )
{
m_length = cur;
@@ -744,6 +742,10 @@ void Song::stop()
void Song::startExport()
{
stop();
m_exporting = true;
updateLength();
if (m_renderBetweenMarkers)
{
m_exportSongBegin = m_exportLoopBegin = m_playPos[Mode_PlaySong].m_timeLine->loopBegin();
@@ -781,8 +783,6 @@ void Song::startExport()
playSong();
m_exporting = true;
m_vstSyncController.setPlaybackState( true );
}
@@ -793,7 +793,6 @@ void Song::stopExport()
{
stop();
m_exporting = false;
m_exportLoop = false;
m_vstSyncController.setPlaybackState( m_playing );
}