diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp index 4c1df9f7a..f3484b902 100644 --- a/src/engine/engine.cpp +++ b/src/engine/engine.cpp @@ -822,10 +822,6 @@ void DivEngine::runExportThread() { size_t curFadeOutSample=0; bool isFadingOut=false; - quitDispatch(); - initDispatch(true); - renderSamples(); - switch (exportMode) { case DIV_EXPORT_MODE_ONE: { SNDFILE* sf; @@ -838,9 +834,6 @@ void DivEngine::runExportThread() { sf=sfWrap.doOpen(exportPath.c_str(),SFM_WRITE,&si); if (sf==NULL) { logE("could not open file for writing! (%s)",sf_strerror(NULL)); - quitDispatch(); - initDispatch(false); - renderSamples(); exporting=false; return; } @@ -1153,9 +1146,6 @@ void DivEngine::runExportThread() { } } - quitDispatch(); - initDispatch(false); - renderSamples(); stopExport=false; } #else @@ -1163,6 +1153,11 @@ void DivEngine::runExportThread() { } #endif +bool DivEngine::shallSwitchCores() { + // TODO: detect whether we should + return true; +} + bool DivEngine::saveAudio(const char* path, int loops, DivAudioExportModes mode, double fadeOutTime) { #ifndef HAVE_SNDFILE logE("Furnace was not compiled with libsndfile. cannot export!"); @@ -1192,6 +1187,20 @@ bool DivEngine::saveAudio(const char* path, int loops, DivAudioExportModes mode, } else { remainingLoops=-1; } + + if (shallSwitchCores()) { + bool isMutedBefore[DIV_MAX_CHANS]; + memcpy(isMutedBefore,isMuted,DIV_MAX_CHANS*sizeof(bool)); + quitDispatch(); + initDispatch(true); + renderSamplesP(); + for (int i=0; iisExporting()) { + e->finishAudioFile(); ImGui::CloseCurrentPopup(); } ImGui::EndPopup();