From cf9b54d19b538edd142e7046cc46eefdf63e691a Mon Sep 17 00:00:00 2001 From: xenakios Date: Tue, 27 Feb 2018 02:33:41 +0200 Subject: [PATCH] Initial work to add back the free filter feature --- Source/PluginEditor.cpp | 32 +++++++++++++++++++++++--------- Source/PluginEditor.h | 3 +++ Source/PluginProcessor.cpp | 5 ++++- Source/PluginProcessor.h | 2 ++ Source/envelope_component.cpp | 20 ++++++++++++++++++++ Source/envelope_component.h | 20 ++++++++++++++++++++ paulstretchplugin.jucer | 1 + 7 files changed, 73 insertions(+), 10 deletions(-) diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index 1519251..7eedc3e 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -28,10 +28,15 @@ extern String g_plugintitle; PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor(PaulstretchpluginAudioProcessor& p) : AudioProcessorEditor(&p), m_wavecomponent(p.m_afm,p.m_thumb.get()), - processor(p), m_perfmeter(&p) + processor(p), m_perfmeter(&p), + m_wavefilter_tab(TabbedButtonBar::TabsAtTop) { - addAndMakeVisible(&m_perfmeter); + //addAndMakeVisible(&m_free_filter_component); + m_free_filter_component.set_envelope(processor.m_free_filter_envelope); + m_wavefilter_tab.setTabBarDepth(17); + + addAndMakeVisible(&m_perfmeter); addAndMakeVisible(&m_import_button); m_import_button.setButtonText("Import file..."); @@ -45,8 +50,11 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor(Pau m_info_label.setJustificationType(Justification::centredRight); m_wavecomponent.GetFileCallback = [this]() { return processor.getAudioFile(); }; - addAndMakeVisible(&m_wavecomponent); - const auto& pars = processor.getParameters(); + //addAndMakeVisible(&m_wavecomponent); + + + + const auto& pars = processor.getParameters(); for (int i=0;i(pars[i]); @@ -86,7 +94,7 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor(Pau processor.m_wave_view_range = r; }; m_zs.setRange(processor.m_wave_view_range, true); - setSize (1000, 30+(pars.size()/2)*25+200+15); + m_wavecomponent.TimeSelectionChangedCallback = [this](Range range, int which) { *processor.getFloatParameter(cpi_soundstart) = range.getStart(); @@ -118,7 +126,12 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor(Pau { processor.setDirty(); }; - startTimer(1, 100); + m_wavefilter_tab.addTab("Waveform", Colours::white, &m_wavecomponent, false); + m_wavefilter_tab.addTab("Free filter", Colours::white, &m_free_filter_component, false); + + addAndMakeVisible(&m_wavefilter_tab); + setSize (1000, 30+(pars.size()/2)*25+200+15); + startTimer(1, 100); startTimer(2, 1000); startTimer(3, 200); m_wavecomponent.startTimer(100); @@ -240,9 +253,10 @@ void PaulstretchpluginAudioProcessorEditor::resized() yoffs += 25; int remain_h = getHeight() - 1 - yoffs -15; m_spec_order_ed.setBounds(1, yoffs, getWidth() - 2, remain_h / 5 * 1); - m_wavecomponent.setBounds(1, m_spec_order_ed.getBottom()+1, getWidth()-2, remain_h/5*4); - m_zs.setBounds(1, m_wavecomponent.getBottom(), getWidth() - 2, 16); - //m_specvis.setBounds(1, yoffs, getWidth() - 2, getHeight() - 1 - yoffs); + //m_wavecomponent.setBounds(1, m_spec_order_ed.getBottom()+1, getWidth()-2, remain_h/5*4); + + m_wavefilter_tab.setBounds(1, m_spec_order_ed.getBottom()+1, getWidth()-2, remain_h/5*4); + m_zs.setBounds(1, m_wavefilter_tab.getBottom(), getWidth() - 2, 16); } void PaulstretchpluginAudioProcessorEditor::timerCallback(int id) diff --git a/Source/PluginEditor.h b/Source/PluginEditor.h index 0c1fc4a..2a701fe 100644 --- a/Source/PluginEditor.h +++ b/Source/PluginEditor.h @@ -24,6 +24,7 @@ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "PluginProcessor.h" #include #include +#include "envelope_component.h" class zoom_scrollbar : public Component { @@ -229,6 +230,8 @@ private: void showSettingsMenu(); String m_last_err; zoom_scrollbar m_zs; + EnvelopeComponent m_free_filter_component; + TabbedComponent m_wavefilter_tab; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessorEditor) }; diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index 6509cd2..7f9d79e 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -80,7 +80,10 @@ PaulstretchpluginAudioProcessor::PaulstretchpluginAudioProcessor() g_activeprocessors.insert(this); m_playposinfo.timeInSeconds = 0.0; - m_recbuffer.setSize(2, 44100); + + m_free_filter_envelope = std::make_shared(); + + m_recbuffer.setSize(2, 44100); m_recbuffer.clear(); if (m_afm->getNumKnownFormats()==0) m_afm->registerBasicFormats(); diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h index f2ec440..e533d1d 100644 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -22,6 +22,7 @@ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "../JuceLibraryCode/JuceHeader.h" #include "PS_Source/PaulStretchControl.h" +#include "jcdp_envelope.h" class MyThumbCache; @@ -169,6 +170,7 @@ public: bool m_show_technical_info = false; Range m_wave_view_range; int m_prepare_count = 0; + std::shared_ptr m_free_filter_envelope; private: diff --git a/Source/envelope_component.cpp b/Source/envelope_component.cpp index 94ede99..edfe4b3 100644 --- a/Source/envelope_component.cpp +++ b/Source/envelope_component.cpp @@ -1,3 +1,23 @@ +/* + Copyright (C) 2006-2011 Nasca Octavian Paul + Author: Nasca Octavian Paul + + Copyright (C) 2017 Xenakios + + This program is free software; you can redistribute it and/or modify + it under the terms of version 2 of the GNU General Public License + as published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License (version 2) for more details. + + You should have received a copy of the GNU General Public License (version 2) + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #include "envelope_component.h" EnvelopeComponent::EnvelopeComponent() diff --git a/Source/envelope_component.h b/Source/envelope_component.h index 2219bd6..0bc95b5 100644 --- a/Source/envelope_component.h +++ b/Source/envelope_component.h @@ -1,3 +1,23 @@ +/* + Copyright (C) 2006-2011 Nasca Octavian Paul + Author: Nasca Octavian Paul + + Copyright (C) 2017 Xenakios + + This program is free software; you can redistribute it and/or modify + it under the terms of version 2 of the GNU General Public License + as published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License (version 2) for more details. + + You should have received a copy of the GNU General Public License (version 2) + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #pragma once #include "../JuceLibraryCode/JuceHeader.h" diff --git a/paulstretchplugin.jucer b/paulstretchplugin.jucer index f5b5f53..7e47189 100644 --- a/paulstretchplugin.jucer +++ b/paulstretchplugin.jucer @@ -19,6 +19,7 @@ file="Source/envelope_component.cpp"/> +