From 7238c71e6699698a1043767689fd58a30fcfccc8 Mon Sep 17 00:00:00 2001 From: xenakios Date: Tue, 19 Dec 2017 00:37:02 +0200 Subject: [PATCH] Detect host offline rendering state and if active, use the stretchsource directly instead of the thread buffered source --- Source/PluginEditor.cpp | 2 ++ Source/PluginProcessor.cpp | 10 ++++++++-- Source/PluginProcessor.h | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index 84c0afc..8b989e6 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -118,6 +118,8 @@ void PaulstretchpluginAudioProcessorEditor::timerCallback(int id) String(processor.getStretchSource()->getFFTSize()); if (processor.m_abnormal_output_samples > 0) infotext += " " + String(processor.m_abnormal_output_samples) + " invalid sample values"; + if (processor.isNonRealtime()) + infotext += " (offline rendering)"; m_info_label.setText(infotext, dontSendNotification); } if (id == 2) diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index caa7dfe..a3f872b 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -413,9 +413,15 @@ void PaulstretchpluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, M m_stretch_source->setFreezing(getParameter(cpi_freeze)); m_stretch_source->setPaused(getParameter(cpi_pause_enabled)); m_stretch_source->setProcessParameters(&m_ppar); - AudioSourceChannelInfo aif(buffer); - m_buffering_source->getNextAudioBlock(aif); + if (isNonRealtime()) + { + m_stretch_source->getNextAudioBlock(aif); + } + else + { + m_buffering_source->getNextAudioBlock(aif); + } for (int i = 0; i < buffer.getNumChannels(); ++i) { for (int j = 0; j < buffer.getNumSamples(); ++j) diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h index 91144ac..3ae0550 100644 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -111,6 +111,7 @@ public: void timerCallback(int id) override; double getSampleRateChecked(); int m_abnormal_output_samples = 0; + private: