From 572b1d251534e912b5a8d91fb3550e21a51517cf Mon Sep 17 00:00:00 2001 From: xenakios Date: Tue, 12 Dec 2017 19:14:43 +0200 Subject: [PATCH] Added more parameters. Added int constants for parameter indexes. Initial work to do GUI layout with Javascript. Disabled spectrum visualizer for now. --- Source/PluginEditor.cpp | 10 +++++----- Source/PluginEditor.h | 18 ++++++++++++++++++ Source/PluginProcessor.cpp | 9 +++++++++ Source/PluginProcessor.h | 25 +++++++++++++++++++++++++ 4 files changed, 57 insertions(+), 5 deletions(-) diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index b71d408..eba73c6 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -42,7 +42,7 @@ PaulstretchpluginAudioProcessorEditor::PaulstretchpluginAudioProcessorEditor (Pa addAndMakeVisible(&m_rec_enable); m_rec_enable.setButtonText("Capture"); attachCallback(m_rec_enable, [this]() { processor.setRecordingEnabled(m_rec_enable.getToggleState()); }); - addAndMakeVisible(&m_specvis); + //addAndMakeVisible(&m_specvis); setSize (700, 30+pars.size()*25+200); m_wavecomponent.TimeSelectionChangedCallback = [this](Range range, int which) { @@ -83,8 +83,8 @@ void PaulstretchpluginAudioProcessorEditor::resized() m_parcomps[i]->setBounds(1, 30 + i * 25, getWidth()-2, 24); } int yoffs = m_parcomps.back()->getBottom() + 1; - //m_wavecomponent.setBounds(1, yoffs, getWidth()-2, getHeight()-1-yoffs); - m_specvis.setBounds(1, yoffs, getWidth() - 2, getHeight() - 1 - yoffs); + m_wavecomponent.setBounds(1, yoffs, getWidth()-2, getHeight()-1-yoffs); + //m_specvis.setBounds(1, yoffs, getWidth() - 2, getHeight() - 1 - yoffs); } void PaulstretchpluginAudioProcessorEditor::timerCallback(int id) @@ -114,8 +114,8 @@ void PaulstretchpluginAudioProcessorEditor::timerCallback(int id) } if (id == 3) { - m_specvis.setState(processor.getStretchSource()->getProcessParameters(), processor.getStretchSource()->getFFTSize() / 2, - processor.getSampleRate()); + //m_specvis.setState(processor.getStretchSource()->getProcessParameters(), processor.getStretchSource()->getFFTSize() / 2, + // processor.getSampleRate()); } } diff --git a/Source/PluginEditor.h b/Source/PluginEditor.h index 4bb9e58..f98175d 100644 --- a/Source/PluginEditor.h +++ b/Source/PluginEditor.h @@ -237,6 +237,22 @@ private: bool m_lock_timesel_set = false; }; +class MyDynamicObject : public DynamicObject +{ +public: + bool hasMethod(const Identifier& methodName) const override + { + if (methodName == Identifier("setLabelBounds") || + methodName == Identifier("setComponentBounds")) + return true; + return false; + } + var invokeMethod(Identifier methodName, + const var::NativeFunctionArgs& args) override + { + return var(); + } +}; class PaulstretchpluginAudioProcessorEditor : public AudioProcessorEditor, public MultiTimer @@ -260,6 +276,8 @@ private: TextButton m_import_button; Label m_info_label; void chooseFile(); + JavascriptEngine m_js_engine; + MyDynamicObject m_js_object; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessorEditor) }; diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index 06357b6..d00a46b 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -99,6 +99,15 @@ PaulstretchpluginAudioProcessor::PaulstretchpluginAudioProcessor() addParameter(new AudioParameterFloat("loopxfadelen0", "Loop xfade length", 0.0f, 1.0f, 0.0f)); // 10 addParameter(new AudioParameterFloat("numharmonics0", "Num harmonics", 0.0f, 100.0f, 0.0f)); // 11 addParameter(new AudioParameterFloat("harmonicsfreq0", "Harmonics base freq", 1.0f, 5000.0f, 100.0f)); // 12 + addParameter(new AudioParameterFloat("harmonicsbw0", "Harmonics bandwidth", 0.1f, 200.0f, 25.0f)); // 13 + addParameter(new AudioParameterBool("harmonicsgauss0", "Gaussian harmonics", false)); // 14 + addParameter(new AudioParameterFloat("octavemixm2_0", "2 octaves down level", 0.0f, 1.0f, 0.0f)); // 15 + addParameter(new AudioParameterFloat("octavemixm1_0", "Octave down level", 0.0f, 1.0f, 0.0f)); // 16 + addParameter(new AudioParameterFloat("octavemix0_0", "Normal pitch level", 0.0f, 1.0f, 0.0f)); // 17 + addParameter(new AudioParameterFloat("octavemix1_0", "1 octave up level", 0.0f, 1.0f, 0.0f)); // 18 + addParameter(new AudioParameterFloat("octavemix15_0", "1 octave and fifth up level", 0.0f, 1.0f, 0.0f)); // 19 + addParameter(new AudioParameterFloat("octavemix2_0", "2 octaves up level", 0.0f, 1.0f, 0.0f)); // 20 + } PaulstretchpluginAudioProcessor::~PaulstretchpluginAudioProcessor() diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h index 25094d6..a0c9c03 100644 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -15,6 +15,31 @@ class MyThumbCache; +const int cpi_main_volume = 0; +const int cpi_stretchamount = 1; +const int cpi_fftsize = 2; +const int cpi_pitchshift = 3; +const int cpi_frequencyshift = 4; +const int cpi_soundstart = 5; +const int cpi_soundend = 6; +const int cpi_freeze = 7; +const int cpi_spreadamount = 8; +const int cpi_compress = 9; +const int cpi_loopxfadelen = 10; +const int cpi_numharmonics = 11; +const int cpi_harmonicsfreq = 12; +const int cpi_harmonicsbw = 13; +const int cpi_harmonicsgauss = 14; +const int cpi_octavesm2 = 15; +const int cpi_octavesm1 = 16; +const int cpi_octaves0 = 17; +const int cpi_octaves1 = 18; +const int cpi_octaves15 = 19; +const int cpi_octaves2 = 20; +const int cpi_tonalvsnoisebw = 21; +const int cpi_tonalvsnoisepreserve = 22; +const int cpi_filter_low = 23; +const int cpi_filter_high = 24; class PaulstretchpluginAudioProcessor : public AudioProcessor {