{"action":"created","comment":{"url":"https://api.github.com/repos/LMMS/lmms/pulls/comments/39353089","id":39353089,"diff_hunk":"@@ -0,0 +1,214 @@\n+/*\n+ * RenderManager - exporting logic common between the CLI and GUI.\n+ *\n+ * Copyright (c) 2015 Ryan Roden-Corrent <ryan/at/rcorre.net>\n+ *\n+ * This file is part of LMMS - http://lmms.io\n+ *\n+ * This program is free software; you can redistribute it and/or\n+ * modify it under the terms of the GNU General Public\n+ * License as published by the Free Software Foundation; either\n+ * version 2 of the License, or (at your option) any later version.\n+ *\n+ * This program is distributed in the hope that it will be useful,\n+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n+ * General Public License for more details.\n+ *\n+ * You should have received a copy of the GNU General Public\n+ * License along with this program (see COPYING); if not, write to the\n+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,\n+ * Boston, MA 02110-1301 USA.\n+ *\n+ */\n+\n+#include <QFileInfo>\n+#include <QDebug>\n+#include <QDir>\n+\n+#include \"RenderManager.h\"\n+#include \"Song.h\"\n+#include \"BBTrackContainer.h\"\n+#include \"BBTrack.h\"\n+#include \"debug.h\"\n+\n+RenderManager::RenderManager(\n+\t\tconst Mixer::qualitySettings & qualitySettings,\n+\t\tconst ProjectRenderer::OutputSettings & outputSettings,\n+\t\tProjectRenderer::ExportFileFormats fmt,\n+\t\tQString outputPath) :\n+\tm_qualitySettings(qualitySettings),\n+\tm_outputSettings(outputSettings),\n+\tm_format(fmt),\n+\tm_outputPath(outputPath),\n+\tm_activeRenderer(NULL)\n+{\n+}\n+\n+RenderManager::~RenderManager()\n+{\n+\tdelete m_activeRenderer;\n+}\n+\n+void RenderManager::abortProcessing()\n+{\n+\tif ( m_activeRenderer ) {\n+\t\tm_activeRenderer->abortProcessing();\n+\t}\n+\trestoreMutedState();\n+}\n+\n+// Called to render each new track when rendering tracks individually.\n+void RenderManager::renderNextTrack()\n+{\n+\tdelete m_activeRenderer;\n+\tm_activeRenderer = NULL;\n+\n+\tif( m_tracksToRender.isEmpty() )\n+\t{\n+\t\t// nothing left to render\n+\t\trestoreMutedState();\n+\t\temit finished();\n+\t}\n+\telse\n+\t{\n+\t\t// pop the next track from our rendering queue\n+\t\tTrack* renderTrack = m_tracksToRender.back();\n+\t\tm_tracksToRender.pop_back();\n+\n+\t\t// mute everything but the track we are about to render\n+\t\tfor( auto it = m_unmuted.begin(); it != m_unmuted.end(); ++it )\n+\t\t{\n+\t\t\t(*it)->setMuted( (*it) != renderTrack );\n+\t\t}\n+\n+\t\t// for multi-render, prefix each output file with a different number\n+\t\tint trackNum = m_tracksToRender.size() + 1;\n+\n+\t\t// create a renderer for this track\n+\t\tm_activeRenderer = new ProjectRenderer(\n+\t\t\t\tm_qualitySettings,\n+\t\t\t\tm_outputSettings,\n+\t\t\t\tm_format,\n+\t\t\t\tpathForTrack(renderTrack, trackNum));\n+\n+\t\tif ( m_activeRenderer->isReady() )\n+\t\t{\n+\t\t\t// pass progress signals through\n+\t\t\tconnect( m_activeRenderer, SIGNAL( progressChanged( int ) ),\n+\t\t\t\t\tthis, SIGNAL( progressChanged( int ) ) );\n+\n+\t\t\t// when it is finished, render the next track\n+\t\t\tconnect( m_activeRenderer, SIGNAL( finished() ),\n+\t\t\t\t\tthis, SLOT( renderNextTrack() ) );\n+\n+\t\t\tm_activeRenderer->startProcessing();\n+\t\t}\n+\t\telse\n+\t\t{\n+\t\t\tqDebug( \"Renderer failed to acquire a file device!\" );\n+\t\t\trenderNextTrack();\n+\t\t}\n+\t}\n+}\n+\n+// Render the song into individual tracks\n+void RenderManager::renderTracks()\n+{\n+\tconst TrackContainer::TrackList & tl = Engine::getSong()->tracks();\n+\n+\t// find all currently unnmuted tracks -- we want to render these.\n+\tfor( auto it = tl.begin(); it != tl.end(); ++it )\n+\t{\n+\t\tTrack* tk = (*it);","path":"src/core/RenderManager.cpp","position":123,"original_position":123,"commit_id":"fdb2787ff901325d406b6d42738af65f09927b0e","original_commit_id":"fdb2787ff901325d406b6d42738af65f09927b0e","user":{"login":"Wallacoloo","id":1210751,"avatar_url":"https://avatars.githubusercontent.com/u/1210751?v=3","gravatar_id":"","url":"https://api.github.com/users/Wallacoloo","html_url":"https://github.com/Wallacoloo","followers_url":"https://api.github.com/users/Wallacoloo/followers","following_url":"https://api.github.com/users/Wallacoloo/following{/other_user}","gists_url":"https://api.github.com/users/Wallacoloo/gists{/gist_id}","starred_url":"https://api.github.com/users/Wallacoloo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wallacoloo/subscriptions","organizations_url":"https://api.github.com/users/Wallacoloo/orgs","repos_url":"https://api.github.com/users/Wallacoloo/repos","events_url":"https://api.github.com/users/Wallacoloo/events{/privacy}","received_events_url":"https://api.github.com/users/Wallacoloo/received_events","type":"User","site_admin":false},"body":"In the future, feel free to use range-based iterators, i.e. `for (Track * tk : tl) { ... }`. Saves a bit of redundancy.","created_at":"2015-09-13T22:20:43Z","updated_at":"2015-09-13T22:20:43Z","html_url":"https://github.com/LMMS/lmms/pull/2310#discussion_r39353089","pull_request_url":"https://api.github.com/repos/LMMS/lmms/pulls/2310","_links":{"self":{"href":"https://api.github.com/repos/LMMS/lmms/pulls/comments/39353089"},"html":{"href":"https://github.com/LMMS/lmms/pull/2310#discussion_r39353089"},"pull_request":{"href":"https://api.github.com/repos/LMMS/lmms/pulls/2310"}}},"pull_request":{"url":"https://api.github.com/repos/LMMS/lmms/pulls/2310","id":44177056,"html_url":"https://github.com/LMMS/lmms/pull/2310","diff_url":"https://github.com/LMMS/lmms/pull/2310.diff","patch_url":"https://github.com/LMMS/lmms/pull/2310.patch","issue_url":"https://api.github.com/repos/LMMS/lmms/issues/2310","number":2310,"state":"open","locked":false,"title":"Add CLI equivalent to GUI's \"export tracks\"","user":{"login":"rcorre","id":2496231,"avatar_url":"https://avatars.githubusercontent.com/u/2496231?v=3","gravatar_id":"","url":"https://api.github.com/users/rcorre","html_url":"https://github.com/rcorre","followers_url":"https://api.github.com/users/rcorre/followers","following_url":"https://api.github.com/users/rcorre/following{/other_user}","gists_url":"https://api.github.com/users/rcorre/gists{/gist_id}","starred_url":"https://api.github.com/users/rcorre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rcorre/subscriptions","organizations_url":"https://api.github.com/users/rcorre/orgs","repos_url":"https://api.github.com/users/rcorre/repos","events_url":"https://api.github.com/users/rcorre/events{/privacy}","received_events_url":"https://api.github.com/users/rcorre/received_events","type":"User","site_admin":false},"body":"The GUI has an \"export tracks\" option that exports each track to a separate file.\r\nThis adds a `--render-tracks` CLI option to enable the same behavior from the command line.\r\n\r\nIn order to do this, I moved much of the rendering logic out of the gui code in `ExportProjectDialog` and into its own class called `RenderManager`.\r\n\r\nDue to #588, `--render-tracks` will segfault just as `--render` does, but the output seems intact.\r\n\r\nResolves #2254.","created_at":"2015-09-04T02:03:22Z","updated_at":"2015-09-13T22:20:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e66492a8e992cdd3093ed3e9845bc2d77311b0d9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/LMMS/lmms/pulls/2310/commits","review_comments_url":"https://api.github.com/repos/LMMS/lmms/pulls/2310/comments","review_comment_url":"https://api.github.com/repos/LMMS/lmms/pulls/comments{/number}","comments_url":"https://api.github.com/repos/LMMS/lmms/issues/2310/comments","statuses_url":"https://api.github.com/repos/LMMS/lmms/statuses/fdb2787ff901325d406b6d42738af65f09927b0e","head":{"label":"rcorre:master","ref":"master","sha":"fdb2787ff901325d406b6d42738af65f09927b0e","user":{"login":"rcorre","id":2496231,"avatar_url":"https://avatars.githubusercontent.com/u/2496231?v=3","gravatar_id":"","url":"https://api.github.com/users/rcorre","html_url":"https://github.com/rcorre","followers_url":"https://api.github.com/users/rcorre/followers","following_url":"https://api.github.com/users/rcorre/following{/other_user}","gists_url":"https://api.github.com/users/rcorre/gists{/gist_id}","starred_url":"https://api.github.com/users/rcorre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rcorre/subscriptions","organizations_url":"https://api.github.com/users/rcorre/orgs","repos_url":"https://api.github.com/users/rcorre/repos","events_url":"https://api.github.com/users/rcorre/events{/privacy}","received_events_url":"https://api.github.com/users/rcorre/received_events","type":"User","site_admin":false},"repo":{"id":40827927,"name":"lmms","full_name":"rcorre/lmms","owner":{"login":"rcorre","id":2496231,"avatar_url":"https://avatars.githubusercontent.com/u/2496231?v=3","gravatar_id":"","url":"https://api.github.com/users/rcorre","html_url":"https://github.com/rcorre","followers_url":"https://api.github.com/users/rcorre/followers","following_url":"https://api.github.com/users/rcorre/following{/other_user}","gists_url":"https://api.github.com/users/rcorre/gists{/gist_id}","starred_url":"https://api.github.com/users/rcorre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rcorre/subscriptions","organizations_url":"https://api.github.com/users/rcorre/orgs","repos_url":"https://api.github.com/users/rcorre/repos","events_url":"https://api.github.com/users/rcorre/events{/privacy}","received_events_url":"https://api.github.com/users/rcorre/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rcorre/lmms","description":"cross-platform music production software","fork":true,"url":"https://api.github.com/repos/rcorre/lmms","forks_url":"https://api.github.com/repos/rcorre/lmms/forks","keys_url":"https://api.github.com/repos/rcorre/lmms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rcorre/lmms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rcorre/lmms/teams","hooks_url":"https://api.github.com/repos/rcorre/lmms/hooks","issue_events_url":"https://api.github.com/repos/rcorre/lmms/issues/events{/number}","events_url":"https://api.github.com/repos/rcorre/lmms/events","assignees_url":"https://api.github.com/repos/rcorre/lmms/assignees{/user}","branches_url":"https://api.github.com/repos/rcorre/lmms/branches{/branch}","tags_url":"https://api.github.com/repos/rcorre/lmms/tags","blobs_url":"https://api.github.com/repos/rcorre/lmms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rcorre/lmms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rcorre/lmms/git/refs{/sha}","trees_url":"https://api.github.com/repos/rcorre/lmms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rcorre/lmms/statuses/{sha}","languages_url":"https://api.github.com/repos/rcorre/lmms/languages","stargazers_url":"https://api.github.com/repos/rcorre/lmms/stargazers","contributors_url":"https://api.github.com/repos/rcorre/lmms/contributors","subscribers_url":"https://api.github.com/repos/rcorre/lmms/subscribers","subscription_url":"https://api.github.com/repos/rcorre/lmms/subscription","commits_url":"https://api.github.com/repos/rcorre/lmms/commits{/sha}","git_commits_url":"https://api.github.com/repos/rcorre/lmms/git/commits{/sha}","comments_url":"https://api.github.com/repos/rcorre/lmms/comments{/number}","issue_comment_url":"https://api.github.com/repos/rcorre/lmms/issues/comments{/number}","contents_url":"https://api.github.com/repos/rcorre/lmms/contents/{+path}","compare_url":"https://api.github.com/repos/rcorre/lmms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rcorre/lmms/merges","archive_url":"https://api.github.com/repos/rcorre/lmms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rcorre/lmms/downloads","issues_url":"https://api.github.com/repos/rcorre/lmms/issues{/number}","pulls_url":"https://api.github.com/repos/rcorre/lmms/pulls{/number}","milestones_url":"https://api.github.com/repos/rcorre/lmms/milestones{/number}","notifications_url":"https://api.github.com/repos/rcorre/lmms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rcorre/lmms/labels{/name}","releases_url":"https://api.github.com/repos/rcorre/lmms/releases{/id}","created_at":"2015-08-16T16:20:13Z","updated_at":"2015-08-16T16:20:22Z","pushed_at":"2015-09-13T16:54:26Z","git_url":"git://github.com/rcorre/lmms.git","ssh_url":"git@github.com:rcorre/lmms.git","clone_url":"https://github.com/rcorre/lmms.git","svn_url":"https://github.com/rcorre/lmms","homepage":"http://lmms.io/","size":61220,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"LMMS:master","ref":"master","sha":"deeb95a749f216fee81b3c55ee47c2650910e7c5","user":{"login":"LMMS","id":6363159,"avatar_url":"https://avatars.githubusercontent.com/u/6363159?v=3","gravatar_id":"","url":"https://api.github.com/users/LMMS","html_url":"https://github.com/LMMS","followers_url":"https://api.github.com/users/LMMS/followers","following_url":"https://api.github.com/users/LMMS/following{/other_user}","gists_url":"https://api.github.com/users/LMMS/gists{/gist_id}","starred_url":"https://api.github.com/users/LMMS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LMMS/subscriptions","organizations_url":"https://api.github.com/users/LMMS/orgs","repos_url":"https://api.github.com/users/LMMS/repos","events_url":"https://api.github.com/users/LMMS/events{/privacy}","received_events_url":"https://api.github.com/users/LMMS/received_events","type":"Organization","site_admin":false},"repo":{"id":15778896,"name":"lmms","full_name":"LMMS/lmms","owner":{"login":"LMMS","id":6363159,"avatar_url":"https://avatars.githubusercontent.com/u/6363159?v=3","gravatar_id":"","url":"https://api.github.com/users/LMMS","html_url":"https://github.com/LMMS","followers_url":"https://api.github.com/users/LMMS/followers","following_url":"https://api.github.com/users/LMMS/following{/other_user}","gists_url":"https://api.github.com/users/LMMS/gists{/gist_id}","starred_url":"https://api.github.com/users/LMMS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LMMS/subscriptions","organizations_url":"https://api.github.com/users/LMMS/orgs","repos_url":"https://api.github.com/users/LMMS/repos","events_url":"https://api.github.com/users/LMMS/events{/privacy}","received_events_url":"https://api.github.com/users/LMMS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/LMMS/lmms","description":"cross-platform music production software","fork":false,"url":"https://api.github.com/repos/LMMS/lmms","forks_url":"https://api.github.com/repos/LMMS/lmms/forks","keys_url":"https://api.github.com/repos/LMMS/lmms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/LMMS/lmms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/LMMS/lmms/teams","hooks_url":"https://api.github.com/repos/LMMS/lmms/hooks","issue_events_url":"https://api.github.com/repos/LMMS/lmms/issues/events{/number}","events_url":"https://api.github.com/repos/LMMS/lmms/events","assignees_url":"https://api.github.com/repos/LMMS/lmms/assignees{/user}","branches_url":"https://api.github.com/repos/LMMS/lmms/branches{/branch}","tags_url":"https://api.github.com/repos/LMMS/lmms/tags","blobs_url":"https://api.github.com/repos/LMMS/lmms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/LMMS/lmms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/LMMS/lmms/git/refs{/sha}","trees_url":"https://api.github.com/repos/LMMS/lmms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/LMMS/lmms/statuses/{sha}","languages_url":"https://api.github.com/repos/LMMS/lmms/languages","stargazers_url":"https://api.github.com/repos/LMMS/lmms/stargazers","contributors_url":"https://api.github.com/repos/LMMS/lmms/contributors","subscribers_url":"https://api.github.com/repos/LMMS/lmms/subscribers","subscription_url":"https://api.github.com/repos/LMMS/lmms/subscription","commits_url":"https://api.github.com/repos/LMMS/lmms/commits{/sha}","git_commits_url":"https://api.github.com/repos/LMMS/lmms/git/commits{/sha}","comments_url":"https://api.github.com/repos/LMMS/lmms/comments{/number}","issue_comment_url":"https://api.github.com/repos/LMMS/lmms/issues/comments{/number}","contents_url":"https://api.github.com/repos/LMMS/lmms/contents/{+path}","compare_url":"https://api.github.com/repos/LMMS/lmms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/LMMS/lmms/merges","archive_url":"https://api.github.com/repos/LMMS/lmms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/LMMS/lmms/downloads","issues_url":"https://api.github.com/repos/LMMS/lmms/issues{/number}","pulls_url":"https://api.github.com/repos/LMMS/lmms/pulls{/number}","milestones_url":"https://api.github.com/repos/LMMS/lmms/milestones{/number}","notifications_url":"https://api.github.com/repos/LMMS/lmms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/LMMS/lmms/labels{/name}","releases_url":"https://api.github.com/repos/LMMS/lmms/releases{/id}","created_at":"2014-01-09T20:43:43Z","updated_at":"2015-09-13T15:22:28Z","pushed_at":"2015-09-13T22:04:23Z","git_url":"git://github.com/LMMS/lmms.git","ssh_url":"git@github.com:LMMS/lmms.git","clone_url":"https://github.com/LMMS/lmms.git","svn_url":"https://github.com/LMMS/lmms","homepage":"http://lmms.io/","size":83024,"stargazers_count":504,"watchers_count":504,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":151,"mirror_url":null,"open_issues_count":435,"forks":151,"open_issues":435,"watchers":504,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/LMMS/lmms/pulls/2310"},"html":{"href":"https://github.com/LMMS/lmms/pull/2310"},"issue":{"href":"https://api.github.com/repos/LMMS/lmms/issues/2310"},"comments":{"href":"https://api.github.com/repos/LMMS/lmms/issues/2310/comments"},"review_comments":{"href":"https://api.github.com/repos/LMMS/lmms/pulls/2310/comments"},"review_comment":{"href":"https://api.github.com/repos/LMMS/lmms/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/LMMS/lmms/pulls/2310/commits"},"statuses":{"href":"https://api.github.com/repos/LMMS/lmms/statuses/fdb2787ff901325d406b6d42738af65f09927b0e"}}}}