small fixes, print progress in rows/files
This commit is contained in:
parent
a4dae5302b
commit
33eea96986
103
src/gui/gui.cpp
103
src/gui/gui.cpp
|
|
@ -2600,7 +2600,7 @@ void FurnaceGUI::exportAudio(String path, DivAudioExportModes mode) {
|
||||||
|
|
||||||
e->saveAudio(path.c_str(),audioExportOptions);
|
e->saveAudio(path.c_str(),audioExportOptions);
|
||||||
|
|
||||||
int totalFiles = 0;
|
totalFiles = 0;
|
||||||
e->getTotalAudioFiles(totalFiles);
|
e->getTotalAudioFiles(totalFiles);
|
||||||
int totalLoops = 0;
|
int totalLoops = 0;
|
||||||
|
|
||||||
|
|
@ -2621,52 +2621,6 @@ void FurnaceGUI::exportAudio(String path, DivAudioExportModes mode) {
|
||||||
displayExporting=true;
|
displayExporting=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*e->lockEngine([this, progressLambda]()
|
|
||||||
{
|
|
||||||
int totalFiles = 0;
|
|
||||||
e->getTotalAudioFiles(totalFiles);
|
|
||||||
int loopsLeft = 0;
|
|
||||||
int totalLoops = 0;
|
|
||||||
|
|
||||||
int curRow = 0;
|
|
||||||
int curOrder = 0;
|
|
||||||
e->getCurSongPos(curRow, curOrder);
|
|
||||||
int curFile = 0;
|
|
||||||
e->getCurFileIndex(curFile);
|
|
||||||
|
|
||||||
int lengthOfOneFile = songLength;
|
|
||||||
|
|
||||||
int curPosInRows = curRow;
|
|
||||||
|
|
||||||
for(int i = 0; i < curOrder; i++)
|
|
||||||
{
|
|
||||||
curPosInRows += songOrdersLengths[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!songHasSongEndCommand)
|
|
||||||
{
|
|
||||||
e->getLoopsLeft(loopsLeft);
|
|
||||||
e->getTotalLoops(totalLoops);
|
|
||||||
|
|
||||||
lengthOfOneFile += songLoopedSectionLength * totalLoops;
|
|
||||||
lengthOfOneFile += songFadeoutSectionLength; //account for fadeout
|
|
||||||
|
|
||||||
if(totalLoops != loopsLeft) //we are going 2nd, 3rd, etc. time through the song
|
|
||||||
{
|
|
||||||
curPosInRows -= (songLength - songLoopedSectionLength); //a hack so progress bar does not jump?
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//int lengthOfOneFile = songLength * (totalLoops + 1);
|
|
||||||
//songLoopedSectionLength
|
|
||||||
int totalLength = lengthOfOneFile * totalFiles;
|
|
||||||
|
|
||||||
*progressLambda = (float)(curPosInRows +
|
|
||||||
(totalLoops - loopsLeft) * songLength +
|
|
||||||
lengthOfOneFile * curFile)
|
|
||||||
/ (float)totalLength;
|
|
||||||
});*/
|
|
||||||
|
|
||||||
void FurnaceGUI::editStr(String* which) {
|
void FurnaceGUI::editStr(String* which) {
|
||||||
editString=which;
|
editString=which;
|
||||||
displayEditString=true;
|
displayEditString=true;
|
||||||
|
|
@ -5902,51 +5856,68 @@ bool FurnaceGUI::loop() {
|
||||||
|
|
||||||
centerNextWindow(_("Rendering..."),canvasW,canvasH);
|
centerNextWindow(_("Rendering..."),canvasW,canvasH);
|
||||||
if (ImGui::BeginPopupModal(_("Rendering..."),NULL,ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove)) {
|
if (ImGui::BeginPopupModal(_("Rendering..."),NULL,ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove)) {
|
||||||
ImGui::Text(_("Please wait..."));
|
if(audioExportOptions.mode != DIV_EXPORT_MODE_MANY_CHAN)
|
||||||
|
{
|
||||||
|
ImGui::Text(_("Please wait..."));
|
||||||
|
}
|
||||||
float* progressLambda = &curProgress;
|
float* progressLambda = &curProgress;
|
||||||
|
int curPosInRows = 0;
|
||||||
|
int* curPosInRowsLambda = &curPosInRows;
|
||||||
|
int loopsLeft = 0;
|
||||||
|
int* loopsLeftLambda = &loopsLeft;
|
||||||
|
int totalLoops = 0;
|
||||||
|
int* totalLoopsLambda = &totalLoops;
|
||||||
|
int curFile = 0;
|
||||||
|
int* curFileLambda = &curFile;
|
||||||
if(e->isExporting())
|
if(e->isExporting())
|
||||||
{
|
{
|
||||||
e->lockEngine([this, progressLambda]()
|
e->lockEngine([this, progressLambda, curPosInRowsLambda, curFileLambda, loopsLeftLambda, totalLoopsLambda]()
|
||||||
{
|
{
|
||||||
int loopsLeft = 0;
|
|
||||||
int totalLoops = 0;
|
|
||||||
|
|
||||||
int curRow = 0;
|
int curRow = 0;
|
||||||
int curOrder = 0;
|
int curOrder = 0;
|
||||||
e->getCurSongPos(curRow, curOrder);
|
e->getCurSongPos(curRow, curOrder);
|
||||||
int curFile = 0;
|
*curFileLambda = 0;
|
||||||
e->getCurFileIndex(curFile);
|
e->getCurFileIndex(*curFileLambda);
|
||||||
|
|
||||||
int curPosInRows = curRow;
|
*curPosInRowsLambda = curRow;
|
||||||
|
|
||||||
for(int i = 0; i < curOrder; i++)
|
for(int i = 0; i < curOrder; i++)
|
||||||
{
|
{
|
||||||
curPosInRows += songOrdersLengths[i];
|
*curPosInRowsLambda += songOrdersLengths[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!songHasSongEndCommand)
|
if(!songHasSongEndCommand)
|
||||||
{
|
{
|
||||||
e->getLoopsLeft(loopsLeft);
|
e->getLoopsLeft(*loopsLeftLambda);
|
||||||
e->getTotalLoops(totalLoops);
|
e->getTotalLoops(*totalLoopsLambda);
|
||||||
|
|
||||||
if(totalLoops != loopsLeft) //we are going 2nd, 3rd, etc. time through the song
|
if((*totalLoopsLambda) != (*loopsLeftLambda)) //we are going 2nd, 3rd, etc. time through the song
|
||||||
{
|
{
|
||||||
curPosInRows -= (songLength - songLoopedSectionLength); //a hack so progress bar does not jump?
|
*curPosInRowsLambda -= (songLength - songLoopedSectionLength); //a hack so progress bar does not jump?
|
||||||
}
|
}
|
||||||
if(e->getIsFadingOut()) //we are in fadeout??? why it works like that bruh
|
if(e->getIsFadingOut()) //we are in fadeout??? why it works like that bruh
|
||||||
{
|
{
|
||||||
curPosInRows -= (songLength - songLoopedSectionLength); //a hack so progress bar does not jump?
|
*curPosInRowsLambda -= (songLength - songLoopedSectionLength); //a hack so progress bar does not jump?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*progressLambda = (float)(curPosInRows +
|
*progressLambda = (float)((*curPosInRowsLambda) +
|
||||||
(totalLoops - loopsLeft) * songLength +
|
((*totalLoopsLambda) - (*loopsLeftLambda)) * songLength +
|
||||||
lengthOfOneFile * curFile)
|
lengthOfOneFile * (*curFileLambda))
|
||||||
/ (float)totalLength;
|
/ (float)totalLength;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
ImGui::Text(_("%f"), curProgress);
|
|
||||||
ImGui::ProgressBar(curProgress,ImVec2(-FLT_MIN,0));
|
ImGui::Text(_("Row %d of %d"), curPosInRows +
|
||||||
|
((totalLoops) - (loopsLeft)) * songLength, lengthOfOneFile);
|
||||||
|
|
||||||
|
if(audioExportOptions.mode == DIV_EXPORT_MODE_MANY_CHAN)
|
||||||
|
{
|
||||||
|
ImGui::Text(_("Channel %d of %d"), curFile + 1, totalFiles);
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::ProgressBar(curProgress,ImVec2(-FLT_MIN,0), fmt::sprintf("%.2f%%", curProgress * 100.0f).c_str());
|
||||||
|
|
||||||
if (ImGui::Button(_("Abort"))) {
|
if (ImGui::Button(_("Abort"))) {
|
||||||
if (e->haltAudioFile()) {
|
if (e->haltAudioFile()) {
|
||||||
ImGui::CloseCurrentPopup();
|
ImGui::CloseCurrentPopup();
|
||||||
|
|
|
||||||
|
|
@ -1731,6 +1731,7 @@ class FurnaceGUI {
|
||||||
int lengthOfOneFile; //length of one rendering pass. song length times num of loops + fadeout
|
int lengthOfOneFile; //length of one rendering pass. song length times num of loops + fadeout
|
||||||
int totalLength; //total length of render (lengthOfOneFile times num of files for per-channel export)
|
int totalLength; //total length of render (lengthOfOneFile times num of files for per-channel export)
|
||||||
float curProgress;
|
float curProgress;
|
||||||
|
int totalFiles;
|
||||||
|
|
||||||
struct Settings {
|
struct Settings {
|
||||||
bool settingsChanged;
|
bool settingsChanged;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue