@@ -355,6 +355,8 @@ void PaulstretchpluginAudioProcessorEditor::timerCallback(int id) | |||||
if (id == 3) | if (id == 3) | ||||
{ | { | ||||
m_spec_order_ed.setModuleSelected(*processor.getIntParameter(cpi_select_spec_module)); | 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(); | processor.m_free_filter_envelope->updateMinMaxValues(); | ||||
m_free_filter_component.repaint(); | 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) | void SpectralChainEditor::drawBox(Graphics & g, int index, int x, int y, int w, int h) | ||||
{ | { | ||||
String txt; | String txt; | ||||
@@ -197,6 +197,7 @@ public: | |||||
std::function<void(void)> ModuleOrderOrEnabledChangedCallback; | std::function<void(void)> ModuleOrderOrEnabledChangedCallback; | ||||
const std::vector <SpectrumProcess>& getOrder() const { return m_order; } | const std::vector <SpectrumProcess>& getOrder() const { return m_order; } | ||||
void setModuleSelected(int id); | void setModuleSelected(int id); | ||||
void moveModule(int old_id, int new_id); | |||||
private: | private: | ||||
StretchAudioSource * m_src = nullptr; | StretchAudioSource * m_src = nullptr; | ||||
bool m_did_drag = false; | bool m_did_drag = false; | ||||
@@ -158,6 +158,7 @@ PaulstretchpluginAudioProcessor::PaulstretchpluginAudioProcessor() | |||||
addParameter(new AudioParameterInt("freefilter_randomyrate0", "Random rate", 1, 32, 2)); // 39 | 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 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("select_specmodule0", "Select module", 0, 8, 1)); // 41 | ||||
addParameter(new AudioParameterInt("move_specmodule0", "Move module", 0, 8, 1)); // 42 | |||||
auto& pars = getParameters(); | auto& pars = getParameters(); | ||||
for (const auto& p : pars) | for (const auto& p : pars) | ||||
m_reset_pars.push_back(p->getValue()); | m_reset_pars.push_back(p->getValue()); | ||||
@@ -68,6 +68,7 @@ const int cpi_freefilter_randomy_numbands = 38; | |||||
const int cpi_freefilter_randomy_rate = 39; | const int cpi_freefilter_randomy_rate = 39; | ||||
const int cpi_freefilter_randomy_amount = 40; | const int cpi_freefilter_randomy_amount = 40; | ||||
const int cpi_select_spec_module = 41; | const int cpi_select_spec_module = 41; | ||||
const int cpi_move_spec_module = 42; | |||||
class MyPropertiesFile | class MyPropertiesFile | ||||
{ | { | ||||