Try adding parameter to open the import file dialog, but now working right at the moment
This commit is contained in:
		@@ -383,6 +383,7 @@ void PaulstretchpluginAudioProcessorEditor::filesDropped(const StringArray & fil
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void PaulstretchpluginAudioProcessorEditor::chooseFile()
 | 
					void PaulstretchpluginAudioProcessorEditor::chooseFile()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						processor.m_import_dlg_open = 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);
 | 
				
			||||||
@@ -402,6 +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()
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -220,6 +220,7 @@ public:
 | 
				
			|||||||
	void filesDropped(const StringArray &files, int x, int y) override;
 | 
						void filesDropped(const StringArray &files, int x, int y) override;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	WaveformComponent m_wavecomponent;
 | 
						WaveformComponent m_wavecomponent;
 | 
				
			||||||
 | 
						void chooseFile();
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    PaulstretchpluginAudioProcessor& processor;
 | 
					    PaulstretchpluginAudioProcessor& processor;
 | 
				
			||||||
	std::vector<std::unique_ptr<ParameterComponent>> m_parcomps;
 | 
						std::vector<std::unique_ptr<ParameterComponent>> m_parcomps;
 | 
				
			||||||
@@ -229,7 +230,7 @@ private:
 | 
				
			|||||||
	TextButton m_settings_button;
 | 
						TextButton m_settings_button;
 | 
				
			||||||
	Label m_info_label;
 | 
						Label m_info_label;
 | 
				
			||||||
	SpectralChainEditor m_spec_order_ed;
 | 
						SpectralChainEditor m_spec_order_ed;
 | 
				
			||||||
	void chooseFile();
 | 
						
 | 
				
			||||||
	void showSettingsMenu();
 | 
						void showSettingsMenu();
 | 
				
			||||||
    String m_last_err;
 | 
					    String m_last_err;
 | 
				
			||||||
	zoom_scrollbar m_zs;
 | 
						zoom_scrollbar m_zs;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -157,6 +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
 | 
				
			||||||
	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());
 | 
				
			||||||
@@ -794,6 +795,18 @@ void PaulstretchpluginAudioProcessor::timerCallback(int id)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	if (id == 1)
 | 
						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);
 | 
							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))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -67,6 +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;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class MyPropertiesFile
 | 
					class MyPropertiesFile
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -178,6 +179,7 @@ public:
 | 
				
			|||||||
	Range<double> m_wave_view_range;
 | 
						Range<double> m_wave_view_range;
 | 
				
			||||||
    int m_prepare_count = 0;
 | 
					    int m_prepare_count = 0;
 | 
				
			||||||
    shared_envelope m_free_filter_envelope;
 | 
					    shared_envelope m_free_filter_envelope;
 | 
				
			||||||
 | 
						bool m_import_dlg_open = false;
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user