Remove import file parameter and replace with spectrum module select parameter

This commit is contained in:
xenakios 2018-03-03 22:48:24 +02:00
parent 219a0b9a49
commit e1b0f6aaad
4 changed files with 14 additions and 16 deletions

View File

@ -354,6 +354,7 @@ void PaulstretchpluginAudioProcessorEditor::timerCallback(int id)
} }
if (id == 3) if (id == 3)
{ {
m_spec_order_ed.setModuleSelected(*processor.getIntParameter(cpi_select_spec_module));
processor.m_free_filter_envelope->updateMinMaxValues(); processor.m_free_filter_envelope->updateMinMaxValues();
m_free_filter_component.repaint(); m_free_filter_component.repaint();
} }
@ -383,7 +384,6 @@ void PaulstretchpluginAudioProcessorEditor::filesDropped(const StringArray & fil
void PaulstretchpluginAudioProcessorEditor::chooseFile() void PaulstretchpluginAudioProcessorEditor::chooseFile()
{ {
toFront(true);
String initiallocfn = processor.m_propsfile->m_props_file->getValue("importfilefolder", String initiallocfn = processor.m_propsfile->m_props_file->getValue("importfilefolder",
File::getSpecialLocation(File::userHomeDirectory).getFullPathName()); File::getSpecialLocation(File::userHomeDirectory).getFullPathName());
File initialloc(initiallocfn); File initialloc(initiallocfn);
@ -403,7 +403,7 @@ void PaulstretchpluginAudioProcessorEditor::chooseFile()
processor.m_propsfile->m_props_file->setValue("importfilefolder", resu.getParentDirectory().getFullPathName()); processor.m_propsfile->m_props_file->setValue("importfilefolder", resu.getParentDirectory().getFullPathName());
m_last_err = processor.setAudioFile(resu); m_last_err = processor.setAudioFile(resu);
} }
processor.m_import_dlg_open = false;
} }
void PaulstretchpluginAudioProcessorEditor::showSettingsMenu() void PaulstretchpluginAudioProcessorEditor::showSettingsMenu()
@ -971,6 +971,15 @@ void SpectralChainEditor::mouseUp(const MouseEvent & ev)
repaint(); repaint();
} }
void SpectralChainEditor::setModuleSelected(int id)
{
if (id != m_cur_index)
{
m_cur_index = id;
repaint();
}
}
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;

View File

@ -196,6 +196,7 @@ public:
std::function<void(int)> ModuleSelectedCallback; std::function<void(int)> ModuleSelectedCallback;
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);
private: private:
StretchAudioSource * m_src = nullptr; StretchAudioSource * m_src = nullptr;
bool m_did_drag = false; bool m_did_drag = false;

View File

@ -157,7 +157,7 @@ PaulstretchpluginAudioProcessor::PaulstretchpluginAudioProcessor()
addParameter(new AudioParameterInt("freefilter_randomybands0", "Random bands", 2, 128, 16)); // 38 addParameter(new AudioParameterInt("freefilter_randomybands0", "Random bands", 2, 128, 16)); // 38
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 AudioParameterBool("importfiletrigger0", "Import file", false)); // 41 addParameter(new AudioParameterInt("select_specmodule0", "Select module", 0, 8, 1)); // 41
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());
@ -795,18 +795,6 @@ void PaulstretchpluginAudioProcessor::timerCallback(int id)
{ {
if (id == 1) if (id == 1)
{ {
if (*getBoolParameter(cpi_import_file)==true && m_import_dlg_open == false)
{
m_import_dlg_open = true;
*getBoolParameter(cpi_import_file) = false;
{
callGUI(this, [](PaulstretchpluginAudioProcessorEditor* ed)
{
ed->chooseFile();
}, true);
return;
}
}
bool capture = getParameter(cpi_capture_enabled); bool capture = getParameter(cpi_capture_enabled);
if (capture == false && m_max_reclen != *getFloatParameter(cpi_max_capture_len)) if (capture == false && m_max_reclen != *getFloatParameter(cpi_max_capture_len))
{ {

View File

@ -67,7 +67,7 @@ const int cpi_freefilter_tilty = 37;
const int cpi_freefilter_randomy_numbands = 38; 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_import_file = 41; const int cpi_select_spec_module = 41;
class MyPropertiesFile class MyPropertiesFile
{ {