diff --git a/include/song.h b/include/song.h index 3fabae1af..1c4191edd 100644 --- a/include/song.h +++ b/include/song.h @@ -109,6 +109,11 @@ public: return m_exporting; } + inline void setExportLoop(bool export_loop) + { + m_export_loop = export_loop; + } + inline bool isRecording() const { return m_recording; @@ -118,8 +123,16 @@ public: inline bool isExportDone() const { - return m_exporting == true && - m_playPos[Mode_PlaySong].getTact() >= length() + 1; + if ( m_export_loop ) + { + return m_exporting == true && + m_playPos[Mode_PlaySong].getTact() >= length(); + } + else + { + return m_exporting == true && + m_playPos[Mode_PlaySong].getTact() >= length() + 1; + } } inline PlayModes playMode() const @@ -284,6 +297,7 @@ private: volatile bool m_recording; volatile bool m_exporting; + volatile bool m_export_loop; volatile bool m_playing; volatile bool m_paused; diff --git a/src/core/song.cpp b/src/core/song.cpp index fce3c6c64..cd99e2c2f 100644 --- a/src/core/song.cpp +++ b/src/core/song.cpp @@ -82,6 +82,7 @@ song::song() : m_modified( false ), m_recording( false ), m_exporting( false ), + m_export_loop( false ), m_playing( false ), m_paused( false ), m_loadingProject( false ), @@ -638,6 +639,7 @@ void song::stopExport() { stop(); m_exporting = false; + m_export_loop = false; } diff --git a/src/gui/ExportProjectDialog.cpp b/src/gui/ExportProjectDialog.cpp index 3d898e93e..73f353960 100644 --- a/src/gui/ExportProjectDialog.cpp +++ b/src/gui/ExportProjectDialog.cpp @@ -27,6 +27,7 @@ #include "ExportProjectDialog.h" #include "engine.h" +#include "song.h" #include "MainWindow.h" #include "ProjectRenderer.h" #include "ui_ExportProjectDialog.h" @@ -161,6 +162,8 @@ void ExportProjectDialog::startBtnClicked() ui->bitrateCB->currentText().section( " ", 0, 0 ).toUInt(), static_cast( ui->depthCB->currentIndex() ) ); + engine::getSong()->setExportLoop( ui->exportLoopCB->isChecked() ); + m_renderer = new ProjectRenderer( qs, es, ft, m_fileName ); if( m_renderer->isReady() ) { diff --git a/src/gui/Forms/ExportProjectDialog.ui b/src/gui/Forms/ExportProjectDialog.ui index 0d86aee5f..9f07066e4 100644 --- a/src/gui/Forms/ExportProjectDialog.ui +++ b/src/gui/Forms/ExportProjectDialog.ui @@ -284,6 +284,13 @@ + + + + Export as loop (remove end silence) + + +