From 793279a20a6b756e7ecf80d57afb3cfdcc8dcbde Mon Sep 17 00:00:00 2001 From: xenakios Date: Mon, 13 Nov 2017 19:41:47 +0200 Subject: [PATCH] Crashing was probably because of wrongly placed prepareToPlay call --- Source/PS_Source/PaulStretchControl.cpp | 8 ++++---- Source/PluginProcessor.cpp | 1 + paulstretchplugin.jucer | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Source/PS_Source/PaulStretchControl.cpp b/Source/PS_Source/PaulStretchControl.cpp index a581ae3..d1528ba 100644 --- a/Source/PS_Source/PaulStretchControl.cpp +++ b/Source/PS_Source/PaulStretchControl.cpp @@ -134,8 +134,9 @@ void Control::set_input_file(File file, std::function cb) }; }; - std::thread th(task); - th.detach(); + //std::thread th(task); + //th.detach(); + task(); }; String Control::get_input_filename(){ @@ -285,13 +286,12 @@ void Control::startplay(bool /*bypass*/, bool /*realtime*/, Range playra } if (m_bufferingthread.isThreadRunning() == false) m_bufferingthread.startThread(); - m_buffering_source->prepareToPlay(1024, 44100.0); m_stretch_source->setNumOutChannels(numoutchans); m_stretch_source->setFFTSize(m_fft_size_to_use); update_process_parameters(); m_last_outpos_pos = 0.0; m_last_in_pos = playrange.getStart()*m_stretch_source->getInfileLengthSeconds(); - + m_buffering_source->prepareToPlay(1024, 44100.0); // sleep(100); diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index 50cd872..e3c8603 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -37,6 +37,7 @@ PaulstretchpluginAudioProcessor::PaulstretchpluginAudioProcessor() PaulstretchpluginAudioProcessor::~PaulstretchpluginAudioProcessor() { + m_control->stopplay(); } //============================================================================== diff --git a/paulstretchplugin.jucer b/paulstretchplugin.jucer index 58bece0..39a3023 100644 --- a/paulstretchplugin.jucer +++ b/paulstretchplugin.jucer @@ -84,7 +84,7 @@ headerPath="Source/PS_Source Source/WDL " vstBinaryLocation="C:\Program Files\VSTPlugins"/>