From f5995807f49fee76bd062d1ef189f25769339512 Mon Sep 17 00:00:00 2001 From: xenakios Date: Wed, 28 Feb 2018 14:20:26 +0200 Subject: [PATCH] Add free filter envelope transforms as plugin parameters etc! --- Source/PluginEditor.cpp | 11 +++++------ Source/PluginProcessor.cpp | 5 ++++- Source/PluginProcessor.h | 2 ++ Source/envelope_component.cpp | 10 +++++++++- Source/jcdp_envelope.h | 2 +- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index 21df1de..2c82869 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -252,11 +252,11 @@ void PaulstretchpluginAudioProcessorEditor::resized() m_parcomps[cpi_soundstart]->setBounds(xoffs, yoffs, div - 1, 24); xoffs += div; m_parcomps[cpi_soundend]->setBounds(xoffs, yoffs, div - 1, 24); -#ifdef SOUNDRANGE_OFFSET_ENABLED - yoffs += 25; xoffs = 1; - m_parcomps[cpi_playrangeoffset]->setBounds(xoffs, yoffs, getWidth() - 2, 24); -#endif + yoffs += 25; + m_parcomps[cpi_freefilter_shiftx]->setBounds(xoffs, yoffs, div - 1, 24); + xoffs += div; + m_parcomps[cpi_freefilter_shifty]->setBounds(xoffs, yoffs, div - 1, 24); yoffs += 25; int remain_h = getHeight() - 1 - yoffs; m_spec_order_ed.setBounds(1, yoffs, getWidth() - 2, remain_h / 5 * 1); @@ -316,8 +316,7 @@ void PaulstretchpluginAudioProcessorEditor::timerCallback(int id) } if (id == 3) { - //m_specvis.setState(processor.getStretchSource()->getProcessParameters(), processor.getStretchSource()->getFFTSize() / 2, - // processor.getSampleRate()); + m_free_filter_component.repaint(); } } diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index 2ea0120..4499a05 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -150,7 +150,8 @@ PaulstretchpluginAudioProcessor::PaulstretchpluginAudioProcessor() m_inchansparam = new AudioParameterInt("numinchans0", "Num ins", 2, 8, 2); // 32 addParameter(m_inchansparam); // 32 addParameter(new AudioParameterBool("bypass_stretch0", "Bypass stretch", false)); // 33 - + addParameter(new AudioParameterFloat("freefilter_shiftx_0", "Free filter shift X", -1.0f, 1.0f, 0.0f)); // 34 + addParameter(new AudioParameterFloat("freefilter_shifty_0", "Free filter shift Y", -1.0f, 1.0f, 0.0f)); // 35 auto& pars = getParameters(); for (const auto& p : pars) m_reset_pars.push_back(p->getValue()); @@ -627,6 +628,8 @@ void PaulstretchpluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, M } if (m_play_when_host_plays == true && m_playposinfo.isPlaying == false) return; + m_free_filter_envelope->m_transform_x_shift = *getFloatParameter(cpi_freefilter_shiftx); + m_free_filter_envelope->m_transform_y_shift = *getFloatParameter(cpi_freefilter_shifty); m_stretch_source->setMainVolume(*getFloatParameter(cpi_main_volume)); m_stretch_source->setRate(*getFloatParameter(cpi_stretchamount)); m_stretch_source->setPreviewDry(*getBoolParameter(cpi_bypass_stretch)); diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h index 4814335..ae6c9b0 100644 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -60,6 +60,8 @@ const int cpi_passthrough = 30; const int cpi_markdirty = 31; const int cpi_num_inchans = 32; const int cpi_bypass_stretch = 33; +const int cpi_freefilter_shiftx = 34; +const int cpi_freefilter_shifty = 35; class MyPropertiesFile { diff --git a/Source/envelope_component.cpp b/Source/envelope_component.cpp index a65cff3..8a3d88e 100644 --- a/Source/envelope_component.cpp +++ b/Source/envelope_component.cpp @@ -346,7 +346,15 @@ bool EnvelopeComponent::keyPressed(const KeyPress & ev) repaint(); return true; } - + if (ev == 'A') + { + m_envelope->m_transform_x_shift = 0.0; + m_envelope->m_transform_y_scale = 1.0; + m_envelope->m_transform_y_shift = 0.0; + m_envelope->m_transform_y_sinus = 0.0; + repaint(); + return true; + } if (ev == KeyPress::deleteKey) { diff --git a/Source/jcdp_envelope.h b/Source/jcdp_envelope.h index fc78faf..a804a19 100644 --- a/Source/jcdp_envelope.h +++ b/Source/jcdp_envelope.h @@ -226,7 +226,7 @@ public: { if (state.isValid()==false) return; - int numnodes = state.getNumChildren(); + int numnodes = state.getNumChildren(); if (numnodes > 0) { m_nodes.clear();