From c283d719d0f1f1142cb63107408d59f309f0e31f Mon Sep 17 00:00:00 2001 From: xenakios Date: Wed, 15 Nov 2017 21:47:26 +0200 Subject: [PATCH] Update waveform component time selection when state restored. Should probably restructure all this stuff so that the GUI can ask for this stuff when it wants, instead of the AudioProcessor making calls into the GUI... --- Source/PluginEditor.h | 3 ++- Source/PluginProcessor.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/PluginEditor.h b/Source/PluginEditor.h index d07a6c6..d0ce6eb 100644 --- a/Source/PluginEditor.h +++ b/Source/PluginEditor.h @@ -146,12 +146,13 @@ public: void setAudioBuffer(AudioBuffer* buf, int samplerate, int len); void beginAddingAudioBlocks(int channels, int samplerate, int totalllen); void addAudioBlock(AudioBuffer& buf, int samplerate, int pos); + WaveformComponent m_wavecomponent; private: PaulstretchpluginAudioProcessor& processor; std::vector> m_parcomps; ToggleButton m_rec_enable; TextButton m_import_button; Label m_info_label; - WaveformComponent m_wavecomponent; + JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessorEditor) }; diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index 16e670f..cb17345 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -275,9 +275,10 @@ void PaulstretchpluginAudioProcessor::setStateInformation (const void* data, int setAudioFile(f); Timer::callAfterDelay(500, [this,f]() { - callGUI([f](PaulstretchpluginAudioProcessorEditor* ed) + callGUI([f,this](PaulstretchpluginAudioProcessorEditor* ed) { ed->setAudioFile(f); + ed->m_wavecomponent.setTimeSelection({ *getFloatParameter(5),*getFloatParameter(6) }); }, false); });