Render exact calculated output length. But release build isn't working...Sigh.

This commit is contained in:
xenakios 2019-03-29 23:27:08 +02:00
parent 727f0e19ec
commit 288ab7a6bc

View File

@ -578,10 +578,7 @@ String PaulstretchpluginAudioProcessor::offlineRender(OfflineRenderParams render
{ {
WavAudioFormat wavformat; WavAudioFormat wavformat;
FileOutputStream* outstream = outputfiletouse.createOutputStream(); FileOutputStream* outstream = outputfiletouse.createOutputStream();
if (outstream == nullptr) jassert(outstream != nullptr);
{
jassert(false);
}
int oformattouse{ 16 }; int oformattouse{ 16 };
bool clipoutput{ false }; bool clipoutput{ false };
if (renderpars.outputformat == 1) if (renderpars.outputformat == 1)
@ -602,8 +599,6 @@ String PaulstretchpluginAudioProcessor::offlineRender(OfflineRenderParams render
} }
AudioBuffer<float> renderbuffer{ numoutchans, blocksize }; AudioBuffer<float> renderbuffer{ numoutchans, blocksize };
MidiBuffer dummymidi; MidiBuffer dummymidi;
double outlensecs = sc->getOutputDurationSecondsForRange(sc->getPlayRange(),sc->getFFTSize()); double outlensecs = sc->getOutputDurationSecondsForRange(sc->getPlayRange(),sc->getFFTSize());
int64_t outlenframes = outlensecs * outsr; int64_t outlenframes = outlensecs * outsr;
int64_t outcounter{ 0 }; int64_t outcounter{ 0 };
@ -615,7 +610,8 @@ String PaulstretchpluginAudioProcessor::offlineRender(OfflineRenderParams render
if (m_offline_render_cancel_requested == true) if (m_offline_render_cancel_requested == true)
break; break;
processor->processBlock(renderbuffer, dummymidi); processor->processBlock(renderbuffer, dummymidi);
writer->writeFromAudioSampleBuffer(renderbuffer, 0, blocksize); int64 framesToWrite = std::min<int64>(blocksize, outlenframes - outcounter);
writer->writeFromAudioSampleBuffer(renderbuffer, 0, framesToWrite);
outcounter += blocksize; outcounter += blocksize;
m_offline_render_state = 100.0 / outlenframes * outcounter; m_offline_render_state = 100.0 / outlenframes * outcounter;
} }