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...

This commit is contained in:
xenakios 2017-11-15 21:47:26 +02:00
parent 4620ba818e
commit c283d719d0
2 changed files with 4 additions and 2 deletions

View File

@ -146,12 +146,13 @@ public:
void setAudioBuffer(AudioBuffer<float>* buf, int samplerate, int len);
void beginAddingAudioBlocks(int channels, int samplerate, int totalllen);
void addAudioBlock(AudioBuffer<float>& buf, int samplerate, int pos);
WaveformComponent m_wavecomponent;
private:
PaulstretchpluginAudioProcessor& processor;
std::vector<std::shared_ptr<ParameterComponent>> 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)
};

View File

@ -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);
});