diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index 7f93b0c..a622d3b 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -504,7 +504,7 @@ String PaulstretchpluginAudioProcessor::offlineRender(File outputfile) auto rendertask = [ss,writer,blocksize,numoutchans, outsr, this]() { AudioBuffer renderbuffer(numoutchans, blocksize); - int64_t outlen = 250 * outsr; + int64_t outlen = 10 * outsr; int64_t outcounter = 0; AudioSourceChannelInfo asci(renderbuffer); m_offline_render_state = 0; @@ -661,6 +661,9 @@ void PaulstretchpluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, M copyAudioBufferWrappingPosition(buffer, m_recbuffer, m_rec_pos, recbuflenframes); m_thumb->addBlock(m_rec_pos, buffer, 0, buffer.getNumSamples()); m_rec_pos = (m_rec_pos + buffer.getNumSamples()) % recbuflenframes; + m_rec_count += buffer.getNumSamples(); + if (m_rec_countreset(m_recbuffer.getNumChannels(), getSampleRateChecked(), lenbufframes); m_is_recording = true; + m_recorded_range = Range(); + m_rec_count = 0; } else { @@ -918,7 +923,8 @@ void PaulstretchpluginAudioProcessor::finishRecording(int lenrecording) { m_is_recording = false; m_stretch_source->setAudioBufferAsInputSource(&m_recbuffer, getSampleRateChecked(), lenrecording); - m_stretch_source->setPlayRange({ *getFloatParameter(cpi_soundstart),*getFloatParameter(cpi_soundend) }); + *getFloatParameter(cpi_soundstart) = 0.0f; + *getFloatParameter(cpi_soundend) = jlimit(0.01, 1.0, 1.0 / lenrecording * m_rec_count); } AudioProcessor* JUCE_CALLTYPE createPluginFilter() diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h index 2ebf02f..3a62012 100644 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -222,6 +222,8 @@ private: double m_max_reclen = 10.0; bool m_is_recording = false; int m_rec_pos = 0; + int m_rec_count = 0; + Range m_recorded_range; void finishRecording(int lenrecorded); bool m_using_memory_buffer = true; int m_cur_num_out_chans = 2; diff --git a/Source/RenderSettingsComponent.cpp b/Source/RenderSettingsComponent.cpp index 2848a7e..aec7187 100644 --- a/Source/RenderSettingsComponent.cpp +++ b/Source/RenderSettingsComponent.cpp @@ -167,6 +167,7 @@ void RenderSettingsComponent::buttonClicked (Button* buttonThatWasClicked) sampleRate = 0; double maxrenderlen = m_editorMaxOutDuration.getText().getDoubleValue()*3600.0; maxrenderlen = jlimit(1.0, 1000000.0, maxrenderlen); + m_proc->offlineRender(File(outfileNameEditor.getText())); //m_main->renderToFile(File(outfileNameEditor.getText()),numLoops, // comboBoxBitDepth.getSelectedId()-1,sampleRate,m_toggleFloatClip.getToggleState(),maxrenderlen); auto pardlg = dynamic_cast(getParentComponent());