Try adding parameter to open the import file dialog, but now working right at the moment

This commit is contained in:
xenakios 2018-03-03 22:19:02 +02:00
parent 9a17b7b6c6
commit 47bf763408
4 changed files with 19 additions and 1 deletions

View File

@ -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()

View File

@ -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<std::unique_ptr<ParameterComponent>> 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;

View File

@ -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))
{

View File

@ -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<double> m_wave_view_range;
int m_prepare_count = 0;
shared_envelope m_free_filter_envelope;
bool m_import_dlg_open = false;
private: