From 4f148a322d8dfe0a58ef4abf8cc59f04f3b8732c Mon Sep 17 00:00:00 2001 From: xenakios Date: Sat, 3 Mar 2018 23:06:06 +0200 Subject: [PATCH] blah --- Source/PluginEditor.cpp | 14 ++++++++++++++ Source/PluginEditor.h | 1 + Source/PluginProcessor.cpp | 1 + Source/PluginProcessor.h | 1 + 4 files changed, 17 insertions(+) diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index 8372616..546a45f 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -355,6 +355,8 @@ 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(); } @@ -980,6 +982,18 @@ void SpectralChainEditor::setModuleSelected(int id) } } +void SpectralChainEditor::moveModule(int old_id, int new_id) +{ + if (old_id == m_cur_index) + return; + std::swap(m_order[old_id], m_order[new_id]); + m_cur_index = new_id; + m_src->setSpectrumProcessOrder(m_order); + repaint(); + if (ModuleOrderOrEnabledChangedCallback) + ModuleOrderOrEnabledChangedCallback(); +} + void SpectralChainEditor::drawBox(Graphics & g, int index, int x, int y, int w, int h) { String txt; diff --git a/Source/PluginEditor.h b/Source/PluginEditor.h index 5df5959..2aff22e 100644 --- a/Source/PluginEditor.h +++ b/Source/PluginEditor.h @@ -197,6 +197,7 @@ public: std::function ModuleOrderOrEnabledChangedCallback; const std::vector & getOrder() const { return m_order; } void setModuleSelected(int id); + void moveModule(int old_id, int new_id); private: StretchAudioSource * m_src = nullptr; bool m_did_drag = false; diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index 0bad542..f2fda4a 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -158,6 +158,7 @@ PaulstretchpluginAudioProcessor::PaulstretchpluginAudioProcessor() 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 auto& pars = getParameters(); for (const auto& p : pars) m_reset_pars.push_back(p->getValue()); diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h index 8a818f4..7960024 100644 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -68,6 +68,7 @@ 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; class MyPropertiesFile {