Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/core/ProjectRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ void ProjectRenderer::run()
PerfLogTimer perfLog("Project Render");

Engine::getSong()->startExport();
Engine::getSong()->updateLength();
// Skip first empty buffer.
Engine::mixer()->nextBuffer();

Expand Down
4 changes: 2 additions & 2 deletions src/core/RenderManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 7 additions & 8 deletions src/core/Song.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -781,8 +783,6 @@ void Song::startExport()

playSong();

m_exporting = true;

m_vstSyncController.setPlaybackState( true );
}

Expand All @@ -793,7 +793,6 @@ void Song::stopExport()
{
stop();
m_exporting = false;
m_exportLoop = false;

m_vstSyncController.setPlaybackState( m_playing );
}
Expand Down