Merge branch 'tildearrow:master' into opz-per-operator-arp-and-pitch-macros-and-more

This commit is contained in:
LTVA1 2024-08-25 17:28:07 +03:00 committed by GitHub
commit 570587693e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 305 additions and 314 deletions

View file

@ -302,6 +302,7 @@ const char* aboutLine[]={
_N("NDS sound emulator by cam900"),
"",
_N("greetings to:"),
"floxy!",
"NEOART Costa Rica",
"Xenium Demoparty",
"@party",

View file

@ -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()) {

View file

@ -1723,13 +1723,13 @@ class FurnaceGUI {
char emptyLabel[32];
char emptyLabel2[32];
std::vector<int> songOrdersLengths; //lengths of all orders (for drawing song export progress)
int songLength; //length of all the song in rows
int songLoopedSectionLength; //length of looped part of the song
int songFadeoutSectionLength; //length of fading part of the song
bool songHasSongEndCommand; //song has "Song end" command (FFxx)
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)
std::vector<int> songOrdersLengths; // lengths of all orders (for drawing song export progress)
int songLength; // length of all the song in rows
int songLoopedSectionLength; // length of looped part of the song
int songFadeoutSectionLength; // length of fading part of the song
bool songHasSongEndCommand; // song has "Song end" command (FFxx)
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)
float curProgress;
int totalFiles;

View file

@ -253,16 +253,27 @@ void FurnaceGUI::drawSampleEdit() {
SAMPLE_WARN(warnLength,"QSound: maximum sample length is 65535");
}
break;
case DIV_SYSTEM_NES:
case DIV_SYSTEM_NES: {
if (sample->loop) {
if (sample->loopStart!=0 || sample->loopEnd!=(int)(sample->samples)) {
SAMPLE_WARN(warnLoopPos,_("NES: loop point ignored on DPCM (may only loop entire sample)"));
if (sample->loopStart&511) {
int tryWith=(sample->loopStart)&(~511);
if (tryWith>(int)sample->samples) tryWith-=512;
String alignHint=fmt::sprintf(_("NES: loop start must be a multiple of 512 (try with %d)"),tryWith);
SAMPLE_WARN(warnLoopStart,alignHint);
}
if ((sample->loopEnd-8)&127) {
int tryWith=(sample->loopEnd-8)&(~127);
if (tryWith>(int)sample->samples) tryWith-=128;
tryWith+=8; // +1 bc of how sample length is treated: https://www.nesdev.org/wiki/APU_DMC
String alignHint=fmt::sprintf(_("NES: loop end must be a multiple of 128 (try with %d)"),tryWith);
SAMPLE_WARN(warnLoopEnd,alignHint);
}
}
if (sample->samples>32648) {
SAMPLE_WARN(warnLength,_("NES: maximum DPCM sample length is 32648"));
}
break;
}
case DIV_SYSTEM_X1_010:
if (sample->loop) {
SAMPLE_WARN(warnLoop,_("X1-010: samples can't loop"));