diff --git a/src/engine/playback.cpp b/src/engine/playback.cpp index eaf3f7a5e..21733f6bd 100644 --- a/src/engine/playback.cpp +++ b/src/engine/playback.cpp @@ -1860,7 +1860,7 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi output->midiIn->queue.pop(); } - // process audio + // process sample/wave preview if ((sPreview.sample>=0 && sPreview.sample<(int)song.sample.size()) || (sPreview.wave>=0 && sPreview.wave<(int)song.wave.size())) { unsigned int samp_bbOff=0; unsigned int prevAvail=blip_samples_avail(samp_bb); @@ -2007,7 +2007,9 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi memset(samp_bbOut,0,size*sizeof(short)); } - if (playing && !halted) { + // process audio + bool mustPlay=playing && !halted; + if (mustPlay) { // logic starts here for (int i=0; iwait(); } + // process metronome if (metroBufLen1) { for (size_t i=0; i-1 && i>=lastLoopPos && totalLoops>=exportLoopCount) { logD("start fading out..."); isFadingOut=true; + if (fadeOutSamples==0) break; } } } @@ -197,6 +198,7 @@ void DivEngine::runExportThread() { if (lastLoopPos>-1 && j>=lastLoopPos && totalLoops>=exportLoopCount) { logD("start fading out..."); isFadingOut=true; + if (fadeOutSamples==0) break; } } } @@ -239,7 +241,6 @@ void DivEngine::runExportThread() { outBuf[0]=new float[EXPORT_BUFSIZE]; outBuf[1]=new float[EXPORT_BUFSIZE]; outBuf[2]=new float[EXPORT_BUFSIZE*2]; - int loopCount=remainingLoops; logI("rendering to files..."); @@ -281,11 +282,7 @@ void DivEngine::runExportThread() { lastLoopPos=-1; totalLoops=0; isFadingOut=false; - if (exportFadeOut<=0.01) { - remainingLoops=loopCount; - } else { - remainingLoops=-1; - } + remainingLoops=-1; playSub(false); while (playing) { @@ -311,6 +308,7 @@ void DivEngine::runExportThread() { if (lastLoopPos>-1 && j>=lastLoopPos && totalLoops>=exportLoopCount) { logD("start fading out..."); isFadingOut=true; + if (fadeOutSamples==0) break; } } } @@ -399,11 +397,7 @@ bool DivEngine::saveAudio(const char* path, int loops, DivAudioExportModes mode, stop(); repeatPattern=false; setOrder(0); - if (exportFadeOut<=0.01) { - remainingLoops=loops; - } else { - remainingLoops=-1; - } + remainingLoops=-1; if (shallSwitchCores()) { bool isMutedBefore[DIV_MAX_CHANS];