more....
This commit is contained in:
parent
c06759b235
commit
0ab9f6c6fd
8 changed files with 163 additions and 239 deletions
120
src/gui/gui.cpp
120
src/gui/gui.cpp
|
|
@ -2589,34 +2589,32 @@ void FurnaceGUI::exportAudio(String path, DivAudioExportModes mode) {
|
|||
int loopEnd=0;
|
||||
e->walkSong(loopOrder,loopRow,loopEnd);
|
||||
|
||||
e->findSongLength(loopOrder, loopRow, audioExportOptions.fadeOut, songFadeoutSectionLength, songHasSongEndCommand, songOrdersLengths, songLength); //for progress estimation
|
||||
e->findSongLength(loopOrder,loopRow,audioExportOptions.fadeOut,songFadeoutSectionLength,songHasSongEndCommand,songOrdersLengths,songLength); // for progress estimation
|
||||
|
||||
songLoopedSectionLength = songLength;
|
||||
for(int i = 0; i < loopOrder; i++)
|
||||
{
|
||||
songLoopedSectionLength -= songOrdersLengths[i];
|
||||
songLoopedSectionLength=songLength;
|
||||
for (int i=0; i<loopOrder; i++) {
|
||||
songLoopedSectionLength-=songOrdersLengths[i];
|
||||
}
|
||||
songLoopedSectionLength -= loopRow;
|
||||
songLoopedSectionLength-=loopRow;
|
||||
|
||||
e->saveAudio(path.c_str(),audioExportOptions);
|
||||
|
||||
totalFiles = 0;
|
||||
totalFiles=0;
|
||||
e->getTotalAudioFiles(totalFiles);
|
||||
int totalLoops = 0;
|
||||
int totalLoops=0;
|
||||
|
||||
lengthOfOneFile = songLength;
|
||||
lengthOfOneFile=songLength;
|
||||
|
||||
if(!songHasSongEndCommand)
|
||||
{
|
||||
if (!songHasSongEndCommand) {
|
||||
e->getTotalLoops(totalLoops);
|
||||
|
||||
lengthOfOneFile += songLoopedSectionLength * totalLoops;
|
||||
lengthOfOneFile += songFadeoutSectionLength; //account for fadeout
|
||||
lengthOfOneFile+=songLoopedSectionLength*totalLoops;
|
||||
lengthOfOneFile+=songFadeoutSectionLength; // account for fadeout
|
||||
}
|
||||
|
||||
totalLength = lengthOfOneFile * totalFiles;
|
||||
totalLength=lengthOfOneFile*totalFiles;
|
||||
|
||||
curProgress = 0.0f;
|
||||
curProgress=0.0f;
|
||||
|
||||
displayExporting=true;
|
||||
}
|
||||
|
|
@ -5861,69 +5859,53 @@ bool FurnaceGUI::loop() {
|
|||
MEASURE_BEGIN(popup);
|
||||
|
||||
centerNextWindow(_("Rendering..."),canvasW,canvasH);
|
||||
if (ImGui::BeginPopupModal(_("Rendering..."),NULL,ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove)) {
|
||||
if (ImGui::BeginPopupModal(_("Rendering..."),NULL,ImGuiWindowFlags_NoResize|ImGuiWindowFlags_NoMove)) {
|
||||
// WHAT the HELL?!
|
||||
WAKE_UP;
|
||||
if(audioExportOptions.mode != DIV_EXPORT_MODE_MANY_CHAN)
|
||||
{
|
||||
if (audioExportOptions.mode!=DIV_EXPORT_MODE_MANY_CHAN) {
|
||||
ImGui::Text(_("Please wait..."));
|
||||
}
|
||||
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())
|
||||
{
|
||||
e->lockEngine([this, progressLambda, curPosInRowsLambda, curFileLambda, loopsLeftLambda, totalLoopsLambda]()
|
||||
{
|
||||
int curRow = 0;
|
||||
int curOrder = 0;
|
||||
e->getCurSongPos(curRow, curOrder);
|
||||
*curFileLambda = 0;
|
||||
e->getCurFileIndex(*curFileLambda);
|
||||
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()) {
|
||||
e->lockEngine([this, progressLambda, curPosInRowsLambda, curFileLambda,
|
||||
loopsLeftLambda, totalLoopsLambda] () {
|
||||
int curRow=0; int curOrder=0;
|
||||
e->getCurSongPos(curRow, curOrder); *curFileLambda=0;
|
||||
e->getCurFileIndex(*curFileLambda);
|
||||
*curPosInRowsLambda=curRow; for (int i=0; i<curOrder;
|
||||
i++) {
|
||||
*curPosInRowsLambda+=songOrdersLengths[i];}
|
||||
|
||||
*curPosInRowsLambda = curRow;
|
||||
|
||||
for(int i = 0; i < curOrder; i++)
|
||||
{
|
||||
*curPosInRowsLambda += songOrdersLengths[i];
|
||||
}
|
||||
|
||||
if(!songHasSongEndCommand)
|
||||
{
|
||||
e->getLoopsLeft(*loopsLeftLambda);
|
||||
e->getTotalLoops(*totalLoopsLambda);
|
||||
|
||||
if((*totalLoopsLambda) != (*loopsLeftLambda)) //we are going 2nd, 3rd, etc. time through the song
|
||||
{
|
||||
*curPosInRowsLambda -= (songLength - songLoopedSectionLength); //a hack so progress bar does not jump?
|
||||
}
|
||||
if(e->getIsFadingOut()) //we are in fadeout??? why it works like that bruh
|
||||
{
|
||||
*curPosInRowsLambda -= (songLength - songLoopedSectionLength); //a hack so progress bar does not jump?
|
||||
}
|
||||
}
|
||||
|
||||
*progressLambda = (float)((*curPosInRowsLambda) +
|
||||
((*totalLoopsLambda) - (*loopsLeftLambda)) * songLength +
|
||||
lengthOfOneFile * (*curFileLambda))
|
||||
/ (float)totalLength;
|
||||
});
|
||||
if (!songHasSongEndCommand) {
|
||||
e->getLoopsLeft(*loopsLeftLambda); e->getTotalLoops(*totalLoopsLambda); if ((*totalLoopsLambda)!=(*loopsLeftLambda)) //we are going 2nd, 3rd, etc. time through the song
|
||||
{
|
||||
*curPosInRowsLambda-=(songLength-songLoopedSectionLength); //a hack so progress bar does not jump?
|
||||
}
|
||||
if (e->getIsFadingOut()) //we are in fadeout??? why it works like that bruh
|
||||
{
|
||||
// LIVE WITH IT damn it
|
||||
*curPosInRowsLambda-=(songLength-songLoopedSectionLength); //a hack so progress bar does not jump?
|
||||
}
|
||||
}
|
||||
// this horrible indentation courtesy of `indent`
|
||||
*progressLambda=(float) ((*curPosInRowsLambda) + ((*totalLoopsLambda)- (*loopsLeftLambda)) * songLength + lengthOfOneFile * (*curFileLambda)) / (float) totalLength;});
|
||||
}
|
||||
|
||||
ImGui::Text(_("Row %d of %d"), curPosInRows +
|
||||
((totalLoops) - (loopsLeft)) * songLength, lengthOfOneFile);
|
||||
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);
|
||||
if (audioExportOptions.mode==DIV_EXPORT_MODE_MANY_CHAN) {
|
||||
ImGui::Text(_("Channel %d of %d"),curFile+1,totalFiles);
|
||||
}
|
||||
|
||||
ImGui::ProgressBar(curProgress,ImVec2(320.0f*dpiScale,0), fmt::sprintf("%.2f%%", curProgress * 100.0f).c_str());
|
||||
ImGui::ProgressBar(curProgress,ImVec2(320.0f*dpiScale,0),fmt::sprintf("%.2f%%",curProgress*100.0f).c_str());
|
||||
|
||||
if (ImGui::Button(_("Abort"))) {
|
||||
if (e->haltAudioFile()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue