diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index 14877e0..dec5af9 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -383,6 +383,7 @@ void PaulstretchpluginAudioProcessorEditor::filesDropped(const StringArray & fil void PaulstretchpluginAudioProcessorEditor::chooseFile() { + processor.m_import_dlg_open = true; String initiallocfn = processor.m_propsfile->m_props_file->getValue("importfilefolder", File::getSpecialLocation(File::userHomeDirectory).getFullPathName()); File initialloc(initiallocfn); @@ -402,6 +403,7 @@ void PaulstretchpluginAudioProcessorEditor::chooseFile() processor.m_propsfile->m_props_file->setValue("importfilefolder", resu.getParentDirectory().getFullPathName()); m_last_err = processor.setAudioFile(resu); } + processor.m_import_dlg_open = false; } void PaulstretchpluginAudioProcessorEditor::showSettingsMenu() diff --git a/Source/PluginEditor.h b/Source/PluginEditor.h index e8c55a7..fb9fe37 100644 --- a/Source/PluginEditor.h +++ b/Source/PluginEditor.h @@ -220,6 +220,7 @@ public: void filesDropped(const StringArray &files, int x, int y) override; WaveformComponent m_wavecomponent; + void chooseFile(); private: PaulstretchpluginAudioProcessor& processor; std::vector> m_parcomps; @@ -229,7 +230,7 @@ private: TextButton m_settings_button; Label m_info_label; SpectralChainEditor m_spec_order_ed; - void chooseFile(); + void showSettingsMenu(); String m_last_err; zoom_scrollbar m_zs; diff --git a/Source/PluginProcessor.cpp b/Source/PluginProcessor.cpp index fa39fcd..eccfba1 100644 --- a/Source/PluginProcessor.cpp +++ b/Source/PluginProcessor.cpp @@ -157,6 +157,7 @@ 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 AudioParameterBool("importfiletrigger0", "Import file", false)); // 41 auto& pars = getParameters(); for (const auto& p : pars) m_reset_pars.push_back(p->getValue()); @@ -794,6 +795,18 @@ void PaulstretchpluginAudioProcessor::timerCallback(int id) { if (id == 1) { + if (*getBoolParameter(cpi_import_file)==true) + { + *getBoolParameter(cpi_import_file) = false; + if (m_import_dlg_open == false) + { + callGUI(this, [](PaulstretchpluginAudioProcessorEditor* ed) + { + ed->chooseFile(); + }, true); + return; + } + } bool capture = getParameter(cpi_capture_enabled); if (capture == false && m_max_reclen != *getFloatParameter(cpi_max_capture_len)) { diff --git a/Source/PluginProcessor.h b/Source/PluginProcessor.h index 62a3a3e..558dad2 100644 --- a/Source/PluginProcessor.h +++ b/Source/PluginProcessor.h @@ -67,6 +67,7 @@ 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_import_file = 41; class MyPropertiesFile { @@ -178,6 +179,7 @@ public: Range m_wave_view_range; int m_prepare_count = 0; shared_envelope m_free_filter_envelope; + bool m_import_dlg_open = false; private: