From 2d6dce95726441a27b2a7a2dfadff38b3462625f Mon Sep 17 00:00:00 2001 From: xenakios Date: Fri, 29 Jun 2018 14:23:48 +0300 Subject: [PATCH] Initial work to move the free filter parameter components to the free gilter tab page --- Source/PluginEditor.cpp | 16 +++++++++++++--- Source/PluginEditor.h | 14 +++++++++++++- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index 7e7bfd2..eb4f7b2 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -30,13 +30,13 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor(Pau m_free_filter_component(p.getStretchSource()->getMutex()) { m_wave_container = new Component; - m_free_filter_component.set_envelope(processor.m_free_filter_envelope); - m_free_filter_component.TimeFromNormalized = [this](double x) + m_free_filter_component.getEnvelopeComponent()->set_envelope(processor.m_free_filter_envelope); + m_free_filter_component.getEnvelopeComponent()->TimeFromNormalized = [this](double x) { //return jmap(pow(x, 3.0), 0.0, 1.0, 30.0, processor.getSampleRateChecked()/2.0); return 30.0*pow(1.05946309436, x*115.0); }; - m_free_filter_component.ValueFromNormalized = [this](double x) + m_free_filter_component.getEnvelopeComponent()->ValueFromNormalized = [this](double x) { return jmap(x, 0.0, 1.0, -48.0, 12.0); }; @@ -1511,3 +1511,13 @@ void RatioMixerEditor::paint(Graphics & g) for (int i = 0; i < 8; ++i) g.drawText(String(i + 1), slidw / 2 + slidw * i - 8, 1, 15, 15, Justification::centred); } + +FreeFilterComponent::FreeFilterComponent(CriticalSection* cs) : m_env(cs), m_cs(cs) +{ + addAndMakeVisible(m_env); +} + +void FreeFilterComponent::resized() +{ + m_env.setBounds(200, 0, getWidth() - 200, getHeight()); +} diff --git a/Source/PluginEditor.h b/Source/PluginEditor.h index bb92ace..8cdcfdf 100644 --- a/Source/PluginEditor.h +++ b/Source/PluginEditor.h @@ -230,6 +230,18 @@ private: uptrvec m_ratio_level_sliders; }; +class FreeFilterComponent : public Component +{ +public: + FreeFilterComponent(CriticalSection* cs); + void resized() override; + EnvelopeComponent* getEnvelopeComponent() { return &m_env; } +private: + EnvelopeComponent m_env; + uptrvec m_parcomps; + CriticalSection* m_cs = nullptr; +}; + class PaulstretchpluginAudioProcessorEditor : public AudioProcessorEditor, public MultiTimer, public FileDragAndDropTarget, public DragAndDropContainer { @@ -263,7 +275,7 @@ private: String m_last_err; zoom_scrollbar m_zs; RatioMixerEditor m_ratiomixeditor{ 8 }; - EnvelopeComponent m_free_filter_component; + FreeFilterComponent m_free_filter_component; TabbedComponent m_wavefilter_tab; Component* m_wave_container=nullptr; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessorEditor)