diff --git a/Source/PS_Source/StretchSource.cpp b/Source/PS_Source/StretchSource.cpp index c4c71a6..3f4dd1f 100644 --- a/Source/PS_Source/StretchSource.cpp +++ b/Source/PS_Source/StretchSource.cpp @@ -159,6 +159,35 @@ void StretchAudioSource::setMainVolume(double decibels) } } +void StretchAudioSource::setSpectralModulesEnabled(const std::array& params) +{ + jassert(params.size() == m_specproc_order.size()); + bool changed = false; + for (int i = 0; i < m_specproc_order.size(); ++i) + { + if (*params[i] != m_specproc_order[i].m_enabled) + { + changed = true; + break; + } + } + if (changed == false) + return; + if (m_cs.tryEnter()) + { + for (int i = 0; i < m_specproc_order.size(); ++i) + { + m_specproc_order[i].m_enabled = *params[i]; + } + for (int i = 0; i < m_stretchers.size(); ++i) + { + m_stretchers[i]->m_spectrum_processes = m_specproc_order; + } + ++m_param_change_count; + m_cs.exit(); + } +} + void StretchAudioSource::setLoopXFadeLength(double lenseconds) { if (lenseconds == m_loopxfadelen) diff --git a/Source/PS_Source/StretchSource.h b/Source/PS_Source/StretchSource.h index 1a642f2..d1b1dd2 100644 --- a/Source/PS_Source/StretchSource.h +++ b/Source/PS_Source/StretchSource.h @@ -24,6 +24,7 @@ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "Input/AInputS.h" #include "ProcessedStretch.h" #include +#include #include "../WDL/resample.h" class StretchAudioSource final : public PositionableAudioSource @@ -98,6 +99,7 @@ public: void setAudioBufferAsInputSource(AudioBuffer* buf, int sr, int len); void setMainVolume(double decibels); double getMainVolume() const { return m_main_volume; } + void setSpectralModulesEnabled(const std::array& params); void setLoopXFadeLength(double lenseconds); double getLoopXFadeLengtj() const { return m_loopxfadelen; } void setPreviewDry(bool b); diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index 546a45f..d39a3fe 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -354,9 +354,6 @@ void PaulstretchpluginAudioProcessorEditor::timerCallback(int id) } if (id == 3) { - m_spec_order_ed.setModuleSelected(*processor.getIntParameter(cpi_select_spec_module)); - m_spec_order_ed.moveModule(*processor.getIntParameter(cpi_select_spec_module), * - processor.getIntParameter(cpi_move_spec_module)); processor.m_free_filter_envelope->updateMinMaxValues(); m_free_filter_component.repaint(); } diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index f2fda4a..f4d69a9 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -157,8 +157,11 @@ PaulstretchpluginAudioProcessor::PaulstretchpluginAudioProcessor() addParameter(new AudioParameterInt("freefilter_randomybands0", "Random bands", 2, 128, 16)); // 38 addParameter(new AudioParameterInt("freefilter_randomyrate0", "Random rate", 1, 32, 2)); // 39 addParameter(new AudioParameterFloat("freefilter_randomyamount0", "Random amount", 0.0, 1.0, 0.0)); // 40 - addParameter(new AudioParameterInt("select_specmodule0", "Select module", 0, 8, 1)); // 41 - addParameter(new AudioParameterInt("move_specmodule0", "Move module", 0, 8, 1)); // 42 + for (int i = 0; i < 9; ++i) // 41-49 + { + m_sm_enab_pars[i] = new AudioParameterBool("enab_specmodule"+String(i), "Enable spectral module "+String(i+1), false); + addParameter(m_sm_enab_pars[i]); + } auto& pars = getParameters(); for (const auto& p : pars) m_reset_pars.push_back(p->getValue()); @@ -647,6 +650,8 @@ void PaulstretchpluginAudioProcessor::processBlock (AudioSampleBuffer& buffer, M m_free_filter_envelope->m_transform_y_random_rate = *getIntParameter(cpi_freefilter_randomy_rate); m_free_filter_envelope->m_transform_y_random_amount = *getFloatParameter(cpi_freefilter_randomy_amount); + m_stretch_source->setSpectralModulesEnabled(m_sm_enab_pars); + 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 7960024..86569eb 100644 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -23,6 +23,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" +#include class MyThumbCache; @@ -67,8 +68,15 @@ const int cpi_freefilter_tilty = 37; const int cpi_freefilter_randomy_numbands = 38; const int cpi_freefilter_randomy_rate = 39; const int cpi_freefilter_randomy_amount = 40; -const int cpi_select_spec_module = 41; -const int cpi_move_spec_module = 42; +const int cpi_enable_spec_module0 = 41; +const int cpi_enable_spec_module1 = 42; +const int cpi_enable_spec_module2 = 43; +const int cpi_enable_spec_module3 = 44; +const int cpi_enable_spec_module4 = 45; +const int cpi_enable_spec_module5 = 46; +const int cpi_enable_spec_module6 = 47; +const int cpi_enable_spec_module7 = 48; +const int cpi_enable_spec_module8 = 49; class MyPropertiesFile { @@ -222,7 +230,7 @@ private: void setParameters(const std::vector& pars); float m_cur_playrangeoffset = 0.0; void updateStretchParametersFromPluginParameters(ProcessParameters& pars); - + std::array m_sm_enab_pars; //============================================================================== JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (PaulstretchpluginAudioProcessor) };