Add properties file stuff. Store and restore last file import folder.
This commit is contained in:
		| @@ -186,7 +186,9 @@ void PaulstretchpluginAudioProcessorEditor::addAudioBlock(AudioBuffer<float>& bu | ||||
|  | ||||
| void PaulstretchpluginAudioProcessorEditor::chooseFile() | ||||
| { | ||||
|     File initialloc = File::getSpecialLocation(File::userHomeDirectory); | ||||
|     String initiallocfn = processor.m_propsfile->m_props_file->getValue("importfilefolder", | ||||
|                                                 File::getSpecialLocation(File::userHomeDirectory).getFullPathName()); | ||||
|     File initialloc(initiallocfn); | ||||
| 	String filterstring = processor.m_afm->getWildcardForAllFormats(); | ||||
| 	FileChooser myChooser("Please select audio file...", | ||||
| 		initialloc, | ||||
| @@ -200,6 +202,7 @@ void PaulstretchpluginAudioProcessorEditor::chooseFile() | ||||
|             pathname = pathname.substring(10); | ||||
|             resu = File(pathname); | ||||
|         } | ||||
|         processor.m_propsfile->m_props_file->setValue("importfilefolder", resu.getParentDirectory().getFullPathName()); | ||||
|         m_last_err = processor.setAudioFile(resu); | ||||
| 		if (processor.getAudioFile() != File()) | ||||
| 		{ | ||||
|   | ||||
| @@ -82,7 +82,8 @@ PaulstretchpluginAudioProcessor::PaulstretchpluginAudioProcessor() | ||||
|                        ) | ||||
| #endif | ||||
| { | ||||
| 	g_activeprocessors.insert(this); | ||||
| 	 | ||||
|     g_activeprocessors.insert(this); | ||||
| 	m_recbuffer.setSize(2, 44100); | ||||
| 	m_recbuffer.clear(); | ||||
| 	if (m_afm->getNumKnownFormats()==0) | ||||
|   | ||||
| @@ -56,6 +56,29 @@ const int cpi_num_outchans = 27; | ||||
| const int cpi_pause_enabled = 28; | ||||
| const int cpi_max_capture_len = 29; | ||||
|  | ||||
| class MyPropertiesFile | ||||
| { | ||||
| public: | ||||
|     MyPropertiesFile() | ||||
|     { | ||||
|          | ||||
|         PropertiesFile::Options poptions; | ||||
|         poptions.applicationName = "PaulXStretch3"; | ||||
|             poptions.folderName = "PaulXStretch3"; | ||||
|             poptions.commonToAllUsers = false; | ||||
|             poptions.doNotSave = false; | ||||
|             poptions.storageFormat = PropertiesFile::storeAsXML; | ||||
|             poptions.millisecondsBeforeSaving = 1000; | ||||
|             poptions.ignoreCaseOfKeyNames = false; | ||||
|             poptions.processLock = nullptr; | ||||
|             poptions.filenameSuffix = ".xml"; | ||||
|             poptions.osxLibrarySubFolder = "Application Support"; | ||||
|         m_props_file = std::make_unique<PropertiesFile>(poptions); | ||||
|          | ||||
|     } | ||||
|     std::unique_ptr<PropertiesFile> m_props_file; | ||||
| }; | ||||
|  | ||||
| class PaulstretchpluginAudioProcessor  : public AudioProcessor, public MultiTimer | ||||
| { | ||||
| public: | ||||
| @@ -106,6 +129,7 @@ public: | ||||
| 	File getAudioFile() { return m_current_file; } | ||||
| 	Range<double> getTimeSelection(); | ||||
| 	SharedResourcePointer<AudioFormatManager> m_afm; | ||||
|     SharedResourcePointer<MyPropertiesFile> m_propsfile; | ||||
| 	StretchAudioSource* getStretchSource() { return m_stretch_source.get(); } | ||||
| 	double getPreBufferingPercent(); | ||||
| 	void timerCallback(int id) override; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 xenakios
					xenakios