fix audio export not aborting in per-channel mode

This commit is contained in:
tildearrow 2022-04-14 02:26:47 -05:00
parent cc1933dcbb
commit 9795bca2ca
2 changed files with 18 additions and 0 deletions

View File

@ -402,6 +402,8 @@ void DivEngine::runExportThread() {
}
i--;
}
if (stopExport) break;
}
exporting=false;
@ -429,12 +431,25 @@ void DivEngine::runExportThread() {
break;
}
}
stopExport=false;
}
bool DivEngine::saveAudio(const char* path, int loops, DivAudioExportModes mode) {
exportPath=path;
exportMode=mode;
if (exportMode!=DIV_EXPORT_MODE_ONE) {
// remove extension
String lowerCase=exportPath;
for (char& i: lowerCase) {
if (i>='A' && i<='Z') i+='a'-'A';
}
size_t extPos=lowerCase.rfind(".wav");
if (extPos!=String::npos) {
exportPath=exportPath.substr(0,extPos);
}
}
exporting=true;
stopExport=false;
stop();
repeatPattern=false;
setOrder(0);
@ -450,6 +465,7 @@ void DivEngine::waitAudioFile() {
}
bool DivEngine::haltAudioFile() {
stopExport=true;
stop();
return true;
}

View File

@ -194,6 +194,7 @@ class DivEngine {
bool repeatPattern;
bool metronome;
bool exporting;
bool stopExport;
bool halted;
bool forceMono;
bool cmdStreamEnabled;
@ -736,6 +737,7 @@ class DivEngine {
repeatPattern(false),
metronome(false),
exporting(false),
stopExport(false),
halted(false),
forceMono(false),
cmdStreamEnabled(false),